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 mod download -json is incomplete #29772

Open
Stebalien opened this issue Jan 16, 2019 · 2 comments
Open

cmd/go: go mod download -json is incomplete #29772

Stebalien opened this issue Jan 16, 2019 · 2 comments
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@Stebalien
Copy link

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

$ go version
go version go1.11.4 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/steb/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/steb/projects/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/run/user/1000/tmp/go-build023848120=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Ran go mod download -json.
  2. Bundled up all files listed in the JSON output (adding /list files as needed).
  3. Tried to replay this bundle, using an HTTP server as a GOPROXY.

What did you expect to see?

go build, go mod download should work without fetching anything.

What did you see instead?

go build and go mod download is getting 404 errors due to files missing from the bundle. It looks like go build is trying to fetch:

  1. Packages mentioned in go.sum files that aren't actually needed for the build (as far as I can tell, at least).
  2. Older (minor) versions of packages mentioned in some dependencies' go.mod files.

I'd expect go mod download -json to return a list of every downloaded package.


Context: I'm trying to integrate go mod with IPFS.

Testing against: https://github.com/anacrolix/torrent/tree/ipgo

@oiooj oiooj added the modules label Jan 17, 2019
@Stebalien
Copy link
Author

It looks like go mod download -json returns all the modules with code needed to build the current package. However, go needs some metadata from all modules mentioned in go mod graph.

Options as I see them:

  1. Allow go build and friends to work when this metadata is unavailable. Given that go doesn't appear to need the code, this should be possible as far as I can tell.
  2. Include required metadata in the output of go mod download -json. That is, return Module structs with the Zip field omitted.
  3. Update the documentation for go mod download -json.

@bcmills bcmills changed the title go mod download -json is incomplete cmd/go: go mod download -json is incomplete Jan 18, 2019
@bcmills
Copy link
Contributor

bcmills commented Jan 22, 2019

go build isn't trying to fetch anything extra based on the contents of go.sum, but it is trying to fetch go.mod files for all of the module versions that appear in the requirements of any module in the module graph.

Probably we should download those go.mod files in go mod download and include them in the -json output.

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 22, 2019
@bcmills bcmills added this to the Go1.13 milestone Jan 22, 2019
@bcmills bcmills added the early-in-cycle A change that should be done early in the 3 month dev cycle. label Jan 22, 2019
@bcmills bcmills self-assigned this Feb 6, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants