2015-08-01 01:58:20 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/mthie/git-gohooks/general"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
files := general.GetChangedGoFiles()
|
2015-08-22 23:52:09 +02:00
|
|
|
if len(files) == 0 {
|
2015-08-01 01:58:20 +02:00
|
|
|
os.Exit(0)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
os.Chdir(general.GetGitRoot())
|
|
|
|
|
2015-08-23 00:11:48 +02:00
|
|
|
result, status := general.RunCommand("go", "test", "-test.short", "./...")
|
2015-08-01 01:58:20 +02:00
|
|
|
if status != 0 {
|
2015-08-23 00:12:56 +02:00
|
|
|
fmt.Fprintf(os.Stderr, "Test failed, please commit only stuff that works.\n%s", result)
|
2015-08-01 01:58:20 +02:00
|
|
|
os.Exit(1)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|