Skip to content

Instantly share code, notes, and snippets.

@corsc
Created September 14, 2014 04:16
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 corsc/3e767a1f5abe5999619b to your computer and use it in GitHub Desktop.
Save corsc/3e767a1f5abe5999619b to your computer and use it in GitHub Desktop.
Sample Golang cleanup & check script
#!/bin/bash
# ======================
# Download the tools
# ======================
go get code.google.com/p/go.tools/cmd/goimports
go get github.com/golang/lint/golint
# ======================
# Clean the Code
# ======================
echo "\nCleaning the code"
gofmt -w -l ./
# ======================
# Fix the imports
# ======================
echo "\nFixing the imports"
goimports -w -l ./
# ======================
# Check for bugs
# ======================
echo "\nVetting"
go tool vet ./dir1/
go tool vet ./dir2/
# ======================
# Check for lint errors
# ======================
echo "\nChecking for bugs"
golint ./
golint ./dir1/
golint ./dir2/
echo "\nDone"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment