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 does not resolve latest version of a module for an unknown import #24130

Closed
piersy opened this issue Feb 26, 2018 · 4 comments
Closed
Milestone

Comments

@piersy
Copy link

piersy commented Feb 26, 2018

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

go version go1.10 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/piers/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/piers/projects/testvgo/gopath"
GORACE=""
GOROOT="/home/piers/programs/go1.10"
GOTMPDIR=""
GOTOOLDIR="/home/piers/programs/go1.10/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-build762707113=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Created the following go file /home/piers/projects/testvgo/main.go
package main // import "github.com/piersy/testvgo"

import jwt "github.com/dgrijalva/jwt-go"

func main() {
	println(jwt.MapClaims{})
}

  1. Created an empty go.mod > /home/piers/projects/testvgo/go.mod
  2. Ran vgo build from inside /home/piers/projects/testvgo

What did you expect to see?

vgo: resolving import "github.com/dgrijalva/jwt-go"
vgo: finding github.com/dgrijalva/jwt-go (latest)
vgo: adding github.com/dgrijalva/jwt-go v3.1.0
vgo: finding github.com/dgrijalva/jwt-go v3.1.0
vgo: downloading github.com/dgrijalva/jwt-go v3.1.0

What did you see instead?

vgo: resolving import "github.com/dgrijalva/jwt-go"
vgo: finding github.com/dgrijalva/jwt-go (latest)
vgo: adding github.com/dgrijalva/jwt-go v1.0.2
vgo: finding github.com/dgrijalva/jwt-go v1.0.2
vgo: downloading github.com/dgrijalva/jwt-go v1.0.2
# github.com/piersy/testvgo
./main.go:6:10: undefined: jwt.MapClaims

vgo is not resolving the latest version v3.1.0 of the jwt-go package. It seems like it is only resolving the latest v1.x.x version.

@gopherbot gopherbot added this to the vgo milestone Feb 26, 2018
@fhs
Copy link
Contributor

fhs commented Feb 26, 2018

This works as intended. You need to import github.com/dgrijalva/jwt-go/v3 instead of github.com/dgrijalva/jwt-go and also jwt-go needs a go.mod file. See https://research.swtch.com/vgo-module

@piersy
Copy link
Author

piersy commented Feb 28, 2018

Short of submitting a patch on github.com/dgrijalva/jwt-go is there any other way I can depend on the v3.1.0 tag?

@kardianos
Copy link
Contributor

Yes. In your go.mod, us the v0-yyyymmdd-rev syntax I believe.

@piersy
Copy link
Author

piersy commented Mar 1, 2018

@kardianos thanks, that works :)

@piersy piersy closed this as completed Mar 1, 2018
@golang golang locked and limited conversation to collaborators Mar 1, 2019
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

4 participants