diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..9889acba --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,21 @@ +run: + timeout: 5m + +linters: + enable: + - errcheck + - govet + - ineffassign + - staticcheck + - unused + disable: + - depguard + +linters-settings: + errcheck: + check-type-assertions: false + +issues: + exclude-use-default: true + max-issues-per-linter: 50 + max-same-issues: 10 diff --git a/ops/downloads.go b/ops/downloads.go index b4ccd06c..d206a9b9 100644 --- a/ops/downloads.go +++ b/ops/downloads.go @@ -249,8 +249,8 @@ func findRemoteTarballByVersion(version, flavor, OS, arch string, minimal, newes tarball, err = downloads.FindOrGuessTarballByVersionFlavorOS(version, flavor, OS, arch, minimal, newest, guessLatest) if err != nil { - return downloads.TarballDescription{}, fmt.Errorf(fmt.Sprintf("Error getting version %s (%s-%s)[minimal: %v - newest: %v - guess: %v]: %s", - version, flavor, OS, minimal, newest, guessLatest, err)) + return downloads.TarballDescription{}, fmt.Errorf("Error getting version %s (%s-%s)[minimal: %v - newest: %v - guess: %v]: %s", + version, flavor, OS, minimal, newest, guessLatest, err) } return tarball, nil } diff --git a/ts/commands.go b/ts/commands.go index 64fbe2f1..ba2fdb25 100644 --- a/ts/commands.go +++ b/ts/commands.go @@ -60,9 +60,13 @@ func findErrorsInLogFile(ts *testscript.TestScript, neg bool, args []string) { ts.Check(err) hasError := strings.Contains(string(contents), "ERROR") if neg && hasError { - reLines := regexp.MustCompile(`(?sg)(^.*ERROR.*)`) + reLines := regexp.MustCompile(`(?m)(^.*ERROR.*$)`) errorLines := reLines.FindAll(contents, -1) - ts.Fatalf("ERRORs found in %s (%s)\n", logFile, errorLines) + var lines []string + for _, line := range errorLines { + lines = append(lines, string(line)) + } + ts.Fatalf("ERRORs found in %s (%s)\n", logFile, strings.Join(lines, "\n")) } if !neg && !hasError { ts.Fatalf("ERRORs not found in %s\n", logFile)