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

x/vgo: vgo refuses to get the latest version of a package #25527

Closed
schollz opened this issue May 23, 2018 · 8 comments

Comments

@schollz
Copy link

commented May 23, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.2 linux/amd64 vgo:2018-02-20.1

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/zns/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/zns/work"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build522551275=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm trying to move from dep to vgo in one of my programs, croc. I currently have a build that works, however if I do vgo get -u which will upgrade all modules needed by the build, it actually downgrades progressbar from v2.1.0 to v1.0.0 and causes my build to fail.

You can try this yourself to see what I mean. You can reproduce my problem with the following:

$ go get github.com/schollz/croc
$ cd $GOPATH/src/github.com/schollz/croc
$ git checkout vgo
Branch 'vgo' set up to track remote branch 'vgo' from 'origin'.
Switched to a new branch 'vgo'
$ vgo build -v              # this build should work
$ git diff HEAD | grep progressbar       # it changes the go.mod to use the latest hash
-	github.com/schollz/progressbar v2.1.0
+	github.com/schollz/progressbar v0.0.0-20180523063429-ddf577279716
$ vgo get -u          # now update and build again
$ git diff HEAD | grep progressbar        # it reverts to v1.0.0
-	github.com/schollz/progressbar v2.1.0
+	github.com/schollz/progressbar v1.0.0
$ vgo build -v                 # now it fails because it downgraded progressbar
./connect.go:291:11: undefined: progressbar.NewOptions
./connect.go:291:47: undefined: progressbar.OptionSetWriter
./connect.go:477:16: undefined: progressbar.NewOptions
./connect.go:477:52: undefined: progressbar.OptionSetWriter

I've also tried modifying the go.mod to include the hash version of the newest progressbar, but it still reverts to v1.0.0. I've also tried upgrading by vgo get github.com/schollz/progressbar with the same result.

When I use vgo list -m -u it doesn't show that there is a new version of progressbar available:

$ vgo list -m -u | grep progressbar
github.com/schollz/progressbar      v1.0.0 (2018-04-22 05:46) 

Edit: I just realized I need to update the package in the imports, but when I do that I still have a problem:

$ vgo build -v
vgo: resolving import "github.com/schollz/progressbar/v2"
vgo: finding github.com/schollz/progressbar (latest)
vgo: adding github.com/schollz/progressbar v1.0.0
vgo: import "github.com/schollz/croc" ->
	import "github.com/schollz/progressbar/v2" [/home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2]: open /home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2: no such file or directory

What did you expect to see?

I tried four ways to get croc to use v2.1.0 of github.com/schollz/progressbar: I manually edited go.mod to include v2.1.0, I used vgo get -u and I used vgo get github.com/schollz/progressbar and I edited the import to include github.com/schollz/progressbar/v2. In each case, I expected the go.mod will update to use v2.1.0.

What did you see instead?

In every way I tried, I would instead see that the go.mod would include the progressbar version v1.0.0 and not the latest, which I tried to update to, v2.1.0.

@gopherbot gopherbot added this to the vgo milestone May 23, 2018

@AlexRouSg

This comment has been minimized.

Copy link
Contributor

commented May 23, 2018

progressbar has a bad go.mod file module github.com/schollz/progressbar for v >= 2

It needs to update it's go.mod file for all v >= 2 tags to say module github.com/schollz/progressbar/v2

@schollz

This comment has been minimized.

Copy link
Author

commented May 23, 2018

@AlexRouSg thanks. I didn't realize that so I made that change schollz/progressbar@85ec7a0.

However after doing that I still can't seem to get a build with v2:

$ vgo build -v
vgo: resolving import "github.com/schollz/progressbar/v2"
vgo: finding github.com/schollz/progressbar (latest)
vgo: adding github.com/schollz/progressbar v1.0.0
vgo: import "github.com/schollz/croc" ->
	import "github.com/schollz/progressbar/v2" [/home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2]: open /home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2: no such file or directory
@AlexRouSg

This comment has been minimized.

Copy link
Contributor

commented May 23, 2018

You have not tagged a v2 release that uses the new go.mod file

@schollz

This comment has been minimized.

Copy link
Author

commented May 23, 2018

@AlexRouSg Tagged here: https://github.com/schollz/progressbar/releases/tag/v2.1.1

Still errored:

$ vgo build -v                          
vgo: resolving import "github.com/schollz/progressbar/v2"
vgo: finding github.com/schollz/progressbar (latest)
vgo: adding github.com/schollz/progressbar v1.0.0
vgo: import "github.com/schollz/croc" ->
	import "github.com/schollz/progressbar/v2" [/home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2]: open /home/zns/work/src/v/github.com/schollz/progressbar@v1.0.0/v2: no such file or directory
@AlexRouSg

This comment has been minimized.

Copy link
Contributor

commented May 23, 2018

Ok so auto generating the go.mod file for v2 seems broken

But if you manually create it with require github.com/schollz/progressbar/v2 v2.1.1 you would hit #25494

@kyroy

This comment has been minimized.

Copy link
Contributor

commented May 24, 2018

I think this is related to the bug where vgo fails to read go.mod files where the module is not quoted. https://go-review.googlesource.com/c/vgo/+/114058

Try using

module "github.com/schollz/progressbar/v2"
@AlexRouSg

This comment has been minimized.

Copy link
Contributor

commented May 24, 2018

@kyroy @schollz
As of the current vgo version this is now fixed, I can build packages importing "github.com/schollz/progressbar/v2"

I believe part of the issue was #25545 where vgo was not initializing correctly when there is a blank go.mod file with a module declaration.

@schollz

This comment has been minimized.

Copy link
Author

commented May 25, 2018

@AlexRouSg

Thanks. It is working now with the newest version of vgo.

@schollz schollz closed this May 25, 2018

@golang golang locked and limited conversation to collaborators May 25, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.