Skip to content
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

cmd/go: unclear error message when applying a 'replace' directive with an absolute path and explicit version #36888

Open
duffiye opened this issue Jan 30, 2020 · 1 comment

Comments

@duffiye
Copy link

@duffiye duffiye commented Jan 30, 2020

What version of Go are you using (go version)?

$ go version
go1.13

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/duffiye/Library/Caches/go-build"
GOENV="/Users/duffiye/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/duffiye/code/golang"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/duffiye/code/erp/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mh/k6gqtvlj1s1fkz6brhkp6j2r0000gn/T/go-build412083276=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go mod edit -replace=github.com/apache/rocketmq-client-go@v0.0.0=/Users/duffiye/code/rocketmq-client-go@latest

malformed module path "/Users/duffiye/code/rocketmq-client-go": empty path element

What did you expect to see?

replace pkg github.com/apache/rocketmq-client-go

What did you see instead?

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Jan 30, 2020

/Users/duffiye/code/rocketmq-client-go@latest is a bit nonsensical: absolute file paths are not versioned, so we do not include such a version in the replace statement.

That said, the diagnostic here could be a lot better. Do you get the same error message using go1.14beta1?

CC @matloob @jayconrod

@bcmills bcmills changed the title go mod replace error:malformed module path "xxx": empty path element cmd/go: unclear error message when applying a 'replace' directive with an absolute path and explicit version Jan 30, 2020
@bcmills bcmills added this to the Backlog milestone Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.