Skip to content

Commit

Permalink
dev: remove github.com/pkg/errors inside tests (golangci#3642)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and SeigeC committed Apr 4, 2023
1 parent 4a185da commit f39b81f
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ run:

# output configuration options
output:
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity
#
# Multiple can be specified by separating them by comma, output can be provided
# for each of them by separating format name and path by colon symbol.
Expand Down
4 changes: 2 additions & 2 deletions test/testdata/configs/importas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ linters-settings:
alias: fff
- pkg: os
alias: std_os
- pkg: github.com/pkg/errors
alias: pkgerr
- pkg: golang.org/x/tools/go/analysis
alias: ananas
4 changes: 2 additions & 2 deletions test/testdata/configs/importas_strict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ linters-settings:
alias: fff
- pkg: os
alias: std_os
- pkg: github.com/pkg/errors
alias: pkgerr
- pkg: golang.org/x/tools/go/analysis
alias: ananas
4 changes: 2 additions & 2 deletions test/testdata/fix/in/gci.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ package gci

import (
"github.com/golangci/golangci-lint/pkg/config"
"github.com/pkg/errors"
"golang.org/x/tools/go/analysis"
"fmt"
)

func GoimportsLocalTest() {
fmt.Print("x")
_ = config.Config{}
_ = errors.New("")
_ = analysis.Analyzer{}
}
4 changes: 2 additions & 2 deletions test/testdata/fix/out/gci.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package gci
import (
"fmt"

"github.com/pkg/errors"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/config"
)

func GoimportsLocalTest() {
fmt.Print("x")
_ = config.Config{}
_ = errors.New("")
_ = analysis.Analyzer{}
}
4 changes: 2 additions & 2 deletions test/testdata/gci.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (

"github.com/golangci/golangci-lint/pkg/config" // want "File is not \\`gci\\`-ed with --skip-generated -s standard,prefix\\(github.com/golangci/golangci-lint\\),default"

"github.com/pkg/errors" // want "File is not \\`gci\\`-ed with --skip-generated -s standard,prefix\\(github.com/golangci/golangci-lint\\),default"
"golang.org/x/tools/go/analysis" // want "File is not \\`gci\\`-ed with --skip-generated -s standard,prefix\\(github.com/golangci/golangci-lint\\),default"
)

func GoimportsLocalTest() {
fmt.Print("x")
_ = config.Config{}
_ = errors.New("")
_ = analysis.Analyzer{}
}
4 changes: 2 additions & 2 deletions test/testdata/goimports_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"fmt"

"github.com/golangci/golangci-lint/pkg/config" // want "File is not `goimports`-ed with -local github.com/golangci/golangci-lint"
"github.com/pkg/errors"
"golang.org/x/tools/go/analysis"
)

func GoimportsLocalPrefixTest() {
fmt.Print("x")
_ = config.Config{}
_ = errors.New("")
_ = analysis.Analyzer{}
}
4 changes: 2 additions & 2 deletions test/testdata/importas.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"os"
wrong_alias_again "os" // want `import "os" imported as "wrong_alias_again" but must be "std_os" according to config`

wrong "github.com/pkg/errors" // want `import "github.com/pkg/errors" imported as "wrong" but must be "pkgerr" according to config`
wrong "golang.org/x/tools/go/analysis" // want `import "golang.org/x/tools/go/analysis" imported as "wrong" but must be "ananas" according to config`
)

func ImportAsWrongAlias() {
wrong_alias.Println("foo")
wrong_alias_again.Stdout.WriteString("bar")
os.Stdout.WriteString("test")
_ = wrong.New("baz")
_ = wrong.Analyzer{}
}
4 changes: 2 additions & 2 deletions test/testdata/importas_strict.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"os" // want `import "os" imported without alias but must be with alias "std_os" according to config`
wrong_alias_again "os" // want `import "os" imported as "wrong_alias_again" but must be "std_os" according to config`

wrong "github.com/pkg/errors" // want `import "github.com/pkg/errors" imported as "wrong" but must be "pkgerr" according to config`
wrong "golang.org/x/tools/go/analysis" // want `import "golang.org/x/tools/go/analysis" imported as "wrong" but must be "ananas" according to config`
)

func ImportAsStrictWrongAlias() {
wrong_alias.Println("foo")
wrong_alias_again.Stdout.WriteString("bar")
os.Stdout.WriteString("test")
_ = wrong.New("baz")
_ = wrong.Analyzer{}
}

0 comments on commit f39b81f

Please sign in to comment.