Skip to content

Commit

Permalink
Fix cuddled statements warned by golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
johnboyes authored Feb 8, 2024
1 parent af897d2 commit 383eed3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/github/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (a *Action) handleFailure() int {
a.outputResult("failure")
err := errors.New(a.trimTrailingNewLine(a.failMsg))
fmt.Fprintln(a.Stderr, "::error::", err)

if a.allowFailure() {
return 0
}
Expand All @@ -82,11 +83,14 @@ func (a *Action) runCheck(chk check, specified []string, prefixMode bool) {
if len(specified) == 0 {
return
}

if prefixMode && len(specified) > 1 {
a.failMsg += "Currently the label checker only supports checking with one prefix, not multiple."
return
}

valid, message := chk(specified, prefixMode)

if valid {
a.successMsg += message + "\n"
} else {
Expand Down Expand Up @@ -123,6 +127,7 @@ func (a *Action) outputResult(result string) {
githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, 0644)

Check failure on line 127 in internal/github/action.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] internal/github/action.go#L127

G302: Expect file permissions to be 0600 or less (gosec)
Raw output
internal/github/action.go:127:27: G302: Expect file permissions to be 0600 or less (gosec)
	githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, 0644)
	                         ^
panic.IfError(err)
_, err = githubOutputFile.WriteString(labelCheckOutput)

if err != nil {
githubOutputFile.Close()

Check failure on line 132 in internal/github/action.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] internal/github/action.go#L132

Error return value of `githubOutputFile.Close` is not checked (errcheck)
Raw output
internal/github/action.go:132:25: Error return value of `githubOutputFile.Close` is not checked (errcheck)
		githubOutputFile.Close()
		                      ^
panic.IfError(err)
Expand Down

0 comments on commit 383eed3

Please sign in to comment.