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: go get -u fails with local-only replacements #32567

kenichi-fukushima opened this issue Jun 12, 2019 · 11 comments

cmd/go: go get -u fails with local-only replacements #32567

kenichi-fukushima opened this issue Jun 12, 2019 · 11 comments


Copy link

@kenichi-fukushima kenichi-fukushima commented Jun 12, 2019

Please answer these questions before submitting your issue. Thanks!

What did you do?

Run go get -u in a module with replace with a local module.

You can reproduce the problem by checking out this repository and run the command in depending directory.

What did you expect to see?

The command finishes successfully.

What did you see instead?

The command failed with this message.

go get: upgrading unrecognized import path "" (parse no go-import meta tags ())

System details

I got this error with 12.2/12.5 on Linux too.

go version go1.12.6 darwin/amd64
GOROOT/bin/go version: go version go1.12.6 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.6
uname -v: Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.14.3
BuildVersion:	18D109
lldb --version: lldb-1000.0.38.2
@bcmills bcmills changed the title go get -u fails with replace with local modules in go.mod cmd/go: go get -u fails with local-only replacements Jun 13, 2019
Copy link

@bcmills bcmills commented Jun 13, 2019

Coincidentally, @jayconrod and I also noticed that this is broken in the context of

Any fix is probably too invasive for 1.13, but we're planning to overhaul replacements in general for 1.14.

Copy link

@pablote pablote commented Mar 28, 2020

Hi, any fix or workaround for this? Testing this out with go 1.14.1 on darwin. I was usually able to update all dependencies with go get -u ./..., but since we moved to a monorepo and using replace in go.mod files this is now failing, it seems to be trying to fetch the replaced dependencies repo online.

On the other hand, updating specific dependencies go get some-dep@someversion works.

Copy link

@pablote pablote commented Mar 28, 2020

Not the best workaround in the world, but I just found that if replaced dependencies are temporarily removed from go.mod, then go get -u ./... actually updates the rest of the dependencies. It still prints some errors on the console, but it works.

Copy link

@microo8 microo8 commented Jul 17, 2020

All of the private modules I use are just in a fictional

So I tried to add the fictional domain to GOPRIVATE with:
go env -w

and then run go get -u all
But it fails with go get all: unrecognized import path "": reading 404 Not Found

Is it possible, that go get -u all ignores the environment variables? (GOPRIVATE,GONOPROXY,GONOSUMDB)

Copy link

@jayconrod jayconrod commented Jul 17, 2020

@microo8 This issue is specifically related to local replacements. It sounds like you're running into a different problem with private modules so please open a new issue instead.

(go get does not ignore those environment variables. Please make sure that there is a server at that URL resolving module paths to repository URLs or make sure module paths end with .git.)

Copy link

@microo8 microo8 commented Jul 20, 2020

I have the private modules replaced with a local module


go 1.14

require ( v1.7.0 v0.11.3 v2.0.1 v0.0.0-20200107190931-bf48bf16ab8d v0.0.0-00010101000000-000000000000 v0.0.0-00010101000000-000000000000

replace => ../../common/utils

replace => ../models

and that doesn't work. the is just fictional, there isn't a server on the url

go get -u all finds the new versions of the modules and then fails with go get all: unrecognized import path "": reading 404 Not Found an doesn't update go.mod

Copy link

@jayconrod jayconrod commented Jul 20, 2020

@microo8 Thanks for that example. It does seem to be the same issue described here.

The error is reported because the go command is attempting to find a VCS repository for a module path ( The module path is replaced with a local directory, so it's a bug that it's doing that.

Copy link

@microo8 microo8 commented Jul 21, 2020

So I report the bug in a new issue. Thanks

Copy link

@gopherbot gopherbot commented Sep 15, 2020

Change mentions this issue: cmd/go/internal/modload: avoid a network fetch when querying a valid semantic version

gopherbot pushed a commit that referenced this issue Sep 17, 2020
…semantic version

Test this behavior incidentally in a test for ambiguous import errors.
(I rediscovered the error when writing the new test.)

For #32567
Updates #28806

Change-Id: I323f05145734e5cf99818b9f04d65075f7c0f787
Trust: Bryan C. Mills <>
Run-TryBot: Bryan C. Mills <>
TryBot-Result: Go Bot <>
Reviewed-by: Michael Matloob <>
Reviewed-by: Jay Conrod <>
@bcmills bcmills modified the milestones: Backlog, Go1.16 Oct 21, 2020
@bcmills bcmills self-assigned this Oct 21, 2020
Copy link

@bcmills bcmills commented Oct 21, 2020

I believe this is fixed as of

@kenichi-fukushima, please try a go command built from head (either by following the instructions at or using and let us know if it still isn't working for you.

Copy link

@gopherbot gopherbot commented Nov 21, 2020

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Nov 21, 2020
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
7 participants
You can’t perform that action at this time.