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: mod edit -fmt reports latest as invalid version #28439

Open
myitcv opened this issue Oct 27, 2018 · 2 comments
Open

cmd/go: mod edit -fmt reports latest as invalid version #28439

myitcv opened this issue Oct 27, 2018 · 2 comments
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@myitcv
Copy link
Member

myitcv commented Oct 27, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPROXY=""
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/gobin/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build194100036=/tmp/go-build -gno-record-gcc-switches"

What did you do?

export GOPATH=$(mktemp -d)
export PATH=$GOPATH/bin:$PATH
cd $(mktemp -d)
mkdir hello
cd hello
go mod init example.com/hello
go mod edit -require=example.com/goodbye@latest
go mod edit -fmt 

What did you expect to see?

A zero exit code.

What did you see instead?

A non-zero exit code and:

$ go mod edit -fmt
go: errors parsing go.mod:
/tmp/tmp.OkrAZeigOA/hello/go.mod:3: invalid module version "latest": version must be of the form v1.2.3
@myitcv myitcv added this to the Go1.12 milestone Oct 27, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 16, 2018

Duplicate of #27060.

(Resolution per @rsc: “if you want to add a requirement with all the semantic extras, use 'go get'.”)

@bcmills bcmills closed this as completed Nov 16, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 16, 2018

Wait, no. This is the inverse problem: we're validating something we shouldn't be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants