Skip to content

Commit

Permalink
after review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfederowicz committed Dec 8, 2024
1 parent aee44cb commit 2d6cafa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
12 changes: 2 additions & 10 deletions lint/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,10 @@ func (p *Package) lint(rules []Rule, config Config, failures chan Failure) error
var eg errgroup.Group
for _, file := range p.files {
eg.Go(func() error {
err := file.lint(rules, config, failures)
if err != nil {
return err
}
return nil
return file.lint(rules, config, failures)
})
}
if err := eg.Wait(); err != nil {
return err
}

return nil
return eg.Wait()
}

// IsAtLeastGo121 returns true if the Go version for this package is 1.21 or higher, false otherwise
Expand Down
6 changes: 0 additions & 6 deletions rule/add_constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,3 @@ func (r *AddConstantRule) configure(arguments lint.Arguments) error {

return nil
}

func configOnce(r *AddConstantRule, arguments lint.Arguments) func() error {
return sync.OnceValue(func() error {
return r.configure(arguments)
})
}
10 changes: 5 additions & 5 deletions rule/banned_characters.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import (
// BannedCharsRule checks if a file contains banned characters.
type BannedCharsRule struct {
bannedCharList []string
configureOnce sync.Once

configureOnce sync.Once
}

const bannedCharsRuleName = "banned-characters"

func (r *BannedCharsRule) configure(arguments lint.Arguments) error {
if len(arguments) > 0 {
check := checkNumberOfArguments(1, arguments, bannedCharsRuleName)
if check != nil {
return check
err := checkNumberOfArguments(1, arguments, bannedCharsRuleName)
if err != nil {
return err
}
list, err := r.getBannedCharsList(arguments)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion rule/receiver_naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (r *ReceiverNamingRule) Apply(file *lint.File, arguments lint.Arguments) ([
typeReceiver[recv] = name
}

return failures
return failures, nil
}

// Name returns the rule name.
Expand Down

0 comments on commit 2d6cafa

Please sign in to comment.