Skip to content

Commit

Permalink
review: clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jan 3, 2024
1 parent bbf6343 commit 5ee213f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
15 changes: 10 additions & 5 deletions pkg/golinters/spancheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ import (

func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter {
cfg := spancheck.NewDefaultConfig()
if settings != nil && settings.Checks != nil {
cfg.EnabledChecks = settings.Checks
}
if settings != nil && settings.IgnoreCheckSignatures != nil {
cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures

if settings != nil {
if settings.Checks != nil {
cfg.EnabledChecks = settings.Checks
}

if settings.IgnoreCheckSignatures != nil {
cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures
}
}

a := spancheck.NewAnalyzerWithConfig(cfg)

return goanalysis.
NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil).
WithLoadMode(goanalysis.LoadModeTypesInfo)
Expand Down
1 change: 0 additions & 1 deletion test/testdata/spancheck/configs/default.yml

This file was deleted.

8 changes: 2 additions & 6 deletions test/testdata/spancheck/spancheck_default.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//golangcitest:config_path configs/default.yml
//golangcitest:args -Espancheck
package spancheck

Expand All @@ -9,12 +8,11 @@ import (

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)

type testError struct{}
type testDefaultError struct{}

func (e *testError) Error() string {
func (e *testDefaultError) Error() string {
return "foo"
}

Expand Down Expand Up @@ -90,5 +88,3 @@ func _() {
_, span = otel.Tracer("foo").Start(context.Background(), "bar")
defer span.End()
}

func recordErr(span trace.Span, err error) {}
4 changes: 2 additions & 2 deletions test/testdata/spancheck/spancheck_enable_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ func _() error {
defer span.End()

err := errors.New("foo")
recordErr(span, err)
recordError(span, err)
return err
}

func recordErr(span trace.Span, err error) {}
func recordError(span trace.Span, err error) {}

0 comments on commit 5ee213f

Please sign in to comment.