diff --git a/Dockerfile b/Dockerfile index 717b1b9..57a0007 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,12 +20,12 @@ WORKDIR /olin COPY . . COPY --from=rust-wasm-tools /olin/cwagi.wasm ./cmd/cwa-cgi/testdata/test.wasm COPY --from=rust-wasm-tools /olin/cwa-tests.wasm ./cmd/cwa/testdata/test.wasm -RUN GOARCH=wasm GOOS=js go build -o ./cmd/cwa/testdata/go.wasm ./internal/abi/wasmgo/testdata/nothing.go +RUN GOARCH=wasm GOOS=js go build -o ./cmd/cwa/testdata/go.wasm ./abi/wasmgo/testdata/nothing.go RUN go test -v ./cmd/... ./internal/... RUN GOBIN=/usr/local/bin go install ./cmd/cwa-cgi RUN GOBIN=/usr/local/bin go install ./cmd/cwa -FROM xena/zig:0.4.0-0f8fc3b9 AS zig +FROM xena/zig:0.5.0 AS zig WORKDIR /olin COPY ./zig . COPY --from=go /usr/local/bin/cwa /usr/local/bin/cwa diff --git a/internal/abi/abi.go b/abi/abi.go similarity index 100% rename from internal/abi/abi.go rename to abi/abi.go diff --git a/internal/abi/cwa/README.md b/abi/cwa/README.md similarity index 100% rename from internal/abi/cwa/README.md rename to abi/cwa/README.md diff --git a/internal/abi/cwa/c.go b/abi/cwa/c.go similarity index 100% rename from internal/abi/cwa/c.go rename to abi/cwa/c.go diff --git a/internal/abi/cwa/core.go b/abi/cwa/core.go similarity index 99% rename from internal/abi/cwa/core.go rename to abi/cwa/core.go index 0f76a2a..4c8990c 100644 --- a/internal/abi/cwa/core.go +++ b/abi/cwa/core.go @@ -8,7 +8,7 @@ import ( "os" "github.com/perlin-network/life/exec" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // NewProcess creates a new process with the given name, arguments and environment. diff --git a/internal/abi/cwa/core_test.go b/abi/cwa/core_test.go similarity index 52% rename from internal/abi/cwa/core_test.go rename to abi/cwa/core_test.go index 39b4454..af384b2 100644 --- a/internal/abi/cwa/core_test.go +++ b/abi/cwa/core_test.go @@ -1,6 +1,6 @@ package cwa -import "within.website/olin/internal/abi" +import "within.website/olin/abi" var ( _ abi.ABI = &Process{} diff --git a/internal/abi/cwa/doc.go b/abi/cwa/doc.go similarity index 100% rename from internal/abi/cwa/doc.go rename to abi/cwa/doc.go diff --git a/internal/abi/cwa/env.go b/abi/cwa/env.go similarity index 100% rename from internal/abi/cwa/env.go rename to abi/cwa/env.go diff --git a/internal/abi/cwa/error.go b/abi/cwa/error.go similarity index 100% rename from internal/abi/cwa/error.go rename to abi/cwa/error.go diff --git a/internal/abi/cwa/error_string.go b/abi/cwa/error_string.go similarity index 100% rename from internal/abi/cwa/error_string.go rename to abi/cwa/error_string.go diff --git a/internal/abi/cwa/io.go b/abi/cwa/io.go similarity index 90% rename from internal/abi/cwa/io.go rename to abi/cwa/io.go index 2f0b38c..6771eb7 100644 --- a/internal/abi/cwa/io.go +++ b/abi/cwa/io.go @@ -3,7 +3,7 @@ package cwa import ( "math/rand" - "within.website/olin/internal/fileresolver" + "within.website/olin/fileresolver" ) func (p *Process) IOGetStdin() int32 { diff --git a/internal/abi/cwa/logging.go b/abi/cwa/logging.go similarity index 100% rename from internal/abi/cwa/logging.go rename to abi/cwa/logging.go diff --git a/internal/abi/cwa/names.go b/abi/cwa/names.go similarity index 100% rename from internal/abi/cwa/names.go rename to abi/cwa/names.go diff --git a/internal/abi/cwa/random.go b/abi/cwa/random.go similarity index 100% rename from internal/abi/cwa/random.go rename to abi/cwa/random.go diff --git a/internal/abi/cwa/resource.go b/abi/cwa/resource.go similarity index 96% rename from internal/abi/cwa/resource.go rename to abi/cwa/resource.go index ac56297..eb46370 100644 --- a/internal/abi/cwa/resource.go +++ b/abi/cwa/resource.go @@ -6,8 +6,8 @@ import ( "net/url" "os" - "within.website/olin/internal/abi" - "within.website/olin/internal/fileresolver" + "within.website/olin/abi" + "within.website/olin/fileresolver" ) func (p *Process) ResourceOpen(urlPtr, urlLen uint32) (int32, error) { diff --git a/internal/abi/cwa/runtime.go b/abi/cwa/runtime.go similarity index 100% rename from internal/abi/cwa/runtime.go rename to abi/cwa/runtime.go diff --git a/internal/abi/cwa/startup.go b/abi/cwa/startup.go similarity index 100% rename from internal/abi/cwa/startup.go rename to abi/cwa/startup.go diff --git a/internal/abi/cwa/time.go b/abi/cwa/time.go similarity index 100% rename from internal/abi/cwa/time.go rename to abi/cwa/time.go diff --git a/internal/abi/dagger/c.go b/abi/dagger/c.go similarity index 100% rename from internal/abi/dagger/c.go rename to abi/dagger/c.go diff --git a/internal/abi/dagger/doc.go b/abi/dagger/doc.go similarity index 100% rename from internal/abi/dagger/doc.go rename to abi/dagger/doc.go diff --git a/internal/abi/dagger/errno_string.go b/abi/dagger/errno_string.go similarity index 100% rename from internal/abi/dagger/errno_string.go rename to abi/dagger/errno_string.go diff --git a/internal/abi/dagger/error.go b/abi/dagger/error.go similarity index 100% rename from internal/abi/dagger/error.go rename to abi/dagger/error.go diff --git a/internal/abi/dagger/process.go b/abi/dagger/process.go similarity index 98% rename from internal/abi/dagger/process.go rename to abi/dagger/process.go index eb2146f..3c786c2 100644 --- a/internal/abi/dagger/process.go +++ b/abi/dagger/process.go @@ -9,8 +9,8 @@ import ( "strconv" "github.com/perlin-network/life/exec" - "within.website/olin/internal/abi" - "within.website/olin/internal/fileresolver" + "within.website/olin/abi" + "within.website/olin/fileresolver" ) // Process is a higher level wrapper around a set of files for dagger diff --git a/internal/abi/dagger/process_test.go b/abi/dagger/process_test.go similarity index 98% rename from internal/abi/dagger/process_test.go rename to abi/dagger/process_test.go index a73600f..cec9551 100644 --- a/internal/abi/dagger/process_test.go +++ b/abi/dagger/process_test.go @@ -11,7 +11,7 @@ import ( "github.com/perlin-network/life/compiler" "github.com/perlin-network/life/exec" - "within.website/olin/internal/fileresolver" + "within.website/olin/fileresolver" ) func getFunctionName(i interface{}) string { diff --git a/internal/abi/dagger/testdata/helloworld.wasm b/abi/dagger/testdata/helloworld.wasm similarity index 100% rename from internal/abi/dagger/testdata/helloworld.wasm rename to abi/dagger/testdata/helloworld.wasm diff --git a/internal/abi/dagger/testdata/helloworld.wat b/abi/dagger/testdata/helloworld.wat similarity index 100% rename from internal/abi/dagger/testdata/helloworld.wat rename to abi/dagger/testdata/helloworld.wat diff --git a/internal/abi/dagger/testdata/http.wasm b/abi/dagger/testdata/http.wasm similarity index 100% rename from internal/abi/dagger/testdata/http.wasm rename to abi/dagger/testdata/http.wasm diff --git a/internal/abi/dagger/testdata/http.wat b/abi/dagger/testdata/http.wat similarity index 100% rename from internal/abi/dagger/testdata/http.wat rename to abi/dagger/testdata/http.wat diff --git a/internal/abi/dagger/testdata/open.wasm b/abi/dagger/testdata/open.wasm similarity index 100% rename from internal/abi/dagger/testdata/open.wasm rename to abi/dagger/testdata/open.wasm diff --git a/internal/abi/dagger/testdata/open.wat b/abi/dagger/testdata/open.wat similarity index 100% rename from internal/abi/dagger/testdata/open.wat rename to abi/dagger/testdata/open.wat diff --git a/internal/abi/wasmgo/abi.go b/abi/wasmgo/abi.go similarity index 100% rename from internal/abi/wasmgo/abi.go rename to abi/wasmgo/abi.go diff --git a/internal/abi/wasmgo/doc.go b/abi/wasmgo/doc.go similarity index 100% rename from internal/abi/wasmgo/doc.go rename to abi/wasmgo/doc.go diff --git a/internal/abi/wasmgo/js.go b/abi/wasmgo/js.go similarity index 100% rename from internal/abi/wasmgo/js.go rename to abi/wasmgo/js.go diff --git a/internal/abi/wasmgo/testdata/.gitignore b/abi/wasmgo/testdata/.gitignore similarity index 100% rename from internal/abi/wasmgo/testdata/.gitignore rename to abi/wasmgo/testdata/.gitignore diff --git a/internal/abi/wasmgo/testdata/nothing.go b/abi/wasmgo/testdata/nothing.go similarity index 100% rename from internal/abi/wasmgo/testdata/nothing.go rename to abi/wasmgo/testdata/nothing.go diff --git a/internal/abi/wasmgo/wasmgo.go b/abi/wasmgo/wasmgo.go similarity index 97% rename from internal/abi/wasmgo/wasmgo.go rename to abi/wasmgo/wasmgo.go index fd7721e..d0c6f4d 100644 --- a/internal/abi/wasmgo/wasmgo.go +++ b/abi/wasmgo/wasmgo.go @@ -6,8 +6,8 @@ import ( "time" "github.com/perlin-network/life/exec" - "within.website/olin/internal/abi/cwa" - "within.website/olin/internal/fileresolver" + "within.website/olin/abi/cwa" + "within.website/olin/fileresolver" ) type WasmGo struct { diff --git a/cmd/cwa-cgi/main_test.go b/cmd/cwa-cgi/main_test.go index a809b66..1a8d80f 100644 --- a/cmd/cwa-cgi/main_test.go +++ b/cmd/cwa-cgi/main_test.go @@ -18,7 +18,7 @@ import ( "github.com/perlin-network/life/exec" "within.website/ln" "within.website/ln/opname" - "within.website/olin/internal/abi/cwa" + "within.website/olin/abi/cwa" ) type vmServer struct { diff --git a/cmd/cwa/main.go b/cmd/cwa/main.go index 88289f1..d9b7636 100644 --- a/cmd/cwa/main.go +++ b/cmd/cwa/main.go @@ -13,8 +13,8 @@ import ( "github.com/perlin-network/life/compiler" "github.com/perlin-network/life/exec" - "within.website/olin/internal/abi/cwa" - "within.website/olin/internal/abi/wasmgo" + "within.website/olin/abi/cwa" + "within.website/olin/abi/wasmgo" ) var ( diff --git a/internal/fileresolver/doc.go b/fileresolver/doc.go similarity index 100% rename from internal/fileresolver/doc.go rename to fileresolver/doc.go diff --git a/internal/fileresolver/http.go b/fileresolver/http.go similarity index 98% rename from internal/fileresolver/http.go rename to fileresolver/http.go index 4c1fe50..9984bfd 100644 --- a/internal/fileresolver/http.go +++ b/fileresolver/http.go @@ -9,7 +9,7 @@ import ( "net/url" "os" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // HTTP creates a new HTTP transport that pretends to be a file. A process can diff --git a/internal/fileresolver/http_test.go b/fileresolver/http_test.go similarity index 100% rename from internal/fileresolver/http_test.go rename to fileresolver/http_test.go diff --git a/internal/fileresolver/log.go b/fileresolver/log.go similarity index 96% rename from internal/fileresolver/log.go rename to fileresolver/log.go index 6df1e7f..688b2c1 100644 --- a/internal/fileresolver/log.go +++ b/fileresolver/log.go @@ -4,7 +4,7 @@ import ( "io" "log" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // Log returns a file that redirects all write calls to a standard library logger diff --git a/internal/fileresolver/log_test.go b/fileresolver/log_test.go similarity index 100% rename from internal/fileresolver/log_test.go rename to fileresolver/log_test.go diff --git a/internal/fileresolver/null.go b/fileresolver/null.go similarity index 93% rename from internal/fileresolver/null.go rename to fileresolver/null.go index bd91518..44407b3 100644 --- a/internal/fileresolver/null.go +++ b/fileresolver/null.go @@ -1,6 +1,6 @@ package fileresolver -import "within.website/olin/internal/abi" +import "within.website/olin/abi" // Null is a file that emulates /dev/null on Linux. // diff --git a/internal/fileresolver/null_test.go b/fileresolver/null_test.go similarity index 100% rename from internal/fileresolver/null_test.go rename to fileresolver/null_test.go diff --git a/internal/fileresolver/osfile.go b/fileresolver/osfile.go similarity index 96% rename from internal/fileresolver/osfile.go rename to fileresolver/osfile.go index 6123f66..35bb894 100644 --- a/internal/fileresolver/osfile.go +++ b/fileresolver/osfile.go @@ -5,7 +5,7 @@ package fileresolver import ( "syscall" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // OSFile implements File backed by a raw operating system file. diff --git a/internal/fileresolver/partial.go b/fileresolver/partial.go similarity index 96% rename from internal/fileresolver/partial.go rename to fileresolver/partial.go index 2deb93d..49b58fc 100644 --- a/internal/fileresolver/partial.go +++ b/fileresolver/partial.go @@ -4,7 +4,7 @@ import ( "errors" "io" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // Errors exposed by partial.go diff --git a/internal/fileresolver/random.go b/fileresolver/random.go similarity index 83% rename from internal/fileresolver/random.go rename to fileresolver/random.go index 2fd4b6b..4452e44 100644 --- a/internal/fileresolver/random.go +++ b/fileresolver/random.go @@ -3,7 +3,7 @@ package fileresolver import ( "crypto/rand" - "within.website/olin/internal/abi" + "within.website/olin/abi" ) // Random returns a file that reads cryptographically random data. diff --git a/internal/fileresolver/test_test.go b/fileresolver/test_test.go similarity index 100% rename from internal/fileresolver/test_test.go rename to fileresolver/test_test.go diff --git a/internal/fileresolver/zero.go b/fileresolver/zero.go similarity index 93% rename from internal/fileresolver/zero.go rename to fileresolver/zero.go index ae717e6..60d49bd 100644 --- a/internal/fileresolver/zero.go +++ b/fileresolver/zero.go @@ -1,6 +1,6 @@ package fileresolver -import "within.website/olin/internal/abi" +import "within.website/olin/abi" // Zero is a file that does nothing. // diff --git a/internal/fileresolver/zero_test.go b/fileresolver/zero_test.go similarity index 100% rename from internal/fileresolver/zero_test.go rename to fileresolver/zero_test.go diff --git a/go.mod b/go.mod index badf78e..1e32f3e 100644 --- a/go.mod +++ b/go.mod @@ -10,3 +10,5 @@ require ( github.com/prometheus/client_golang v1.1.0 within.website/ln v0.6.0 ) + +go 1.13 diff --git a/internal/cwagi/cwagi.go b/internal/cwagi/cwagi.go index 3ff09f5..b122246 100644 --- a/internal/cwagi/cwagi.go +++ b/internal/cwagi/cwagi.go @@ -19,7 +19,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "within.website/ln" "within.website/ln/opname" - "within.website/olin/internal/abi/cwa" + "within.website/olin/abi/cwa" ) var ( diff --git a/internal/namegen/doc.go b/namegen/doc.go similarity index 100% rename from internal/namegen/doc.go rename to namegen/doc.go diff --git a/internal/namegen/namegen.go b/namegen/namegen.go similarity index 100% rename from internal/namegen/namegen.go rename to namegen/namegen.go diff --git a/internal/namegen/namegen_test.go b/namegen/namegen_test.go similarity index 100% rename from internal/namegen/namegen_test.go rename to namegen/namegen_test.go