Skip to content

import/path: why go mod tidy while update my local go version #75987

@xx1906

Description

@xx1906

Go version

go version go1.22.12 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/xx/.cache/go-build'
GOENV='/home/xx/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/xx/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/xx/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/home/xx/.g/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/xx/.g/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.12'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/xx/workspace/go-repos/gx/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2104325210=/tmp/go-build -gno-record-gcc-switches'

What did you do?

my main code

`package main

import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)

func main() {
var engine = gin.Default()
engine.GET("/", func(ctx *gin.Context) {
ctx.String(200, "hello gin")
})
logrus.SetReportCaller(true)
logrus.SetLevel(logrus.DebugLevel)
logrus.Info("hello logrus")
engine.Run(":8081")
}
`

my go.mod

`module gx

go 1.22

`

before exec go mod tidy

go version go version go1.22.12 linux/amd64

exec go mod tidy

(base) ➜ gx go mod tidy go: finding module for package github.com/sirupsen/logrus go: finding module for package github.com/gin-gonic/gin go: downloading github.com/gin-gonic/gin v1.11.0 go: downloading github.com/sirupsen/logrus v1.9.3 go: toolchain upgrade needed to resolve github.com/gin-gonic/gin go: github.com/gin-gonic/gin@v1.11.0 requires go >= 1.23.0; switching to go1.24.9 go: finding module for package github.com/sirupsen/logrus go: finding module for package github.com/gin-gonic/gin go: found github.com/gin-gonic/gin in github.com/gin-gonic/gin v1.11.0 go: found github.com/sirupsen/logrus in github.com/sirupsen/logrus v1.9.3 go: downloading golang.org/x/sys v0.35.0 go: downloading github.com/stretchr/testify v1.11.1 go: downloading github.com/gin-contrib/sse v1.1.0 go: downloading github.com/mattn/go-isatty v0.0.20 go: downloading github.com/quic-go/quic-go v0.54.0 go: downloading golang.org/x/net v0.42.0 go: downloading google.golang.org/protobuf v1.36.9 go: downloading github.com/go-playground/validator/v10 v10.27.0 go: downloading github.com/goccy/go-yaml v1.18.0 go: downloading github.com/pelletier/go-toml/v2 v2.2.4 go: downloading github.com/ugorji/go/codec v1.3.0 go: downloading github.com/json-iterator/go v1.1.12 go: downloading github.com/modern-go/reflect2 v1.0.2 go: downloading github.com/bytedance/sonic v1.14.0 go: downloading github.com/goccy/go-json v0.10.2 go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/pmezard/go-difflib v1.0.0 go: downloading gopkg.in/yaml.v3 v3.0.1 go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 go: downloading golang.org/x/text v0.27.0 go: downloading github.com/gabriel-vasile/mimetype v1.4.8 go: downloading github.com/leodido/go-urn v1.4.0 go: downloading github.com/go-playground/universal-translator v0.18.1 go: downloading golang.org/x/crypto v0.40.0 go: downloading github.com/go-playground/locales v0.14.1 protocol error: received DATA after END_STREAM go: downloading github.com/quic-go/qpack v0.5.1 go: downloading go.uber.org/mock v0.5.0 go: downloading golang.org/x/tools v0.34.0 go: downloading golang.org/x/mod v0.25.0 go: downloading golang.org/x/arch v0.20.0 go: downloading github.com/twitchyliquid64/golang-asm v0.15.1 go: downloading github.com/klauspost/cpuid/v2 v2.3.0 go: downloading github.com/bytedance/sonic/loader v0.3.0 go: downloading github.com/cloudwego/base64x v0.1.6 go: downloading golang.org/x/sync v0.16.0 go: downloading github.com/go-playground/assert/v2 v2.2.0 go: downloading github.com/google/go-cmp v0.7.0

and then exec go version
(base) ➜ gx go version go version go1.24.9 linux/amd64

What did you see happen?

my local go version from 1.22.12 update to 1.24.9

What did you expect to see?

i expected my local version keep 1.22.12 and go mod tidy download the right version of module which deps go version not more than 1.22.12.

TKX bro

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionIssues that are questions about using Go.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions