Hi everyone,


I have a pretty weird error with Go modules that I can't explain - after 
some investigation I feel this might be a bug but I'd like to have some 
extra eyes on it.


I have migrated my tools repository (github.com/campoy/tools) to use Go 
modules and as a test I've tagged two major version v1.0.0 and v2.0.0.


I then wrote a little program the flags package in the tools modules that 
looks like this:


package main
import (
    "flag"
    "fmt"
    "image/color"

    "github.com/campoy/tools/flags"
)
func main() {
    h := flags.HexColor("color", color.Black, "color")
    flag.Parse()

    fmt.Println(h.RGBA())
}


which produced the following go.mod:


module github.com/campoy/tests/mods
go 1.12

require github.com/campoy/tools v1.0.0


Now, when I try to use v2.0.0 I modify the import path of the program to 
use github.com/campoy/tools/v2/flags and the require line to be require 
github.com/campoy/tools/v2 v2.0.0


When I try to build this the compilation fails with the error message:


go: github.com/campoy/tools/v2@v2.0.0: go.mod has non-.../v2 module path 
"github.com/campoy/tools" (and .../v2/go.mod does not exist) at revision v2.0.0
go: error loading module requirements


But if I instead use the tag v2.0.1 which points to the *same* commit as 
v2.0.0 everything works correctly.


Am I doing something wrong or does this seem like a real bug?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9a237138-b31f-479e-8d31-43ec569d64bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to