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

go mod download -json has no entry for replaced items, and there is no other way to find them #28810

spekary opened this issue Nov 15, 2018 · 1 comment


Copy link

@spekary spekary commented Nov 15, 2018

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


Does this issue reproduce with the latest release?


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

Mac OS 10.13.6

What did you do?

go mod download -json

What did you expect to see?

Information on location of downloaded files, INCLUDING location of replacements.

What did you see instead?

Information on the location of downloaded files, but replacements are NOT included. There is no entry at all for replaced items.

The Issue

Many Go projects are not just Go source code. For example, a web application has assets - css, JavaScript, images, etc. It also has scripts important to the build process, including files that have go:generate commands. The module system needs to understand that it is not just managing Go code, but everything in a repo that a build has to get to.

In order for a build system to work, and to be reproducible, it needs to know where to find EVERYTHING. go mod download -json helps, but because its not "replace" aware, it fails to completely support a build process. In my particular situation, I am using "replace" to point to local development changes of a variety of tools, some of which do code-generation that then get compiled into other tools. To test local changes, my build system needs to know where these files are located.

In order to fix this, I will need to parse the local go.mod file, or create some kind of parallel system to specify where things are. I shouldn't have to do that.


  1. Have go mod download -json be replace aware. It could output additional entries specific to "replace" statements. Unfortunately, this might break tools relying on the current output format.
  2. Create a new tool, go mod where or go mod download -where that would simply output a module name and the path to the source of that module, including anything gathered from "replace" statements.

This comment has been minimized.

Copy link

@spekary spekary commented Nov 15, 2018

Never mind. I happened upon the answer in the doc. I just didn't expect it to be in go list instead of go mod.

go list -m -json all

@spekary spekary closed this Nov 15, 2018
@golang golang locked and limited conversation to collaborators Nov 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.