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: installing a module with /v1 at the end corrupts go.mod #26375

Closed
trashhalo opened this Issue Jul 13, 2018 · 10 comments

Comments

Projects
None yet
6 participants
@trashhalo
Copy link

trashhalo commented Jul 13, 2018

Please answer these questions before submitting your issue. Thanks!

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

➜ microservice-boilerplate-go git:(master) ✗ vgo version
go version go1.10.3 darwin/amd64 go:2018-02-20.1

Does this issue reproduce with the latest release?

I think this is the latest release of vgo so yes.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/stephen/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/stephen/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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/xs/bs09x7hj2jqb6hq3frfzrmkh0000gp/T/go-build447972079=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

➜  microservice-boilerplate-go git:(master) ✗ vgo install
resolving import "github.com/PotomacInnovation/libraries-go/logger/v1"
go: finding github.com/PotomacInnovation/libraries-go/logger/v1 v1.0.15
go: finding github.com/PotomacInnovation/libraries-go/logger/v1 (latest)
go: adding github.com/PotomacInnovation/libraries-go/logger/v1 v1.0.15
go: downloading github.com/PotomacInnovation/libraries-go/logger/v1 v1.0.15
➜  microservice-boilerplate-go git:(master) ✗ vgo install
go: errors parsing go.mod:
/Users/stephen/dev/microservice-boilerplate-go/go.mod:4: invalid module version "v1.0.15": malformed module path: github.com/PotomacInnovation/libraries-go/logger/v1
➜  microservice-boilerplate-go git:(master) ✗ head go.mod
module github.com/PotomacInnovation/microservice-boilerplate-go

require (
	github.com/PotomacInnovation/libraries-go/logger/v1 v1.0.15
	github.com/aws/aws-sdk-go v1.14.26
	github.com/aws/aws-xray-sdk-go v0.9.4
	github.com/cihub/seelog v0.0.0-20151216151435-d2c6e5aa9fbf
	github.com/fsnotify/fsnotify v1.4.7

What did you expect to see?

vgo install would parse the go.mod file it generated

What did you see instead?

vgo refuses to use the go.mod file. looking at it it appears to be valid

@gopherbot gopherbot added this to the vgo milestone Jul 13, 2018

@trashhalo

This comment has been minimized.

Copy link
Author

trashhalo commented Jul 13, 2018

@zeebo in slack suggested it might be the v1. So i removed that and republished the logger and now it works.

➜  microservice-boilerplate-go git:(master) ✗ vgo install
go: finding github.com/PotomacInnovation/libraries-go/logger v1.0.17
go: downloading github.com/PotomacInnovation/libraries-go/logger v1.0.17
➜  microservice-boilerplate-go git:(master) ✗ vgo install
➜  microservice-boilerplate-go git:(master) ✗

It seems like a very strange that it bombed in that point. the logger go.mod was fine with the v1. vgo was fine downloading the v1. but once it got into the downstream go.mod it broke with a cryptic message.

@oiooj oiooj modified the milestones: vgo, mo de, Go1.11 Jul 13, 2018

@oiooj oiooj added the modules label Jul 13, 2018

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jul 13, 2018

I'm assuming from the ✗ in your prompt that the vgo install commands returned a non-zero exit code?

If so, did it emit any other error messages? The lack of error message alone seems like a problem.

@trashhalo

This comment has been minimized.

Copy link
Author

trashhalo commented Jul 13, 2018

@bcmills the error that came back before I figured out the issue was.
/Users/stephen/dev/microservice-boilerplate-go/go.mod:4: invalid module version "v1.0.15": malformed module path: github.com/PotomacInnovation/libraries-go/logger/v1

@oiooj

This comment has been minimized.

Copy link
Member

oiooj commented Jul 14, 2018

The version is either empty or "/vN" for N >= 2.

@oiooj oiooj changed the title x/vgo: vgo install corrupts go.mod cmd/go: go install corrupts go.mod Jul 14, 2018

@myitcv

This comment has been minimized.

Copy link
Member

myitcv commented Jul 14, 2018

@trashhalo I think, per your messages on Slack, this is now resolved?

@trashhalo

This comment has been minimized.

Copy link
Author

trashhalo commented Jul 15, 2018

@myitcv yes the original issue is worked out. I would like to either open a new issue or repurpose this issue to cover the fact that it's failing in a uninitiutive way

  • Vgo let's you create a module with v1 at the end
  • Vgo let's you get a module with v1 at the end updating your go.mod.
  • From that point forward it refuses to interact with your go.mod.

Ideally the upstream module would have rejected the go.mod with the v1

@trashhalo trashhalo changed the title cmd/go: go install corrupts go.mod cmd/go: installing a module with /v1 at the end corrupts go.mod Jul 16, 2018

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jul 16, 2018

Agreed: the go install (and go build) should never transition from a valid go.mod to an invalid one.

(The only go subcommand that should be able to corrupt the go.mod file is go mod, and then only with the explicitly-unverified flags like -require, -replace, and -exclude.)

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Aug 17, 2018

Leaving for Go 1.12.

@rsc rsc modified the milestones: Go1.11, Go1.12 Aug 17, 2018

@bcmills bcmills self-assigned this Nov 15, 2018

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Dec 12, 2018

Vgo let's you get a module with v1 at the end updating your go.mod.

I'm not able to reproduce this using the go command at head. I'm guessing it got fixed at some point.

I'll add a regression test, but please let us know if you can still reproduce it somehow.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 12, 2018

Change https://golang.org/cl/153823 mentions this issue: cmd/go: test 'go get' and 'go install' with an (invalid) module ending in /v1

@gopherbot gopherbot closed this in 9c623f7 Dec 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.