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

cmd/go: Can't `go get github.com/augustoroman/v8` #28435

Closed
bigblind opened this issue Oct 27, 2018 · 12 comments

Comments

Projects
None yet
@bigblind
Copy link

commented Oct 27, 2018

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

$ go version
go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

I think I have the latest release

What operating system and processor architecture are you using (go env)?

macOS 10.13.4

What did you do?

$ go get -v github.com/augustoroman/v8
go: finding github.com/augustoroman/v8 latest
Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)
go get github.com/augustoroman/v8: no matching versions for query "latest"
Executed from a directory outside my $GOPATH containing `go.mod`

What did you expect to see?

I expected the v8 package to be downloaded and installed.

What did you see instead?

The output from the command above.

I originally posted about this in #27215, but was asked to create a separate issue, because this might be a problem where go sees the package name (v8) as a version indicator.

Environment:

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/frederikcreemers/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/frederikcreemers/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/frederikcreemers/dev/marvin/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q_/wgr019b53rx9b2lr3y7867bm0000gn/T/go-build238395171=/tmp/go-build -gno-record-gcc-switches -fno-common"

GO111MODULES is not set.

@bigblind

This comment has been minimized.

Copy link
Author

commented Oct 27, 2018

I've confirmed that the /v8 in the path is the problem. I've created a fork at github.com/bigblind/v-eight, and that works perfectly.

@andybons andybons added this to the Go1.12 milestone Oct 27, 2018

@andybons

This comment has been minimized.

Copy link
Member

commented Oct 27, 2018

@hearot

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2018

I've tried coding a script using the GitHub regex (see https://go.googlesource.com/go/+/go1.11.1/src/cmd/go/internal/get/vcs.go#983).

package main

import "regexp"
import "fmt"

func main() {
    var kregexp *regexp.Regexp
    reg := 
`^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`
    
    kregexp = regexp.MustCompile(reg)
    firstMatch, secondMatch := kregexp.FindStringSubmatch("github.com/hearot/ArgoScuolaNext-Go"), 
kregexp.FindStringSubmatch("github.com/augustoroman/v8")

    firstMatchMap := map[string]string{}
    secondMatchMap := map[string]string{}

    for i, name := range kregexp.SubexpNames() {
        if name != "" && firstMatchMap[name] == "" {
            firstMatchMap[name] = firstMatch[i]
        }
    }

    for i, name := range kregexp.SubexpNames() {
        if name != "" && secondMatchMap[name] == "" {
            secondMatchMap[name] = secondMatch[i]
        }
    }

    fmt.Printf("First match: %s", firstMatchMap)
    fmt.Println()
    fmt.Printf("Second match: %s", secondMatchMap)
}

And I got this:

First match: map[root:github.com/hearot/ArgoScuolaNext-Go]
Second match: map[root:github.com/augustoroman/v8]

That regex works perfectly, there are no errors. So, I've also tried to do the go get -v github.com/augustoroman/v8 command and I've got no errors, everything has been installed successfully.

@agnivade

This comment has been minimized.

Copy link
Member

commented Nov 15, 2018

/cc @myitcv

@myitcv

This comment has been minimized.

Copy link
Member

commented Nov 15, 2018

Last time I saw comment on this, @rsc's thoughts were that such a case is extremely rare, and hence renaming the package is the solution (per @bigblind):

https://go-review.googlesource.com/c/vgo/+/122399/5/vendor/cmd/go/internal/modfetch/coderepo.go#307

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Nov 15, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 20, 2018

Yes, sorry. My suggestion is v8js.

@mattmoor

This comment has been minimized.

Copy link

commented Nov 30, 2018

This is not extremely rare. This will effect like half of the K8s libraries.

@theckman

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

The Kubernetes project uses versions as their package names today, and they have some reaching the point of v2. This suspect this issue could cause major disruptions in the Kubernetes ecosystem if they needed to change how code is structured or named, especially in relation to people trying use it with modules. Based on recent experiences with gofrs/uuid around SIV, I anticipate this will not be a great experience without fully investigating the ramifications of this change in the ecosystem.

Can we please have this issue re-opened, is there anyone from the Kubernetes project who we can loop-in for an official perspective as well?

@bcmills

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

@theckman, @mattmoor, note that the restriction is on module paths that end in /vN, not package paths.

https://godoc.org/?q=k8s.io+v2 doesn't show any packages ending in /v2 at all, but it appears that none of the packages in https://godoc.org/?q=k8s.io+v1 would violate that restriction either.

@thepudds

This comment has been minimized.

Copy link

commented Jan 7, 2019

@theckman , @mattmoor, to slightly expand on that comment from @bcmills (with the intent of trying to explain at least briefly -- "well, what is the difference between a module path vs. a package path?")

For most projects, the module path is the repo (e.g., github.com/my/repo).

For example, if you are creating a module for a repository github.com/my/repo that will contain two packages with import paths github.com/my/repo/foo and github.com/my/repo/bar, then the first line in your go.mod file typically would declare your module path as module github.com/my/repo, and the corresponding on-disk structure could be:

repo/
├── go.mod
├── bar
│   └── bar.go
└── foo
    └── foo.go

More generally, the import paths for all packages in a module share the module path as a common prefix. A module declares its identity in its go.mod via the module directive, where that first line in the go.mod (starting with the word module) provides the declaration of the module path.

@mattmoor

This comment has been minimized.

Copy link

commented Jan 7, 2019

thanks, that is definitely less worrying.

@TheSchemm

This comment has been minimized.

Copy link

commented Apr 24, 2019

One thing I wanted to add for anyone coming across this issue is that I found out that if I go get -d gopkg.in/augustoroman/v8.v1 everything works fine in Go 1.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.