stdlib: fix dagger.io/go

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2021-05-25 00:54:04 +00:00 committed by Solomon Hykes
parent d8b4181926
commit 3349955144

View File

@ -3,6 +3,7 @@ package go
import ( import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/op" "dagger.io/dagger/op"
"dagger.io/docker"
"dagger.io/os" "dagger.io/os"
) )
@ -14,25 +15,22 @@ import (
source: dagger.#Artifact source: dagger.#Artifact
os.#Container & { os.#Container & {
env: { env: CGO_ENABLED: "0"
GOMODCACHE: volume.goCache.dest
CGO_ENABLED: "0" image: docker.#Pull & {
from: "docker.io/golang:\(version)-alpine"
} }
from: "docker.io/golang:\(version)-alpine" // Setup source dir
let srcPath = "/src"
mount: "\(srcPath)": from: source
dir: srcPath
volume: { // Setup go cache
goSource: { let cachePath = "/root/.cache/gocache"
from: source cache: "\(cachePath)": true
dest: "/src" env: GOMODCACHE: cachePath
}
goCache: {
type: "cache"
dest: "/root/.cache/gocache"
}
}
dir: volume.goSource.dest
// Add go to search path (FIXME: should be inherited from image metadata) // Add go to search path (FIXME: should be inherited from image metadata)
shell: search: "/usr/local/go/bin": true shell: search: "/usr/local/go/bin": true
} }