Skip to content

Commit

Permalink
review: error management
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Apr 30, 2022
1 parent 9006f56 commit d029d10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/Antonboom/nilnil v0.1.1
github.com/BurntSushi/toml v1.1.0
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.0.1
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.0.2-0.20220410203528-eb118e90b8df
github.com/OpenPeeDeeP/depguard v1.1.0
github.com/alexkohler/prealloc v1.0.0
github.com/ashanbrown/forbidigo v1.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/golinters/commons.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package golinters

import "github.com/golangci/golangci-lint/pkg/logutils"

// linterLogger must be use only when the context logger is not available.
var linterLogger = logutils.NewStderrLog("linter")
5 changes: 4 additions & 1 deletion pkg/golinters/exhaustruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ func NewExhaustruct(settings *config.ExhaustructSettings) *goanalysis.Linter {
exclude = settings.Exclude
}

a := analyzer.MustNewAnalyzer(include, exclude)
a, err := analyzer.NewAnalyzer(include, exclude)
if err != nil {
linterLogger.Fatalf("exhaustruct configuration: %v", err)
}

return goanalysis.NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil).
WithLoadMode(goanalysis.LoadModeTypesInfo)
Expand Down

0 comments on commit d029d10

Please sign in to comment.