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: support URL Redirection in "go get" from custom to known import path? #19760

spiritedfang opened this issue Mar 29, 2017 · 3 comments


Copy link

@spiritedfang spiritedfang commented Mar 29, 2017

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

go version go1.8 windows/amd64

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

set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows

What did you do?

Attempted to use a redirected URL in "go get" command, tested using a temporary redirect (301) or permanent redirect (302). "Go get" command fails with an error "did not match import path". The redirected destination in the "go get" command works. Attempted manual commands using git commands:

git init
git remote add origin
echo placeholder>
git add
git commit -m "placeholder"
git push -u origin master

Git worked with redirection (so confirmed it wasn't git).

What did you expect to see?

Redirected URL works. For example: "" redirects to "". I can call "go get" rather than "go get".

What did you see instead?

G:>go get -d -v
Parsing meta tags from (status code 200)
package unrecognized import path "" (parse no go-import meta tags (meta tag did not match import path

Copy link

@bradfitz bradfitz commented Mar 29, 2017

We did follow the redirect, and then fetched which didn't have go-import meta tags.

You want to be able to redirect from a custom import path to a known import path (like github) and then have us recognize that pattern?

That seems too convoluted to be worth both testing and documenting the precedence rules.

If you control, why don't you just serve the expected (and documented) format? (especially at least when Go says "?go-get=1").

@bradfitz bradfitz changed the title URL Redirection in "Go Get" Command cmd/go: support URL Redirection in "go get" from custom to known import path? Mar 29, 2017
Copy link

@spiritedfang spiritedfang commented Mar 29, 2017

Well, it seems that by following the redirect, the go get command does get the meta tags for the known import path. The problem is that it then checks that known path against the custom import path and actively rejects it. It would be nice if that could be ignored by a flag or something. I'm not exactly sure of the purpose of that check to begin with.

Copy link

@spiritedfang spiritedfang commented Mar 30, 2017

Interesting update, if I do "go get", that works.
It creates an odd/undesired directory structure though of "$GOPATH/src/".
Found from here: gitlabhq/gitlabhq#5958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants