Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:1.25-trixie",
"image": "mcr.microsoft.com/devcontainers/go:1.26-trixie",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.9.0
version: v2.14.0
# Optional: working directory, useful for monorepos
working-directory: ${{ inputs.project-directory }}

Expand Down
31 changes: 5 additions & 26 deletions .github/workflows/ci-test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,11 @@ jobs:
cache-dependency-path: '${{ inputs.project-directory }}/go.sum'
id: go

- name: Check Go version compatibility
id: go-compat
shell: bash
run: |
# Modules that require Go 1.26+ and do not support Go 1.25.x
NO_SUPPORT_125=("modules/weaviate")

SKIP=false
for mod in "${NO_SUPPORT_125[@]}"; do
if [[ "${{ inputs.project-directory }}" == "${mod}" ]] && [[ "${{ inputs.go-version }}" == 1.25.* ]]; then
echo "Skipping: ${mod} does not support Go 1.25.x"
SKIP=true
break
fi
done
echo "skip=${SKIP}" >> $GITHUB_OUTPUT

- name: ensure compilation
if: steps.go-compat.outputs.skip != 'true'
working-directory: ./${{ inputs.project-directory }}
run: go build ./...

- name: Install dependencies
if: steps.go-compat.outputs.skip != 'true'
shell: bash
run: |
SCRIPT_PATH="./.github/scripts/${{ inputs.project-directory }}/install-dependencies.sh"
Expand All @@ -107,25 +88,23 @@ jobs:

# Setup Testcontainers Cloud Client right before your Testcontainers tests
- name: Setup Testcontainers Cloud Client
if: ${{ inputs.testcontainers-cloud && steps.go-compat.outputs.skip != 'true' }}
if: ${{ inputs.testcontainers-cloud }}
uses: atomicjar/testcontainers-cloud-setup-action@7d1bab3fdfe0027c91936deca6b924d8a8a7a04d # v1.3
with:
token: ${{ secrets.TCC_TOKEN }}

- name: go test
if: steps.go-compat.outputs.skip != 'true'
working-directory: ./${{ inputs.project-directory }}
timeout-minutes: 30
run: make test-unit

- name: Run checker
if: steps.go-compat.outputs.skip != 'true'
run: |
./scripts/check_environment.sh

# (Optionally) When you don't need Testcontainers Cloud anymore, you could terminate sessions eagerly
- name: Terminate Testcontainers Cloud Client active sessions
if: ${{ inputs.testcontainers-cloud && steps.go-compat.outputs.skip != 'true' }}
if: ${{ inputs.testcontainers-cloud }}
uses: atomicjar/testcontainers-cloud-setup-action@7d1bab3fdfe0027c91936deca6b924d8a8a7a04d # v1.3
with:
action: terminate
Expand All @@ -134,12 +113,12 @@ jobs:
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
with:
paths: "**/${{ inputs.project-directory }}/TEST-unit*.xml"
if: ${{ always() && steps.go-compat.outputs.skip != 'true' }}
if: always()

- name: Decide if Sonar must be run
if: ${{ matrix.platform == 'ubuntu-latest' && steps.go-compat.outputs.skip != 'true' }}
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: |
if [[ "1.25.x" == "${{ inputs.go-version }}" ]] && \
if [[ "1.26.x" == "${{ inputs.go-version }}" ]] && \
[[ "true" != "${{ inputs.rootless-docker }}" ]] && \
[[ "true" != "${{ inputs.testcontainers-cloud }}" ]] && \
[[ "true" != "${{ inputs.ryuk-disabled }}" ]] && \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
# We don't want to fail the build the soonest but identify which modules passed and failed.
fail-fast: false
matrix:
go-version: [1.25.x, 1.26.x]
go-version: [1.26.x, 1.27.x]
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
exclude:
# The Quay MinIO image requires credentials not available in CI.
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
# We don't want to fail the build the soonest but identify which modules passed and failed.
fail-fast: false
matrix:
go-version: [1.25.x, 1.26.x]
go-version: [1.26.x, 1.27.x]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
Expand All @@ -112,7 +112,7 @@ jobs:
name: "Test with reaper off"
strategy:
matrix:
go-version: [1.25.x, 1.26.x]
go-version: [1.26.x, 1.27.x]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
Expand All @@ -133,7 +133,7 @@ jobs:
name: "Test with Rootless Docker"
strategy:
matrix:
go-version: [1.25.x, 1.26.x]
go-version: [1.26.x, 1.27.x]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
Expand Down
10 changes: 5 additions & 5 deletions AI.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ This is a **Go monorepo** containing:
## Environment Setup

