Skip to content

Commit

Permalink
fix(gofmt): it is recommended to display gofmt reports on GitHubPRRev…
Browse files Browse the repository at this point in the history
…iews
  • Loading branch information
wwcchh0123 committed Jun 14, 2024
1 parent 0a243c3 commit 3621fac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/linters/go/gofmt/gofmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"

"github.com/qiniu/reviewbot/config"
"github.com/qiniu/reviewbot/internal/linters"
"github.com/qiniu/x/log"
"github.com/qiniu/x/xlog"
Expand All @@ -24,6 +25,10 @@ func gofmtHandler(log *xlog.Logger, a linters.Agent) error {
a.LinterConfig.Args = append([]string{}, "-d", "./")
}

// It is recommended to use GitHub's suggestion feature to display reports in gofmt's diff format.
// If you want to use gcc mode and run it on github check run, you can enable gofmt in golangci-lint
a.LinterConfig.ReportFormat = config.GithubPRReview

Check warning on line 30 in internal/linters/go/gofmt/gofmt.go

View check run for this annotation

Codecov / codecov/patch

internal/linters/go/gofmt/gofmt.go#L30

Added line #L30 was not covered by tests

executor, err := NewgofmtExecutor(a.LinterConfig.WorkDir)
if err != nil {
log.Errorf("init gofmt executor failed: %v", err)
Expand Down

0 comments on commit 3621fac

Please sign in to comment.