Skip to content

chore: rename test_utils.go to test_utils_test.go#8

Merged
d-bytebase merged 2 commits into
mainfrom
fix-testcontainers-port-api
May 9, 2026
Merged

chore: rename test_utils.go to test_utils_test.go#8
d-bytebase merged 2 commits into
mainfrom
fix-testcontainers-port-api

Conversation

@d-bytebase
Copy link
Copy Markdown

Summary

  • Rename go/logic/test_utils.gogo/logic/test_utils_test.go. The file contains only test helpers (referenced solely from *_test.go files), but its name kept it in the regular package build.

Why

When a downstream consumer imports github.com/github/gh-ost/go/logic together with testcontainers-go v0.42.0+, the build fails:

go/logic/test_utils.go:52:35: port.Int undefined (type "github.com/moby/moby/api/types/network".Port has no field or method Int)

testcontainers-go v0.42.0 changed MappedPort to return github.com/moby/moby/api/types/network.Port, which exposes Num() uint16 instead of the nat.Port.Int() method that existed before. Because test_utils.go is not a _test.go file, it is compiled into the regular package and breaks any consumer that pulls in a newer testcontainers-go via MVS — even though gh-ost2 itself still pins v0.37.0 and only uses these helpers from tests.

Renaming makes the file a test-only translation unit, so it is no longer compiled when the package is imported as a library. gh-ost2's own tests are unaffected (they already share the _test.go build context).

Test plan

  • go build ./... succeeds
  • go vet ./go/logic/... succeeds
  • CI passes

The file contains only test helpers (referenced solely by _test.go
files). Naming it test_utils.go made it part of the regular package
build, which leaks test-only dependencies into production import paths.

This unblocks consumers that import github.com/github/gh-ost/go/logic
together with newer versions of testcontainers-go, whose Port type no
longer exposes Int().
`ifshort` is fully inactivated in golangci-lint v1.61.0 and causes
the runner to exit with code 7. `execinquery` is also archived.
Remove both so the lint job can complete.
@d-bytebase d-bytebase merged commit 4ca6df8 into main May 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants