diff --git a/docs/pages/docs/providers/go.md b/docs/pages/docs/providers/go.md index e86523810..2ecb5d3ca 100644 --- a/docs/pages/docs/providers/go.md +++ b/docs/pages/docs/providers/go.md @@ -19,6 +19,7 @@ The following Go versions are available: - `1.20` - `1.21` - `1.22` (default) +- `1.23` The version is parsed from the `go.mod` file. diff --git a/examples/go-v123/go.mod b/examples/go-v123/go.mod new file mode 100644 index 000000000..f2780549b --- /dev/null +++ b/examples/go-v123/go.mod @@ -0,0 +1,3 @@ +module hello-world + +go 1.23 diff --git a/examples/go-v123/main.go b/examples/go-v123/main.go new file mode 100644 index 000000000..9ca930265 --- /dev/null +++ b/examples/go-v123/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello from Go!") +} diff --git a/src/providers/go.rs b/src/providers/go.rs index 50f90275b..230f9ebe7 100644 --- a/src/providers/go.rs +++ b/src/providers/go.rs @@ -35,6 +35,11 @@ const AVAILABLE_GO_VERSIONS: &[(&str, &str, &str)] = &[ "1f13eabcd6f5b00fe9de9575ac52c66a0e887ce6", ), ("1.22", "go", "e89cf1c932006531f454de7d652163a9a5c86668"), + ( + "1.23", + "go_1_23", + "05bbf675397d5366259409139039af8077d695ce", + ), ]; const DEFAULT_GO_PKG_NAME: &str = "go"; const DEFAULT_ARCHIVE: &str = "e89cf1c932006531f454de7d652163a9a5c86668"; diff --git a/tests/snapshots/generate_plan_tests__go_v123.snap b/tests/snapshots/generate_plan_tests__go_v123.snap new file mode 100644 index 000000000..3c8f57eab --- /dev/null +++ b/tests/snapshots/generate_plan_tests__go_v123.snap @@ -0,0 +1,52 @@ +--- +source: tests/generate_plan_tests.rs +expression: plan +snapshot_kind: text +--- +{ + "providers": [], + "buildImage": "[build_image]", + "variables": { + "CGO_ENABLED": "0", + "NIXPACKS_METADATA": "go" + }, + "phases": { + "build": { + "name": "build", + "dependsOn": [ + "install", + "setup" + ], + "cmds": [ + "go build -o out" + ], + "cacheDirectories": [ + "/root/.cache/go-build" + ] + }, + "install": { + "name": "install", + "dependsOn": [ + "setup" + ], + "cmds": [ + "go mod download" + ], + "cacheDirectories": [ + "/root/.cache/go-build" + ] + }, + "setup": { + "name": "setup", + "nixPkgs": [ + "go_1_23" + ], + "nixOverlays": [], + "nixpkgsArchive": "[archive]" + } + }, + "start": { + "cmd": "./out", + "runImage": "ubuntu:jammy" + } +}