diff --git a/pkg/universe.dagger.io/go/build.cue b/pkg/universe.dagger.io/go/build.cue index 5e64b171..72e1eef1 100644 --- a/pkg/universe.dagger.io/go/build.cue +++ b/pkg/universe.dagger.io/go/build.cue @@ -38,6 +38,7 @@ import ( } } command: { + name: "go" args: [package] flags: { build: true diff --git a/pkg/universe.dagger.io/go/container.cue b/pkg/universe.dagger.io/go/container.cue index d53009dd..df52f57b 100644 --- a/pkg/universe.dagger.io/go/container.cue +++ b/pkg/universe.dagger.io/go/container.cue @@ -18,25 +18,31 @@ import ( // Use go image _image: #Image - _sourcePath: "/src" - _cachePath: "/root/.cache/gocache" + _sourcePath: "/src" + _modCachePath: "/root/.cache/go-mod" + _buildCachePath: "/root/.cache/go-build" docker.#Run & { input: *_image.output | docker.#Image - workdir: "/src" - command: name: "go" + workdir: _sourcePath mounts: { "source": { dest: _sourcePath contents: source } - "go assets cache": { + "go mod cache": { contents: core.#CacheDir & { - id: "\(name)_assets" + id: "\(name)_mod" } - dest: _cachePath + dest: _modCachePath + } + "go build cache": { + contents: core.#CacheDir & { + id: "\(name)_build" + } + dest: _buildCachePath } } - env: GOMODCACHE: _cachePath + env: GOMODCACHE: _modCachePath } } diff --git a/pkg/universe.dagger.io/go/test.cue b/pkg/universe.dagger.io/go/test.cue index 5de2b94b..167c6a23 100644 --- a/pkg/universe.dagger.io/go/test.cue +++ b/pkg/universe.dagger.io/go/test.cue @@ -7,6 +7,7 @@ package go #Container & { command: { + name: "go" args: [package] flags: { test: true diff --git a/pkg/universe.dagger.io/go/test/container.cue b/pkg/universe.dagger.io/go/test/container.cue index 82aad0c5..4966a1a1 100644 --- a/pkg/universe.dagger.io/go/test/container.cue +++ b/pkg/universe.dagger.io/go/test/container.cue @@ -12,7 +12,10 @@ dagger.#Plan & { simple: go.#Container & { source: _source - command: args: ["version"] + command: { + name: "go" + args: ["version"] + } } override: { @@ -23,7 +26,10 @@ dagger.#Plan & { command: go.#Container & { input: base.output source: _source - command: args: ["version"] + command: { + name: "go" + args: ["version"] + } } } }