-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
There doesn't seem to be a way to stop the toolchain
directive from being updated when running various go
commands
In our OSS project we rely on the go
directive in the go.mod to ensure a min go version. We do not want to use the toolchain
directive as we always expect it to match the go
directive.
some user feedback
- https://gophers.slack.com/archives/C0VPK4Z5E/p1704471476388119
- https://gophers.slack.com/archives/C9BMAAFFB/p1708525315637839
Go Version
go version go1.22.0 darwin/amd64
Go ENV
expand
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/dprotasowski/Library/Caches/go-build'
GOENV='/Users/dprotasowski/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/dprotasowski/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/dprotasowski/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.22.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.22.0/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/dprotasowski/work/test/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/xs/xfp1z4cn643c46w69lv8bv8w0000gp/T/go-build4163821748=/tmp/go-build -gno-record-gcc-switches -fno-common'
Scenario 1 - creating a new module and downgrading go
What did you do
$ mkdir test && cd test
$ go mod init blah
$ go get [email protected]
What did you see happen?
- Tool chain directive of 1.22.0 was added - but this isn't necessary
- min go version set to 1.21.7
What did you expect to happen?
- No
toolchain
directive to be added - Min go version set to
1.21
- since I didn't specify the point release
Scenario 2 - pulling a new dependency that upgraded the go version
What did you do
Project structure
--- go.mod
module blah
go 1.19
---- main.go
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}
Fetch a dependency that updates the go min version
$ go get knative.dev/pkg@9f033a7
What did you see happen?
console output
go: upgraded go 1.19 => 1.21
go: added toolchain go1.22.0
go: added knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7
go.mod output
module blah
go 1.21
toolchain go1.22.0
require knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7 // indirect
What did you expect to happen?
toolchain
directive shouldn't appear. We want it to always default to the same as the go
directive
thediveo, jdemeyer, pavelpatrin, Jille, SuperSandro2000 and 74 moresilverwind
Metadata
Metadata
Assignees
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.