mirror of
				https://github.com/imgproxy/imgproxy.git
				synced 2025-10-30 23:08:02 +02:00 
			
		
		
		
	Migrate to golangci-lint v2
This commit is contained in:
		
							
								
								
									
										4
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @@ -46,9 +46,9 @@ jobs: | ||||
|       - name: Download mods | ||||
|         run: go mod download | ||||
|       - name: Lint | ||||
|         uses: golangci/golangci-lint-action@v6 | ||||
|         uses: golangci/golangci-lint-action@v7 | ||||
|         with: | ||||
|           version: v1.61.0 | ||||
|           version: v2.0.0 | ||||
|           args: --timeout 5m0s | ||||
|         env: | ||||
|           LD_LIBRARY_PATH: "/usr/local/lib:/root/vips/${{ matrix.vips-version }}/lib" | ||||
|   | ||||
| @@ -1,50 +1,61 @@ | ||||
| version: "2" | ||||
| linters: | ||||
|   disable-all: true | ||||
|   default: none | ||||
|   enable: | ||||
|     # - errcheck | ||||
|     - bodyclose | ||||
|     - gocritic | ||||
|     # - goconst | ||||
|     - goimports | ||||
|     - gosimple | ||||
|     - govet | ||||
|     - ineffassign | ||||
|     - staticcheck | ||||
|     - stylecheck | ||||
|     - typecheck | ||||
|     - unused | ||||
|     - bodyclose | ||||
|     - testifylint | ||||
|  | ||||
| linters-settings: | ||||
|   govet: | ||||
|     enable-all: true | ||||
|     disable: | ||||
|       - fieldalignment | ||||
|  | ||||
| issues: | ||||
|   exclude-dirs: | ||||
|     - .tmp | ||||
|     - vendor | ||||
|   exclude-rules: | ||||
|     # - path: _test\.go | ||||
|     #   linters: | ||||
|     #     - goconst | ||||
|  | ||||
|     - linters: [bodyclose] | ||||
|       path: ".*_test.go" | ||||
|  | ||||
|     - linters: [bodyclose] | ||||
|       path: "router/timeout_response.go" | ||||
|  | ||||
|     # False positives on CGO generated code | ||||
|     - linters: [staticcheck] | ||||
|       text: "SA4000:" | ||||
|       path: vips/.* | ||||
|  | ||||
|     # False positives on CGO generated code | ||||
|     - linters: [gocritic] | ||||
|       text: "dupSubExpr" | ||||
|       path: vips/.* | ||||
|  | ||||
|     - linters: [stylecheck] | ||||
|       text: "ST1005:" | ||||
|     - unused | ||||
|   settings: | ||||
|     govet: | ||||
|       disable: | ||||
|         - fieldalignment | ||||
|       enable-all: true | ||||
|   exclusions: | ||||
|     generated: lax | ||||
|     presets: | ||||
|       - comments | ||||
|       - common-false-positives | ||||
|       - legacy | ||||
|       - std-error-handling | ||||
|     rules: | ||||
|       - linters: | ||||
|           - bodyclose | ||||
|         path: .*_test.go | ||||
|       - linters: | ||||
|           - bodyclose | ||||
|         path: router/timeout_response.go | ||||
|       # False positives on CGO generated code | ||||
|       - linters: | ||||
|           - staticcheck | ||||
|         path: vips/.* | ||||
|         text: 'SA4000:' | ||||
|       # False positives on CGO generated code | ||||
|       - linters: | ||||
|           - gocritic | ||||
|         path: vips/.* | ||||
|         text: dupSubExpr | ||||
|       # False positives on CGO generated code | ||||
|       - linters: | ||||
|           - staticcheck | ||||
|         text: 'ST1005:' | ||||
|     paths: | ||||
|       - .tmp | ||||
|       - vendor | ||||
|       - third_party$ | ||||
|       - builtin$ | ||||
|       - examples$ | ||||
| formatters: | ||||
|   enable: | ||||
|     - goimports | ||||
|   exclusions: | ||||
|     generated: lax | ||||
|     paths: | ||||
|       - .tmp | ||||
|       - vendor | ||||
|       - third_party$ | ||||
|       - builtin$ | ||||
|       - examples$ | ||||
|   | ||||
| @@ -12,6 +12,6 @@ if [ -x "$(which brew)" ]; then | ||||
| fi | ||||
|  | ||||
| export CGO_LDFLAGS_ALLOW="-s|-w" | ||||
| export CGO_CFLAGS_ALLOW="-Xpreprocessor" | ||||
| export CGO_CFLAGS_ALLOW="-I|-Xpreprocessor" | ||||
|  | ||||
| golangci-lint run | ||||
|   | ||||
| @@ -49,9 +49,10 @@ func (m IptcMap) MarshalJSON() ([]byte, error) { | ||||
|  | ||||
| 		// Add some additional fields for backward compatibility | ||||
| 		if key.RecordID == 2 { | ||||
| 			if key.TagID == 5 { | ||||
| 			switch key.TagID { | ||||
| 			case 5: | ||||
| 				mm["Name"] = values[0] | ||||
| 			} else if key.TagID == 120 { | ||||
| 			case 120: | ||||
| 				mm["Caption"] = values[0] | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
| @@ -36,7 +36,7 @@ func (s *OtelTestSuite) TestMapDeprecatedConfigEndpointNoProtocol() { | ||||
|  | ||||
| 	s.Require().True(config.OpenTelemetryEnable) | ||||
| 	s.Require().Equal("https://otel_endpoint:1234", os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT")) | ||||
| 	s.Require().Equal("", os.Getenv("OTEL_EXPORTER_OTLP_PROTOCOL")) | ||||
| 	s.Require().Empty(os.Getenv("OTEL_EXPORTER_OTLP_PROTOCOL")) | ||||
| } | ||||
|  | ||||
| func (s *OtelTestSuite) TestMapDeprecatedConfigEndpointGrpcProtocol() { | ||||
|   | ||||
| @@ -594,7 +594,7 @@ func (s *ProcessingHandlerTestSuite) TestLastModifiedDisabled() { | ||||
| 	rw := s.send("/unsafe/rs:fill:4:4/plain/" + ts.URL) | ||||
| 	res := rw.Result() | ||||
|  | ||||
| 	s.Require().Equal("", res.Header.Get("Last-Modified")) | ||||
| 	s.Require().Empty(res.Header.Get("Last-Modified")) | ||||
| } | ||||
|  | ||||
| func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqExactMatchLastModifiedDisabled() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user