Skip to content

Commit

Permalink
Add support for Go 1.23 (#1218)
Browse files Browse the repository at this point in the history
* add support for go 1.23

* add an example using go 1.23

* update docs

* fmt

* add go 1.23 snapshot
  • Loading branch information
FarazPatankar authored Nov 13, 2024
1 parent cd02104 commit 52a58e4
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/pages/docs/providers/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions examples/go-v123/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module hello-world

go 1.23
7 changes: 7 additions & 0 deletions examples/go-v123/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello from Go!")
}
5 changes: 5 additions & 0 deletions src/providers/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
52 changes: 52 additions & 0 deletions tests/snapshots/generate_plan_tests__go_v123.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 52a58e4

Please sign in to comment.