### Go Version
- **Required**: Go 1.25.9
- **Required**: Go 1.26.8
- **Tool**: Use [gvm](https://github.com/andrewkroh/gvm) for version management
- **CRITICAL**: Always run this before ANY Go command:
```bash
# For Apple Silicon (M1/M2/M3)
eval "$(gvm 1.25.9 --arch=arm64)"
eval "$(gvm 1.26.8 --arch=arm64)"

# For Intel/AMD (x86_64)
eval "$(gvm 1.25.9 --arch=amd64)"
eval "$(gvm 1.26.8 --arch=amd64)"
```

### Project Structure
Expand Down Expand Up @@ -171,14 +171,14 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
### When Tests Fail
1. **Read the error message carefully** - it usually tells you exactly what's wrong
2. **Check if it's a lint issue** - run `make pre-commit` first
3. **Verify Go version** - ensure using Go 1.25.9
3. **Verify Go version** - ensure using Go 1.26.8
4. **Check Docker** - some tests require Docker daemon running

## Common Pitfalls to Avoid

### Code Issues
- ❌ Using interface types as return values
- ❌ Forgetting to run `eval "$(gvm 1.25.9 --arch=arm64)"`
- ❌ Forgetting to run `eval "$(gvm 1.26.8 --arch=arm64)"`
- ❌ Not handling errors from built-in options
- ❌ Using module-specific container names (`PostgresContainer`)
- ❌ Calling `.Customize()` method instead of direct function call
Expand Down
2 changes: 1 addition & 1 deletion cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func isNil(val any) bool {

valueOf := reflect.ValueOf(val)
switch valueOf.Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
case reflect.Chan, reflect.Func, reflect.Map, reflect.Pointer, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
return valueOf.IsNil()
default:
return false
Expand Down
2 changes: 1 addition & 1 deletion commons-test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define go_install
endef

$(GOBIN)/golangci-lint:
$(call go_install,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.9.0)
$(call go_install,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0)

$(GOBIN)/gotestsum:
$(call go_install,gotest.tools/gotestsum@latest)
Expand Down
2 changes: 1 addition & 1 deletion docker_mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func mapToDockerMounts(containerMounts ContainerMounts) []mount.Mount {
case ImageMounter:
containerMount.ImageOptions = typedMounter.ImageOptions()
case BindMounter:
log.Printf("Mount type %s is not supported by Testcontainers for Go", m.Source.Type())
log.Printf("Mount type %s is not supported by Testcontainers for Go", mountTypeMapping[m.Source.Type()])
default:
// The provided source type has no custom options
}
Expand Down
2 changes: 1 addition & 1 deletion docs/features/docker_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependent upon.
## Using `docker compose` directly

!!!warning
The minimal version of Go required to use this module is **1.21**.
The minimal version of Go required to use this module is **1.26**.

```
go get github.com/testcontainers/testcontainers-go/modules/compose
Expand Down
2 changes: 1 addition & 1 deletion docs/system_requirements/ci/aws_codebuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version: 0.2
phases:
install:
runtime-versions:
golang: 1.25
golang: 1.26
build:
commands:
- go test ./...
Expand Down
2 changes: 1 addition & 1 deletion docs/system_requirements/ci/circle_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ workflows:
- tests:
matrix:
parameters:
go-version: ["1.25.9", "1.26.2"]
go-version: ["1.26.8", "1.27.1"]

```

Expand Down
2 changes: 1 addition & 1 deletion docs/system_requirements/ci/concourse_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
start_docker

cd repo
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" -v /var/run/docker.sock:/var/run/docker.sock golang:1.25 go test ./...
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" -v /var/run/docker.sock:/var/run/docker.sock golang:1.26 go test ./...
```

Finally, you can use Concourse's [fly CLI](https://concourse-ci.org/fly.html) to set the pipeline and trigger the job:
Expand Down
4 changes: 2 additions & 2 deletions docs/system_requirements/ci/dind_patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ tree .
└── platform
└── integration_test.go

$ docker run -it --rm -v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock golang:1.25 go test ./... -v
$ docker run -it --rm -v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock golang:1.26 go test ./... -v
```

Where:
Expand All @@ -45,7 +45,7 @@ The same can be achieved with Docker Compose:

```yaml
tests:
image: golang:1.25
image: golang:1.26
stop_signal: SIGKILL
stdin_open: true
tty: true
Expand Down
2 changes: 1 addition & 1 deletion docs/system_requirements/ci/gitlab_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ variables:
DOCKER_DRIVER: overlay2

test:
image: golang:1.25
image: golang:1.26
stage: test
script: go test ./... -v
```
2 changes: 1 addition & 1 deletion docs/system_requirements/ci/tekton.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
- name: source
steps:
- name: read
image: golang:1.25
image: golang:1.26
workingDir: $(workspaces.source.path)
script: go test ./... -v
volumeMounts:
Expand Down
4 changes: 2 additions & 2 deletions examples/nginx/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/examples/nginx

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/stretchr/testify v1.11.1
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
dario.cat/mergo v1.0.2
Expand Down
2 changes: 1 addition & 1 deletion logconsumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (g *TestLogConsumer) Msgs() []string {
func devNullAcceptorChan() chan string {
c := make(chan string)
go func(c <-chan string) {
for range c { //nolint:revive // do nothing, just pull off channel
for range c {
}
}(c)
return c
Expand Down
4 changes: 2 additions & 2 deletions modulegen/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modulegen

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/spf13/cobra v1.10.2
Expand Down
4 changes: 2 additions & 2 deletions modules/activemq/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modules/activemq

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/stretchr/testify v1.11.1
Expand Down
4 changes: 2 additions & 2 deletions modules/aerospike/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modules/aerospike

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/aerospike/aerospike-client-go/v8 v8.7.0
Expand Down
4 changes: 2 additions & 2 deletions modules/arangodb/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modules/arangodb

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/arangodb/go-driver/v2 v2.3.1
Expand Down
4 changes: 2 additions & 2 deletions modules/artemis/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modules/artemis

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/go-stomp/stomp/v3 v3.1.5
Expand Down
2 changes: 1 addition & 1 deletion modules/azure/azurite/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func defaultOptions() options {
}

// Satisfy the testcontainers.ContainerCustomizer interface
var _ testcontainers.ContainerCustomizer = (Option)(nil)
var _ testcontainers.ContainerCustomizer = Option(nil)

// Option is an option for the Azurite container.
type Option func(*options) error
Expand Down
2 changes: 1 addition & 1 deletion modules/azure/eventhubs/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func defaultOptions() options {
}

// Satisfy the testcontainers.ContainerCustomizer interface
var _ testcontainers.ContainerCustomizer = (Option)(nil)
var _ testcontainers.ContainerCustomizer = Option(nil)

// Option is an option for the EventHubs container.
type Option func(*options) error
Expand Down
4 changes: 2 additions & 2 deletions modules/azure/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/testcontainers/testcontainers-go/modules/azure

go 1.25.7
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0
Expand Down
2 changes: 1 addition & 1 deletion modules/azure/lowkeyvault/testdata/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.25-alpine@sha256:8e02eb337d9e0ea459e041f1ee5eece41cbb61f1d83e7d883a3e2fb4862063fa as builder
FROM golang:1.26-alpine@sha256:8ac98ca534ac3f51e1f420a1dd2c15e74c75cfa0f23f3ad27eb5d7236c349a0c as builder
WORKDIR /app
COPY . .
RUN mkdir -p dist
Expand Down
4 changes: 2 additions & 2 deletions modules/azure/lowkeyvault/testdata/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module lowkeyvault_network_test

go 1.25.0
go 1.26.0

toolchain go1.25.9
toolchain go1.26.8

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0
Expand Down
Loading
Loading