Skip to content

go.mod:184: can't query version "patch" of module xxx: no existing version is required #65901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Abirdcfly opened this issue Feb 23, 2024 · 1 comment

Comments

@Abirdcfly
Copy link
Contributor

Abirdcfly commented Feb 23, 2024

Go version

go version go1.22.0 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN='/usr/local/opt/go/libexec/bin'
GOCACHE='/Users/fupeng/Library/Caches/go-build'
GOENV='/Users/fupeng/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/fupeng/go/pkg/mod'
GONOPROXY='*tenxcloud.com'
GONOSUMDB='*tenxcloud.com'
GOOS='darwin'
GOPATH='/Users/fupeng/go'
GOPRIVATE='*tenxcloud.com'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/opt/go/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/opt/go/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/fupeng/go/src/arcadia/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/3v/mkwyck4x0f5bxv2gdv4_l8v00000gn/T/go-build2791314162=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

in go.mod https://github.com/kubeagi/arcadia/blob/0705fb8214ffa5dbaa4200902728ed2d58947f5f/go.mod#L184

want change replace github.com/tmc/langchaingo => github.com/Abirdcfly/langchaingo v0.0.0-20240124015404-c7798664fdb1 to replace github.com/tmc/langchaingo => github.com/Abirdcfly/langchaingo patch, then exec go mod tidy,

but the go mod tidy say

go: errors parsing go.mod:
go.mod:184: can't query version "patch" of module github.com/Abirdcfly/langchaingo: no existing version is required

but if change to replace github.com/tmc/langchaingo => github.com/Abirdcfly/langchaingo abcd, then exec go mod tidy, it is ok.

So the point is that we can't use the patch keyword, even if there is a branch upstream named patch(https://github.com/Abirdcfly/langchaingo/tree/patch)

What did you see happen?

replace github.com/tmc/langchaingo => github.com/Abirdcfly/langchaingo patch then go mod tidy:

go: errors parsing go.mod:
go.mod:184: can't query version "patch" of module github.com/Abirdcfly/langchaingo: no existing version is required

What did you expect to see?

no error

maybe related to #49111 ?

@seankhliao
Copy link
Member

See https://go.dev/ref/mod#version-queries

  • A revision identifier for the underlying source repository, such as a commit hash prefix, revision tag, or branch name. If the revision is tagged with a semantic version, this query selects that version. Otherwise, this query selects a pseudo-version for the underlying commit. Note that branches and tags with names matched by other version queries cannot be selected this way.
  • ...
  • The string patch, which selects the latest available version with the same major and minor version numbers as the currently required version.

Closing as working as intended/documented.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2024
@golang golang locked and limited conversation to collaborators Feb 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants