On Wednesday, September 28, 2016 at 2:31:44 PM UTC-7, andrey mirtchovski 
wrote:
>
> > If I want to start from the executables in $GOPATH/bin and recompile 
> only 
> > those, is there a way to tell what package an executable comes from so I 
> can 
> > easily automate the process? E.g. goimports is the result of "go install 
> > golang.org/x/tools/cmd/goimports", etc. 
>
> you can do it by listing the target and import path or directory for 
> each package and filter out the executables you're interested in. 'go 
> help list' gives you a lot of options. example: 
>
> go list -f '{{.Dir}}: {{.Target}}' all | grep yourbinaryfile 
>
> or, to see the import path for every binary in your GOPATH/bin: 
>
> go list -f '{{.ImportPath}}: {{.Target}}' all | grep $GOPARH/bin 
>

Thanks for the pointer in the right direction. I can work with that to 
automate it. There are some things to take care of such as same package 
being vendored but that can be solved by picking the shortest Dir. Maybe 
this is a good tool to write in Go.

-- 
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