Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active April 4, 2022 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcolazurdo/a6030d0f6c07e05ad5e6f833cb17fb26 to your computer and use it in GitHub Desktop.
Save pcolazurdo/a6030d0f6c07e05ad5e6f833cb17fb26 to your computer and use it in GitHub Desktop.
Interesting GOLANG resources

Count modules by organizations

go mod graph | cut -d\ -f1 | cut -d\@ -f1 | cut -d/ -f2 | sort | uniq -c | sort -n

Count modules by number of times it is referenced

go mod graph | cut -d\ -f2 | cut -d\@ -f1 | sort | uniq -c | sort -n

Example to process go.mod inside subdirectories (requires fd)

fd go.mod -x bash -c "cd {//} ; go mod graph"

Userful Libraries/modules

  1. OpenAPI toolkit common string formats: github.com/go-openapi/strfmt
  2. Seamless printing to the terminal (stdout) and logging to a io.Writer (file) that’s as easy to use as fmt.Println: https://github.com/spf13/jwalterweatherman
  3. Go package for dealing with maps, slices, JSON and other data: https://github.com/stretchr/objx
  4. Efficient JSON beautifier and compactor for Go: https://github.com/tidwall/pretty
  5. bbolt is a fork of Ben Johnson's Bolt key/value store: https://pkg.go.dev/go.etcd.io/bbolt
  6. Formatters for units to human friendly sizes: github.com/dustin/go-humanize
  7. Package httpsnoop provides an easy way to capture http related metrics (i.e. response time, bytes written, and http status code) from your application's http.Handlers: https://github.com/felixge/httpsnoop
  8. Staticcheck - The advanced Go linter: https://github.com/dominikh/go-tools
  9. Golang security checker: https://github.com/securego/gosec/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment