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