Today I Learned Go Part 1
This post is mostly my notes from going through a go-tooling-workshop. This set of tutorials I found to be very helpful even though most of it I knew. Its has a good babalnce of explanation and brevity. Here I just wanted to put down some notes on things I had fogotten about or didn't know mostly for my reference.
go get #
go get these are some helpful flags:
go get -d: down the code, but do not compile anything.
go get -u: download the latest version even if its already in you
go get -v: enable verbose mode.
Also, if a url contains more than one package in sub directories of that url, instead of running
go get one-by-one you can install all of them in one command like so:
go get github.com/campoy/go-web-workshop/...
go list #
go list allows you to obtain information about your workspace and the packages stored in it.
NOTE: in order to list all the packages in the standard library you can simply run
go list std.
go list github.com/golang/example/... # remember that ... means "and everything below"
go list #
List and count how many
.go files are under
go list -f '' github.com/golang/example/...
Now to get the count, you only need to pipe the above output to
go list -f '' github.com/golang/example/... | wc -l