Skip to content

Commit

Permalink
Fix Go linting (#451)
Browse files Browse the repository at this point in the history
* Remove deactivated Go linters to fix build

* Fix Go linting by ignoring fmt.Fprintln errors

The reported fmt.Fprintln errors were causing the build to fail.
[It is standard practice not to check for these errors][1], so it is
fine to ignore them.

[1]: https://stackoverflow.com/a/77629756/23999321

* Update name of linter as old name is deprecated
  • Loading branch information
johnboyes authored Jun 2, 2024
1 parent ebffb81 commit 2b7ae42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,22 @@ linters:
- revive
- goprintffuncname
- godox
- gomnd
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- mnd
- prealloc
- nakedret
- rowserrcheck
- exportloopref
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- wsl
6 changes: 3 additions & 3 deletions internal/github/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Action struct {
func (a *Action) CheckLabels(stdout, stderr io.Writer) int {
a.Stdout = stdout
a.Stderr = stderr
fmt.Fprintln(a.Stdout, "Checking GitHub labels ...")
fmt.Fprintln(a.Stdout, "Checking GitHub labels ...") //nolint:errcheck

pr := pullrequest.New(
a.repositoryOwner(),
Expand All @@ -46,7 +46,7 @@ func (a *Action) CheckLabels(stdout, stderr io.Writer) int {
a.runCheck(pr.Labels.HasAnyOf, a.anyRequired(), a.prefixMode())

if len(a.successMsg) > 0 {
fmt.Fprintln(a.Stdout, a.trimTrailingNewLine(a.successMsg))
fmt.Fprintln(a.Stdout, a.trimTrailingNewLine(a.successMsg)) //nolint:errcheck
}

if len(a.failMsg) > 0 {
Expand All @@ -63,7 +63,7 @@ func (a *Action) CheckLabels(stdout, stderr io.Writer) int {
func (a *Action) handleFailure() int {
a.outputResult("failure")
err := errors.New(a.trimTrailingNewLine(a.failMsg))
fmt.Fprintln(a.Stderr, "::error::", err)
fmt.Fprintln(a.Stderr, "::error::", err) //nolint:errcheck

if a.allowFailure() {
return 0
Expand Down

0 comments on commit 2b7ae42

Please sign in to comment.