Skip to content

Instantly share code, notes, and snippets.

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

Christopher Fenner CCFenner

🏠
Working from home
  • @SAP SE
  • Hamburg, Germany
View GitHub Profile
@radlinskii
radlinskii / pre-commit.sh
Last active August 3, 2024 16:43
pre-commit git hook file for working in Go. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/sh
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports