dev: clean configuration and code (#1830)
This commit is contained in:
		
							parent
							
								
									714bd288df
								
							
						
					
					
						commit
						2ebc9d7202
					
				@ -133,35 +133,9 @@ issues:
 | 
				
			|||||||
        - gocritic
 | 
					        - gocritic
 | 
				
			||||||
      text: "unnecessaryDefer:"
 | 
					      text: "unnecessaryDefer:"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO temporary rule, must be removed
 | 
					 | 
				
			||||||
    # seems related to v0.34.1, but I was not able to reproduce locally,
 | 
					 | 
				
			||||||
    # I was also not able to reproduce in the CI of a fork,
 | 
					 | 
				
			||||||
    # only the golangci-lint CI seems to be affected by this invalid analysis.
 | 
					 | 
				
			||||||
    - path: pkg/golinters/scopelint.go
 | 
					 | 
				
			||||||
      text: 'directive `//nolint:interfacer` is unused for linter interfacer'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # TODO temporary rule, must be removed
 | 
					 | 
				
			||||||
    # related to https://github.com/golangci/golangci-lint/pull/1756
 | 
					 | 
				
			||||||
    # must be replaced by '//nolint:staticcheck // require changes in github.com/OpenPeeDeeP/depguard'
 | 
					 | 
				
			||||||
    - path: pkg/golinters/depguard.go
 | 
					 | 
				
			||||||
      text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # TODO temporary rule, must be removed
 | 
					 | 
				
			||||||
    # related to https://github.com/golangci/golangci-lint/pull/1756
 | 
					 | 
				
			||||||
    # must be replaced by '///nolint:staticcheck // it's an adapter for golang.org/x/tools/go/packages'
 | 
					 | 
				
			||||||
    - path: pkg/golinters/goanalysis/adapters.go
 | 
					 | 
				
			||||||
      text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
run:
 | 
					run:
 | 
				
			||||||
  skip-dirs:
 | 
					  skip-dirs:
 | 
				
			||||||
    - test/testdata_etc
 | 
					    - test/testdata_etc
 | 
				
			||||||
    - internal/cache
 | 
					    - internal/cache
 | 
				
			||||||
    - internal/renameio
 | 
					    - internal/renameio
 | 
				
			||||||
    - internal/robustio
 | 
					    - internal/robustio
 | 
				
			||||||
 | 
					 | 
				
			||||||
# golangci.com configuration
 | 
					 | 
				
			||||||
# https://github.com/golangci/golangci/wiki/Configuration
 | 
					 | 
				
			||||||
service:
 | 
					 | 
				
			||||||
  golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly
 | 
					 | 
				
			||||||
  prepare:
 | 
					 | 
				
			||||||
    - echo "here I can run custom commands, but no preparation needed for this repo"
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -5,11 +5,10 @@ import (
 | 
				
			|||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_ "github.com/go-critic/go-critic/checkers" // this import register checkers
 | 
				
			||||||
	"github.com/go-critic/go-critic/framework/linter"
 | 
						"github.com/go-critic/go-critic/framework/linter"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_ "github.com/go-critic/go-critic/checkers" // this import register checkers
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/logutils"
 | 
						"github.com/golangci/golangci-lint/pkg/logutils"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,9 +5,9 @@ import (
 | 
				
			|||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/logutils"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/stretchr/testify/assert"
 | 
						"github.com/stretchr/testify/assert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/golangci/golangci-lint/pkg/logutils"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestUtils(t *testing.T) {
 | 
					func TestUtils(t *testing.T) {
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	"github.com/OpenPeeDeeP/depguard"
 | 
						"github.com/OpenPeeDeeP/depguard"
 | 
				
			||||||
	"golang.org/x/tools/go/analysis"
 | 
						"golang.org/x/tools/go/analysis"
 | 
				
			||||||
	"golang.org/x/tools/go/loader"
 | 
						"golang.org/x/tools/go/loader" //nolint:staticcheck // require changes in github.com/OpenPeeDeeP/depguard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
						"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/lint/linter"
 | 
						"github.com/golangci/golangci-lint/pkg/lint/linter"
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ import (
 | 
				
			|||||||
	"go/types"
 | 
						"go/types"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"golang.org/x/tools/go/analysis"
 | 
						"golang.org/x/tools/go/analysis"
 | 
				
			||||||
	"golang.org/x/tools/go/loader"
 | 
						"golang.org/x/tools/go/loader" //nolint:staticcheck // it's an adapter for golang.org/x/tools/go/packages
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
 | 
					func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,8 @@
 | 
				
			|||||||
package golinters
 | 
					package golinters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"golang.org/x/tools/go/analysis"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"4d63.com/gochecknoglobals/checknoglobals"
 | 
						"4d63.com/gochecknoglobals/checknoglobals"
 | 
				
			||||||
 | 
						"golang.org/x/tools/go/analysis"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
						"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -3,10 +3,9 @@ package golinters
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"golang.org/x/tools/go/packages"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"golang.org/x/tools/go/analysis"
 | 
						"golang.org/x/tools/go/analysis"
 | 
				
			||||||
	"golang.org/x/tools/go/analysis/passes/buildssa"
 | 
						"golang.org/x/tools/go/analysis/passes/buildssa"
 | 
				
			||||||
 | 
						"golang.org/x/tools/go/packages"
 | 
				
			||||||
	"mvdan.cc/unparam/check"
 | 
						"mvdan.cc/unparam/check"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
						"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,6 @@ import (
 | 
				
			|||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/config"
 | 
						"github.com/golangci/golangci-lint/pkg/config"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/logutils"
 | 
						"github.com/golangci/golangci-lint/pkg/logutils"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -4,9 +4,9 @@ import (
 | 
				
			|||||||
	"go/token"
 | 
						"go/token"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/result"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/stretchr/testify/assert"
 | 
						"github.com/stretchr/testify/assert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/golangci/golangci-lint/pkg/result"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type issueTestCase struct {
 | 
					type issueTestCase struct {
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,6 @@ import (
 | 
				
			|||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golangci/golangci-lint/internal/renameio"
 | 
						"github.com/golangci/golangci-lint/internal/renameio"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/lint/linter"
 | 
						"github.com/golangci/golangci-lint/pkg/lint/linter"
 | 
				
			||||||
	"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
 | 
						"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								test/testdata/fix/in/gofumpt.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/testdata/fix/in/gofumpt.go
									
									
									
									
										vendored
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
//args: -Egofumpt
 | 
					//args: -Egofumpt
 | 
				
			||||||
//config: linters-settings.gofumpt.extra-rules=true
 | 
					//config: linters-settings.gofumpt.extra-rules=true
 | 
				
			||||||
package testdata
 | 
					package p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "fmt"
 | 
					import "fmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								test/testdata/fix/out/gofumpt.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/testdata/fix/out/gofumpt.go
									
									
									
									
										vendored
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
// args: -Egofumpt
 | 
					// args: -Egofumpt
 | 
				
			||||||
// config: linters-settings.gofumpt.extra-rules=true
 | 
					// config: linters-settings.gofumpt.extra-rules=true
 | 
				
			||||||
package testdata
 | 
					package p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "fmt"
 | 
					import "fmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user