github.com/mweagle/Sparta@v1.15.0/system/goversion_test.go (about) 1 package system 2 3 import ( 4 "os" 5 "path/filepath" 6 "testing" 7 8 "github.com/sirupsen/logrus" 9 ) 10 11 func TestGoVersion(t *testing.T) { 12 logger := logrus.New() 13 goVersion, goVersionError := GoVersion(logger) 14 if goVersionError != nil { 15 t.Fatalf("Failed to get go version: %s", goVersionError.Error()) 16 } 17 t.Logf("Go version: %s", goVersion) 18 } 19 func TestGoPath(t *testing.T) { 20 goPath := GoPath() 21 // There should be a `go` binary in there 22 goBinPath := filepath.Join(goPath, "bin") 23 _, statErr := os.Stat(goBinPath) 24 if statErr != nil && os.IsNotExist(statErr) { 25 t.Fatalf("Failed to find `GOPATH` at: %s. Error: %s", goBinPath, statErr) 26 } 27 }