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: we're fetching github.com?go-get=1 #26885

Closed
bradfitz opened this issue Aug 9, 2018 · 3 comments
Closed

cmd/go: we're fetching github.com?go-get=1 #26885

bradfitz opened this issue Aug 9, 2018 · 3 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Aug 9, 2018

I just noticed with "go install -v" that we're fetching https://github.com?go-get=1, which seems wrong:

dev:barlogaamp $ GO111MODULE=on go install -v
Fetching https://golang.org/x/crypto/ssh?go-get=1
go: finding github.com/bradfitz/private/sonos latest
Parsing meta tags from https://golang.org/x/crypto/ssh?go-get=1 (status code 200)
get "golang.org/x/crypto/ssh": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ssh?go-get=1
get "golang.org/x/crypto/ssh": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
go: finding github.com/bradfitz/private latest
Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)
go: finding golang.org/x/crypto/ssh latest
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
get "golang.org/x/crypto": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto?go-get=1
go: finding golang.org/x/crypto latest
go: import "github.com/bradfitz/private/barlogaamp" ->
        import "github.com/bradfitz/private/sonos": cannot find module providing package github.com/bradfitz/private/sonos

My program's imports are:

package main

import (
        "context"
        "log"
        "time"

        "golang.org/x/crypto/ssh"
        "github.com/bradfitz/private/sonos"
)

Where github.com/bradfitz/private is a private github repo.

In my ~/.gitconfig I have:

[url "ssh://git@github.com/"]
     insteadOf = https://github.com/

Seems like this only affects modules mode.

@bradfitz bradfitz added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Aug 9, 2018
@bradfitz bradfitz added this to the Go1.11 milestone Aug 9, 2018
@bcmills
Copy link
Contributor

bcmills commented Aug 9, 2018

That probably comes from this loop:

for p := path; p != "."; p = pathpkg.Dir(p) {
// We can't upgrade the main module.
// Note that this loop does consider upgrading other modules on the build list.
// If that's too aggressive we can skip all paths already on the build list,
// not just Target.Path, but for now let's try being aggressive.
if p == Target.Path {
// Can't move to a new version of main module.
continue
}
info, err := Query(p, "latest", Allowed)
if err != nil {
continue
}
m := module.Version{Path: p, Version: info.Version}
root, isLocal, err := fetch(m)
if err != nil {
continue
}
_, ok := dirInModule(path, m.Path, root, isLocal)
if ok {
return module.Version{}, "", &ImportMissingError{ImportPath: path, Module: m}
}
// Special case matching the one above:
// if m.Path matches path, assume adding it to the build list
// will either add the right code or the right code doesn't exist.
if m.Path == path {
return module.Version{}, "", &ImportMissingError{ImportPath: path, Module: m}
}
}

(I'm attempting to factor it out in https://golang.org/cl/128136, but that probably doesn't change the symptom.)

Perhaps we should hard-code some well-known constraints on module paths: for example, paths beginning with github.com must have at least two subsequent path components. That would at least save some lookup latency for modules that can't be fetched (#26874).

Are you able to fetch the private repos otherwise? (That's #26134 in general, I think.)

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 9, 2018
@bradfitz
Copy link
Contributor Author

bradfitz commented Aug 9, 2018

Are you able to fetch the private repos otherwise? (That's #26134 in general, I think.)

No. I'll leave a comment there.

@gopherbot
Copy link

Change https://golang.org/cl/129683 mentions this issue: cmd/go: treat VCS errors as hard errors in module search

@golang golang locked and limited conversation to collaborators Aug 18, 2019
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants