Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v0.7.1
hooks:
Expand Down
19 changes: 12 additions & 7 deletions run-go-unit-tests.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env bash
FILES=$(go list ./... | grep -v /vendor/)
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
remotebanch="origin/$branch"

go test -tags=unit -timeout 30s -short -v ${FILES}
echo "Checking changes in $remotebanch"
FILES=$(git diff --stat --cached $remotebanch)

returncode=$?
if [ $returncode -ne 0 ]; then
echo "unit tests failed"
exit 1
fi
# loop againts files
for FILE in $FILES
do
case $FILE in
(*.go) # ! == does not match
echo "$FILE"
esac
done
8 changes: 8 additions & 0 deletions test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

import "fmt"

func main() {
// this test
fmt.Println("test")
}