Thanks Roger.

To close this topic, you were right: I'd missed that there is a special
release process for v2 of a module and above, and also go's mod cache was
out-of-sync as I'd been moving tags around. "go mod verify" is your friend.

On Thu, 21 Feb 2019 at 09:05, roger peppe <rogpe...@gmail.com> wrote:

> I suspect it's because it's version 2. Major version v2 and above needs to
> have the version in the import path.
> So the correct import path for your package would be:
>
>    github.com/twpayne/go-xdg/v2
>
> It might be nice if the go tool complained about this at some stage of the
> process; I suspect that's the role of the (currently non-existent) "go
> release" tool.
>
>   cheers,
>     rog.
>
> On Wed, 20 Feb 2019 at 23:54, <twpa...@gmail.com> wrote:
>
>> tl;dr "go mod" writes a timestamp/commit hash to go.mod when a perfectly
>> good tag exists. I don't understand why go.mod doesn't use the tag.
>>
>>
>> Given this library
>>
>>   https://github.com/twpayne/go-xdg
>>
>> with a "v2.0.0" tag:
>>
>>   https://github.com/twpayne/go-xdg/releases/tag/v2.0.0
>>
>> if I create a trivial program that uses it, like
>>
>>   https://gist.github.com/twpayne/09e9135d3f62471ebd7c83359b081e80
>>
>> when I run the go command (e.g. go build), I end up with a go.mod file
>> that contains
>>
>>   require github.com/twpayne/go-xdg v0.0.0-20190214203150-05c8dc503590
>>
>> whereas I would expect go.mod to contain
>>
>>   require github.com/twpayne/go-xdg v2.0.0
>>
>> Even I run the explicit command:
>>
>>   $ go get github.com/twpayne/go-xdg@v2.0.0
>>
>> go.mod still ends up containing the v0.0.0/timestamp/commit hash instead
>> of v2.0.0.
>>
>>
>> Why does go.mod contain v0.0.0/timestamp/commitHash instead of "v2.0.0"?
>>
>>
>> Possibly relevant information:
>> - I initially made a mistake tagging "v2.0.0", so the tag has moved since
>> the go command first saw it. However, I also tried creating a new "v3.0.0"
>> tag, but also saw the v0.0.0/timestamp/commit hash instead of the expected
>> "v3.0.0".
>> - I have GO111MODULE=on.
>>
>> Thanks for any insight :)
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to