Question about "go get", modules and indirect dependencies

319 views
Skip to first unread message

Orson Cart

unread,
Jan 5, 2021, 2:10:05 PM1/5/21
to golang-nuts
Apologies if this is a dumb question as I don't have a great deal of experience with modules.

So, if I use the "go get" command to download a module, when I look in the module cache the @v directory of the requested module contains at least one .info file.
This isn't the case for any indirect dependencies which seem to contain only list, list.lock and .mod files.

There must be a way to have all of the .info files downloaded to the cache because the goland ide does this when it opens a module directlry and the cache is empty. I just don't know what command it's using to achieve it.

So, does anyone know a command which will download all dependencies complete with their .info files?

Thanks

Bryan C. Mills

unread,
Jan 6, 2021, 11:21:25 AM1/6/21
to golang-nuts
`go mod download` should include `.info` files for the requested module(s), or for all dependencies of your module (if you don't give any specific modules as arguments).

That said, .info files are not particularly useful in general, and the `go` command should probably read them less than in does today; see https://golang.org/issue/42723 for details;

Orson Cart

unread,
Jan 6, 2021, 1:26:34 PM1/6/21
to golang-nuts
Thanks for the advice Bryan.

Sadly I tried using go mod download but I'm still seeing the same problem. I'm concerned that it might be something environmental.

The module that's been causing me the issue is  github.com/jung-kurt/gofpdf v1.16.2

I tried again but this time with a different module:
    go mod download go.elastic.co/a...@v1.8.0
This populated the cache with a couple of dozen modules but the only info file that gets downloaded is go/pkg/mod/cache/download/go.elastic.co/apm/@v/v1.16.2.info

Then on a whim I cleaned the cache again and ran "go get" on this new module:
    go: downloading go.elastic.co/apm v1.8.0
    go: downloading go.elastic.co/fastjson v1.0.0
    go: downloading github.com/santhosh-tekuri/jsonschema v1.2.4
    go: downloading github.com/pkg/errors v0.8.1
    go: downloading golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e
    go: downloading github.com/elastic/go-sysinfo v1.1.1
    go: downloading github.com/armon/go-radix v1.0.0
    go: downloading github.com/elastic/go-windows v1.0.0
    go: downloading github.com/prometheus/procfs v0.0.3
    go: downloading github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901
    go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb

This time all but two of the downloaded modules contained .info files.

I don't get it.

One thing that I did note was that when I go back to using "go get" on the original module, it  caches a number of modules into the but it only *reports* one:
    go: downloading github.com/jung-kurt/gofpdf v1.16.2
The only .info file that's downloaded is  go\pkg\mod\cache\download\github.com\jung-kurt\gofpdf\@v\v1.16.2.info
I'm wondering if that's hinting at something?

I'm not interested in the info files per se. It's just that we're using our own module proxy and some of our developers are using GoLand. When GoLand opens a project it seems to run "go list" on all dependencies and reports an http 404 on any .info files that it can't download. Because some of our dependencies don't have .info files, we get the http 404s. 
Aside from that the lack of info files doesn't seem to stop us from using GoLand but all the same I'd rather we fixed the errors.

Bryan C. Mills

unread,
Jan 6, 2021, 1:39:03 PM1/6/21
to Orson Cart, golang-nuts
Yeah, that's exactly https://golang.org/issue/42723. `go list` shouldn't need to read those files.

In the meantime, you could try `go list all` and/or `go mod tidy` after your `go get`..?


--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/JIhjtTkhqvA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/edb36cbc-e814-4712-9582-c0e9633597b9n%40googlegroups.com.

Orson Cart

unread,
Jan 6, 2021, 2:05:30 PM1/6/21
to golang-nuts
Thanks for the suggestions and the issue link. That did the trick:
    go list -m all

Thanks for your help.

Reply all
Reply to author
Forward
0 new messages