Skip to content

Instantly share code, notes, and snippets.

View craicoverflow's full-sized avatar
🏠
Working from home

Enda craicoverflow

🏠
Working from home
View GitHub Profile
@craicoverflow
craicoverflow / pre-commit
Last active February 21, 2022 11:03
Pre-commit Git hook for Go code
#!/bin/sh
# Run some pre commit checks on the Go source code. Prevent the commit if any errors are found
echo "Running pre-commit checks on your code..."
FILES=$(go list ./... | grep -v /vendor/)
# Format the Go code
go fmt ${FILES}