## Summary This issue proposes formally dropping support for Go 1.21.x and stating that `go 1.22.x` is the minimum required version — which is already the case based on the `go.mod` file on the `master` branch. --- ## Current State of `go.mod` (on `master`) ``` module github.com/go-python/gopy go 1.22.0 require ( github.com/gonuts/commander v0.1.0 github.com/gonuts/flag v0.1.0 github.com/pkg/errors v0.9.1 golang.org/x/tools v0.29.0 ) require ( golang.org/x/mod v0.22.0 // indirect golang.org/x/sync v0.10.0 // indirect ) ``` The `go` directive in `go.mod` already declares `go 1.22.0` as the minimum. This means Go 1.21.x users are already technically excluded — Go's toolchain management (introduced in Go 1.21) will attempt to auto-upgrade or refuse to build depending on the user's `GOTOOLCHAIN` setting. --- ## What Would Be Required to Support Go 1.21.x To re-enable Go 1.21.x support, the following changes to `go.mod` would be necessary: 1. **Lower the `go` directive** from `go 1.22.0` to `go 1.21` 2. **Downgrade `golang.org/x/tools`** from `v0.29.0` to `v0.19.0` (the last version compatible with Go 1.21) 3. **Remove `golang.org/x/sync`** as a dependency 4. **Downgrade `golang.org/x/mod`** from `v0.22.0` to `v0.16.0` These are meaningful dependency regressions — particularly `golang.org/x/tools`, which provides core functionality for gopy's code analysis and generation pipeline. --- ## Test Results by Go Version I tested various Go versions locally using code from PR #386, with the same Python `.venv` (pybindgen installed) on Apple Silicon (darwin/arm64): | Go Version | Tests Run | Pass | Fail | Skip | Notes | |------------|-----------|------|------|------|-------| | 1.21.x | 36 | 35 | 0 | 1 | Required temporary `go.mod` downgrade to run at all | | 1.22.x | 36 | 35 | 0 | 1 | Passes fully | | 1.23.x | 36 | 34 | 0 | 2 | `TestBindCgoPackage` skipped (issue #370) | | 1.25.x | 36 | 35 | 0 | 1 | Passes fully | The single consistent skip (`TestPythonConfig` in the `bind` package) is unrelated to Go version. --- ## Should We Maintain Compatibility With Older Go Versions? ### Arguments for 1. **Wider user base**: Some users or organizations pin Go versions for stability (e.g., corporate environments, reproducible builds). Supporting older versions lowers the barrier to adoption. 2. **Ecosystem consistency**: Libraries that support a range of Go versions are easier to integrate into projects that haven't yet migrated to the latest release. ### Arguments against 1. **Already effectively dropped**: The `go 1.22.0` directive in `go.mod` already prevents Go 1.21 users from building without workarounds (`GOTOOLCHAIN=local`, manual `go.mod` edits). The deprecation is a formality. 2. **Dependency cost**: Maintaining Go 1.21 compatibility requires pinning `golang.org/x/tools` at `v0.19.0`. New features, bug fixes, and security patches would be unavailable for a package used heavily by gopy for type analysis and code generation. 3. **Go's own support policy**: The Go team officially supports only the two most recent major releases. Go 1.21 is out of official support. See: https://go.dev/doc/devel/release#policy 4. **Test matrix simplicity**: Fewer supported versions means a simpler CI matrix and fewer version-specific skip conditions in `main_test.go`. ### Recommendation Formally declare Go 1.22.0 as the minimum supported version. This matches the current `go.mod`, requires no code changes, and aligns with Go's own support policy. --- ## Related - Issue #370: `TestBindCgoPackage` fails on Go 1.23 and 1.24 due to a CGO issue - PR https://github.com/go-python/gopy/pull/386 - The `go 1.22.0` directive was already present on `master` before this issue was filed