refactor: internal package
This commit is contained in:
@@ -7,10 +7,10 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
"github.com/nalgeon/codapi/sandbox"
|
"github.com/nalgeon/codapi/internal/sandbox"
|
||||||
"github.com/nalgeon/codapi/server"
|
"github.com/nalgeon/codapi/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version string = "main"
|
var Version string = "main"
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
"github.com/nalgeon/codapi/fileio"
|
"github.com/nalgeon/codapi/internal/fileio"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
var killTimeout = 5 * time.Second
|
var killTimeout = 5 * time.Second
|
||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
var dockerCfg = &config.Config{
|
var dockerCfg = &config.Config{
|
||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/stringx"
|
"github.com/nalgeon/codapi/internal/stringx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Request initiates code execution.
|
// A Request initiates code execution.
|
||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Program is an executable program.
|
// A Program is an executable program.
|
||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProgram_Run(t *testing.T) {
|
func TestProgram_Run(t *testing.T) {
|
||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/httpx"
|
"github.com/nalgeon/codapi/internal/httpx"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// An HTTP engine sends HTTP requests.
|
// An HTTP engine sends HTTP requests.
|
||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/httpx"
|
"github.com/nalgeon/codapi/internal/httpx"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
var httpCfg = &config.Config{
|
var httpCfg = &config.Config{
|
||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mock installs mock outputs for given commands.
|
// Mock installs mock outputs for given commands.
|
||||||
@@ -4,8 +4,8 @@ package sandbox
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A semaphore represents available concurrent workers
|
// A semaphore represents available concurrent workers
|
||||||
@@ -3,8 +3,8 @@ package sandbox
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cfg = &config.Config{
|
var cfg = &config.Config{
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrUnknownSandbox = errors.New("unknown sandbox")
|
var ErrUnknownSandbox = errors.New("unknown sandbox")
|
||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValidate(t *testing.T) {
|
func TestValidate(t *testing.T) {
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_readJson(t *testing.T) {
|
func Test_readJson(t *testing.T) {
|
||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
"github.com/nalgeon/codapi/sandbox"
|
"github.com/nalgeon/codapi/internal/sandbox"
|
||||||
"github.com/nalgeon/codapi/stringx"
|
"github.com/nalgeon/codapi/internal/stringx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewRouter creates HTTP routes and handlers for them.
|
// NewRouter creates HTTP routes and handlers for them.
|
||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/config"
|
"github.com/nalgeon/codapi/internal/config"
|
||||||
"github.com/nalgeon/codapi/engine"
|
"github.com/nalgeon/codapi/internal/engine"
|
||||||
"github.com/nalgeon/codapi/execy"
|
"github.com/nalgeon/codapi/internal/execy"
|
||||||
"github.com/nalgeon/codapi/sandbox"
|
"github.com/nalgeon/codapi/internal/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cfg = &config.Config{
|
var cfg = &config.Config{
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nalgeon/codapi/logx"
|
"github.com/nalgeon/codapi/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The maximum duration of the server graceful shutdown.
|
// The maximum duration of the server graceful shutdown.
|
||||||
Reference in New Issue
Block a user