Skip to content

Commit c1ca13c

Browse files
Adds support for Go 1.26 (Feb 2026) to the go and go-postgres templates. (#408)
* Update Go version to 1.26 in Dockerfiles and documentation * change in devcontainer configuration * Update Go version in devcontainer template * Update Go version proposals in devcontainer template Removed outdated Go versions from proposals. * Fix formatting * debugging * Update Go version to 1.26 and improve environment checks in test script * revert to v1.10.4 * Update Go module dependency and enhance environment checks in test script * Refactor Docker Compose and test scripts for improved clarity and functionality * Fix indentation in docker-compose.yml
1 parent c07f2f0 commit c1ca13c

8 files changed

Lines changed: 25 additions & 33 deletions

File tree

src/go-postgres/.devcontainer/docker-compose.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,31 @@ volumes:
55

66
services:
77
app:
8-
build:
8+
build:
99
context: .
1010
dockerfile: Dockerfile
1111
env_file:
12-
# Ensure that the variables in .env match the same variables in devcontainer.json
13-
- .env
12+
# Ensure that the variables in .env match the same variables in devcontainer.json
13+
- .env
1414

1515
volumes:
1616
- ../..:/workspaces:cached
17-
17+
1818
# Overrides default command so things don't shut down after the process ends.
1919
command: sleep infinity
2020

2121
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
2222
network_mode: service:db
23-
2423
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
2524
# (Adding the "ports" property to this file will not forward from a Codespace.)
2625

2726
db:
2827
image: postgres:latest
2928
restart: unless-stopped
3029
volumes:
31-
- postgres-data:/var/lib/postgresql/data
30+
- postgres-data:/var/lib/postgresql
3231
env_file:
3332
# Ensure that the variables in .env match the same variables in devcontainer.json
3433
- .env
35-
36-
3734
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
3835
# (Adding the "ports" property to this file will not forward from a Codespace.)

src/go-postgres/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Use and develop Go + Postgres applications. Includes appropriate runtime args, G
77

88
| Options Id | Description | Type | Default Value |
99
|-----|-----|-----|-----|
10-
| imageVariant | Go version: | string | 1.25-trixie |
10+
| imageVariant | Go version: | string | 1.26-trixie |
1111

1212
This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata.
1313

src/go-postgres/devcontainer-template.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "go-postgres",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"name": "Go & PostgreSQL",
55
"description": "Use and develop Go + Postgres applications. Includes appropriate runtime args, Go, common tools, extensions, and dependencies.",
66
"documentationURL": "https://github.com/devcontainers/templates/tree/main/src/go-postgres",
@@ -11,16 +11,12 @@
1111
"type": "string",
1212
"description": "Go version:",
1313
"proposals": [
14-
"1-trixie",
14+
"1.26-trixie",
1515
"1.25-trixie",
16-
"1.24-trixie",
17-
"1-bookworm",
18-
"1.25-bookworm",
19-
"1.24-bookworm",
20-
"1-bullseye",
21-
"1.24-bullseye"
16+
"1.26-bookworm",
17+
"1.25-bookworm"
2218
],
23-
"default": "1.25-trixie"
19+
"default": "1.26-trixie"
2420
}
2521
},
2622
"platforms": ["Go"],

src/go/.devcontainer/devcontainer.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@
44
"name": "Go",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/go:2-${templateOption:imageVariant}"
7-
87
// Features to add to the dev container. More info: https://containers.dev/features.
98
// "features": {},
10-
119
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1210
// "forwardPorts": [],
13-
1411
// Use 'postCreateCommand' to run commands after the container is created.
1512
// "postCreateCommand": "go version",
16-
1713
// Configure tool-specific properties.
1814
// "customizations": {},
19-
2015
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
2116
// "remoteUser": "root"
22-
}
17+
}

src/go/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Develop Go based applications. Includes appropriate runtime args, Go, common too
77

88
| Options Id | Description | Type | Default Value |
99
|-----|-----|-----|-----|
10-
| imageVariant | Go version: | string | 1.25-trixie |
10+
| imageVariant | Go version: | string | 1.26-trixie |
1111

1212
This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata.
1313

src/go/devcontainer-template.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "go",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"name": "Go",
55
"description": "Develop Go based applications. Includes appropriate runtime args, Go, common tools, extensions, and dependencies.",
66
"documentationURL": "https://github.com/devcontainers/templates/tree/main/src/go",
@@ -11,14 +11,12 @@
1111
"type": "string",
1212
"description": "Go version:",
1313
"proposals": [
14-
"1-trixie",
15-
"1.24-trixie",
14+
"1.26-trixie",
1615
"1.25-trixie",
17-
"1.25-bookworm",
18-
"1.24-bookworm",
19-
"1.24-bullseye"
16+
"1.26-bookworm",
17+
"1.25-bookworm"
2018
],
21-
"default": "1.25-trixie"
19+
"default": "1.26-trixie"
2220
}
2321
},
2422
"platforms": ["Go"],

test/go-postgres/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module test-project
22

3-
go 1.17
3+
go 1.26
44

55
require github.com/lib/pq v1.10.4

test/go-postgres/test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ checkCommon
99
# Run template specific tests
1010
checkExtension "golang.Go"
1111

12+
echo "=== Go Environment Check ==="
13+
go env GOPROXY
14+
go env GOSUMDB
15+
go version
16+
echo "==============================="
17+
1218
check "lib pq check" go list github.com/lib/pq
1319
check "go test program" go run hello.go
1420

0 commit comments

Comments
 (0)