How do I install the context package?
$ glide get golang.org/x/net/context
Oops! Cannot detect VCS
Ah I see, I needed to add the parent repo like this:
- package: golang.org/x/net
subpackages:
- context
then it worked.
Maybe it would be a good idea to make this a bit easier, or at least more obvious. It makes sense once I think about it, but I am just used to being able to go get that package so it wasn't obvious why this failed at first.
@saulshanabrook We need to handle sub-packages better. There's another issue open for that. I'd like to get that fixed soon.
Sounds good. Thank you for the wonderful package :)
Is this just a matter of calling NormalizeName() on cmd.Get's name? Or is this a problem with getRepoRootFromPackage()? (That name's a little Java-ish, isn't it?)
There's a bug in getRepoRootFromPackage() (and the name is java-ish isn't it... glad it's an internal function). This should be a quick fix. I'll look into it on Monday or Tuesday.
Sorry, I think I'm the one who came up with that name. I looked at the
NormalizeName function, and I think it is reasonably correct. I'm not sure
what the rules are for vanity domains.
On Saturday, August 22, 2015, Matt Farina [email protected] wrote:
There's a bug in getRepoRootFromPackage() (and the name is java-ish isn't
it... glad it's an internal function).—
Reply to this email directly or view it on GitHub
https://github.com/Masterminds/glide/issues/56#issuecomment-133730029.
I found the problem. It has to do with some of the security inside the github.com/Masterminds/vcs packages. When you try to checkout a repo like golang.org/x/net it uses a funny lookup. That url should be fetched as "https://golang.org/x/net?go-get=1" and it responds with something like:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">
<meta name="go-source" content="golang.org/x/net https://github.com/golang/net/ https://github.com/golang/net/tree/master{/dir} https://github.com/golang/net/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org/x/net">
</head>
<body>
Nothing to see here; <a href="https://godoc.org/golang.org/x/net">move along</a>.
</body>
</html>
The meta tag go-import is the important one here. It provides the name you requested, the vcs type, and the location to actually check it out from.
Now, try this with golang.org/x/net/context and you'll see the issue:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">
<meta name="go-source" content="golang.org/x/net https://github.com/golang/net/ https://github.com/golang/net/tree/master{/dir} https://github.com/golang/net/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org/x/net/context">
</head>
<body>
Nothing to see here; <a href="https://godoc.org/golang.org/x/net/context">move along</a>.
</body>
</html>
The first part of the go-import content doesn't have the /context on the end so the values don't match. Trying to figure out how to best handle the security issue before fixing.
Note, this bug should only appear for anyone using one of the redirects. Sub-packages on github, etc should work ok.
@mattfarina :+1:
Hi, I am using glide v0.11.0, when using glide init with this main.go:
package main
import "golang.org/x/net/context"
func main() {
context.Background()
}
The generated glide.yaml (this will lead to Cannot detect VCS error):
package: .
import:
- package: golang.org/x/net/context
Which results in error getting golang.org/x/net/context:
[INFO] --> Fetching updates for golang.org/x/net/context.
[WARN] Unable to checkout golang.org/x/net/context
[ERROR] Update failed for golang.org/x/net/context: Cannot detect VCS
[ERROR] Failed to do initial checkout of config: Cannot detect VCS
Expected output of glide.yaml:
- package: golang.org/x/net
subpackages:
- context
Most helpful comment
Ah I see, I needed to add the parent repo like this:
then it worked.
Maybe it would be a good idea to make this a bit easier, or at least more obvious. It makes sense once I think about it, but I am just used to being able to
go getthat package so it wasn't obvious why this failed at first.