Skip to content

Commit

Permalink
feat: unique file path
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 31, 2024
1 parent 4caffa8 commit 6f95234
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/result/processors/fixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ func (p Fixer) process(issues []result.Issue) ([]result.Issue, error) {
formatters := []string{gofumpt.Name, goimports.Name, gofmt.Name, gci.Name}

var notFixableIssues []result.Issue
var formatIssues []result.Issue

var toBeFormattedFiles map[string]struct{}

for i := range issues {
issue := issues[i]

if slices.Contains(formatters, issue.FromLinter) {
formatIssues = append(formatIssues, issue)
toBeFormattedFiles[issue.FilePath()] = struct{}{}

Check failure on line 90 in pkg/result/processors/fixer.go

View workflow job for this annotation

GitHub Actions / golangci-lint

nilness: nil dereference in map update (govet)
continue
}

Expand Down Expand Up @@ -203,9 +204,7 @@ func (p Fixer) process(issues []result.Issue) ([]result.Issue, error) {
formattedFiles = append(formattedFiles, path)
}

for i := range formatIssues {
path := issues[i].FilePath()

for path := range toBeFormattedFiles {

Check failure on line 207 in pkg/result/processors/fixer.go

View workflow job for this annotation

GitHub Actions / golangci-lint

nilness: range over nil map (govet)
// Skips files already formatted by the previous fix step.
if !slices.Contains(formattedFiles, path) {
content, err := p.fileCache.GetFileBytes(path)
Expand Down

0 comments on commit 6f95234

Please sign in to comment.