I want to get a list of tarball URLs (or similar) of all dependencies in a Go project. I tried to achieve this with 'go list dependency' but I see no possibility to get the source URL of a dependency. How can I get the URL?
Asked
Active
Viewed 1,303 times
2
-
If a package can be fetched with `go get`, then the URL can be determined by the import path. – JimB Oct 29 '15 at 13:03
-
2Possible duplicate of [How to list installed go packages](http://stackoverflow.com/questions/28166249/how-to-list-installed-go-packages) – icza Oct 29 '15 at 13:17
1 Answers
6
For the current directory you get the imports by:
go list -f '{{join .Imports "\n"}}' .

0x434D53
- 1,425
- 12
- 20
-
Thank you! But I still don't get how to resolve the source URL from the import path. Take "collectd.org/api" for example. The path is derivated from the source URL but the other way around is what interests me. – SpaceMonkey Oct 29 '15 at 13:28
-
1For external packages it's the source-url. That's how go get downloads the packages – 0x434D53 Oct 29 '15 at 13:30