Go module - go get not able to install major version

Hi,

I am using go1.16
i updated my utility module to v2.0.0 and updated the go.mod in for this module import path to github/xxxxxx/module/v2

in the executable module iam trying to import the latest major version using go get as below and hits below error.
vinu@vinu-HP-Spectre-x360-Convertible-13-ae0xx:~/main$ go get github.com/vinu2003/cmdparser/v2
go get: module github.com/vinu2003/cmdparser@upgrade found (v1.1.0), but does not contain package github.com/vinu2003/cmdparser/v2

Note: this is private repo so i set GOPRIVATE to VCS path.
any suggestion is much appreciated.

===> Modules · golang/go Wiki · GitHub

It’s hard to say what is going on here since your repo is private, so I’m shooting in the dark here. Did you try following this excellent guide? Do you have a v2 go.mod file? Did you git tag v2.0.0? I could be wrong but it looks like you might have a v1.1.0 tag but not a v2.

1 Like

Hi Dean thank u for helping.

Yes i did have my go.mod of the utility package ie cmdparser having module path v2 appended and also the tags were pushed.
vinu@vinu-HP-Spectre-x360-Convertible-13-ae0xx:~/cmdparser$ git tag -l
v1.0.0
v1.0.1
v1.1.0
v2.0.0

The only thing that fixed the issue is - creating directory as its mentioned in the doc u sent.
I initially used v2 branch and pushed v2.0.0 tag and tried to install using go get github.com/xxxx/cmdparser/v2 for executable module to pick up the latest version.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.