Skip to content

Commit 4192981

Browse files
authored
Merge branch 'master' into jjti/add-spancheck-2
2 parents 4bf6806 + d22232a commit 4192981

File tree

5 files changed

+9
-21
lines changed

5 files changed

+9
-21
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ require (
5252
github.com/gordonklaus/ineffassign v0.1.0
5353
github.com/gostaticanalysis/forcetypeassert v0.1.0
5454
github.com/gostaticanalysis/nilerr v0.1.1
55-
github.com/hashicorp/go-multierror v1.1.1
5655
github.com/hashicorp/go-version v1.6.0
5756
github.com/hexops/gotextdiff v1.0.3
5857
github.com/jgautheron/goconst v1.7.0
@@ -154,7 +153,6 @@ require (
154153
github.com/google/go-cmp v0.6.0 // indirect
155154
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
156155
github.com/gostaticanalysis/comment v1.4.2 // indirect
157-
github.com/hashicorp/errwrap v1.0.0 // indirect
158156
github.com/hashicorp/hcl v1.0.0 // indirect
159157
github.com/inconshreveable/mousetrap v1.1.0 // indirect
160158
github.com/jjti/go-spancheck v0.3.0 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/goanalysis/runner_action.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"runtime/debug"
1010
"time"
1111

12-
"github.com/hashicorp/go-multierror"
1312
"golang.org/x/tools/go/analysis"
1413
"golang.org/x/tools/go/packages"
1514
"golang.org/x/tools/go/types/objectpath"
@@ -126,20 +125,16 @@ func (act *action) analyze() {
126125
}(time.Now())
127126

128127
// Report an error if any dependency failures.
129-
var depErrors *multierror.Error
128+
var depErrors error
130129
for _, dep := range act.deps {
131130
if dep.err == nil {
132131
continue
133132
}
134133

135-
depErrors = multierror.Append(depErrors, errors.Unwrap(dep.err))
134+
depErrors = errors.Join(depErrors, errors.Unwrap(dep.err))
136135
}
137136
if depErrors != nil {
138-
depErrors.ErrorFormat = func(e []error) string {
139-
return fmt.Sprintf("failed prerequisites: %v", e)
140-
}
141-
142-
act.err = depErrors
137+
act.err = fmt.Errorf("failed prerequisites: %w", depErrors)
143138
return
144139
}
145140

pkg/lint/lintersdb/custom_linters.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package lintersdb
22

33
import (
4+
"errors"
45
"fmt"
56
"os"
67
"path/filepath"
78
"plugin"
89

9-
"github.com/hashicorp/go-multierror"
1010
"github.com/spf13/viper"
1111
"golang.org/x/tools/go/analysis"
1212

@@ -94,8 +94,7 @@ func (m *Manager) lookupPlugin(plug *plugin.Plugin, settings any) ([]*analysis.A
9494
if err != nil {
9595
analyzers, errP := m.lookupAnalyzerPlugin(plug)
9696
if errP != nil {
97-
// TODO(ldez): use `errors.Join` when we will upgrade to go1.20.
98-
return nil, multierror.Append(err, errP)
97+
return nil, errors.Join(err, errP)
9998
}
10099

101100
return analyzers, nil

pkg/lint/runner.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package lint
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"runtime/debug"
78
"strings"
89

9-
"github.com/hashicorp/go-multierror"
1010
gopackages "golang.org/x/tools/go/packages"
1111

1212
"github.com/golangci/golangci-lint/internal/errorutil"
@@ -205,7 +205,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
205205
defer sw.Print()
206206

207207
var (
208-
lintErrors *multierror.Error
208+
lintErrors error
209209
issues []result.Issue
210210
)
211211

@@ -214,7 +214,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
214214
sw.TrackStage(lc.Name(), func() {
215215
linterIssues, err := r.runLinterSafe(ctx, lintCtx, lc)
216216
if err != nil {
217-
lintErrors = multierror.Append(lintErrors, fmt.Errorf("can't run linter %s: %w", lc.Linter.Name(), err))
217+
lintErrors = errors.Join(lintErrors, fmt.Errorf("can't run linter %s", lc.Linter.Name()), err)
218218
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)
219219

220220
return
@@ -224,7 +224,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
224224
})
225225
}
226226

227-
return r.processLintResults(issues), lintErrors.ErrorOrNil()
227+
return r.processLintResults(issues), lintErrors
228228
}
229229

230230
func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue {

0 commit comments

Comments
 (0)