Daniel, fwiw I couldn't get govendor list to work in my environment.

Sam, thanks a lot of that snippet.  I also had some trouble running that,
but I was able to reverse engineer the important parts out to generate a
one-liner that worked for me.

go list -f '{{ range .Imports }}{{printf "\t%q -> %q;\n" $.ImportPath
.}}{{end}}' $(go list -f '{{join .Deps " "}}' YOURPACKAGE) YOURPACKAGE

When I tried the script as is (found a similar script here
<https://github.com/NeoHuang/scripts/blob/master/getGoDepends.sh>), it
errors out with

template: main:1: unexpected "\\" in operand

If you know a quick resolution to that, I'd love to get it working with
digraph and graphviz, as well.


On Fri, Sep 2, 2016 at 2:51 PM, Sam Whited <s...@samwhited.com> wrote:

> On Fri, Sep 2, 2016 at 1:20 PM, Davis Ford <davisf...@gmail.com> wrote:
> > Does anyone know of a tool that can analyze dependencies and print a
> graph,
> > specifically as it relates to golang vendor'd libraries.  I'm using 1.7
> and
> > most tools don't seem to be able to produce results on a project that is
> > using vendor'd dependencies.
>
> Something like the following chunk of Bash would work (you could tweak
> the Go list  invocation to just do vendored deps probably) if you have
> graphviz installed (I can't remember where I got this, appologies if
> I'm cribbing a script out of someones presentation without proper
> attribution):
>
>     % ( echo "digraph G {"; \
>     %   go list -f '{{range .Imports}}{{printf "\t%q -> %q;\n" \
>     %     $.ImportPath .}}{{end}}' \
>     %     $(go list -f '{{join .Deps " "}}' YOURPACKAGE) YOURPACKAGE;
> \
>     %   echo "}";
>     % ) | dot -Tsvg -o $@
>
> —Sam
>
>
> --
> Sam Whited
> pub 4096R/54083AE104EA7AD3
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to