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 November 6, 2024 10:03
pre-commit git hook file for Golang. 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