diff --git a/go/detect_environment.go b/go/detect_environment.go index 44947139..8b09b2d4 100644 --- a/go/detect_environment.go +++ b/go/detect_environment.go @@ -62,8 +62,6 @@ func evalutate(expression string) (string, error) { case *variableExpression: s, err := t.Evaluate() if err != nil { - l := log.New(os.Stderr, "", 0) - l.Printf("error evalutating %s: %s", expression, err) return result, err } result = fmt.Sprintf("%s%s", result, s) diff --git a/go/detect_environment_test.go b/go/detect_environment_test.go index 1a3fafc7..f2d733e8 100644 --- a/go/detect_environment_test.go +++ b/go/detect_environment_test.go @@ -29,6 +29,15 @@ func TestDetectCIEnvironment(t *testing.T) { func testDetectCIEnvironment(envVars map[string]string, want *cienvironment.CiEnvironment) func(*testing.T) { return func(t *testing.T) { + // when running on github, unset the variables already present there for this test execution + t.Setenv("GITHUB_SERVER_URL", "") + t.Setenv("GITHUB_REPOSITORY", "") + t.Setenv("GITHUB_RUN_ID", "") + t.Setenv("GITHUB_SHA", "") + t.Setenv("GITHUB_HEAD_REF", "") + t.Setenv("GITHUB_EVENT_NAME", "") + t.Setenv("GITHUB_EVENT_PATH", "") + // set the environment variables per the .txt file in the testdata directory for k, v := range envVars { t.Setenv(k, v) }