Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lint to 1.59.1 #9

Merged
merged 2 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.22.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -32,7 +32,7 @@ jobs:
lint:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.22.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -41,12 +41,12 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.1
version: v1.59.1
args: -v --config config/.golangci-no-plugin.yml
lint-plugin:
strategy:
matrix:
go: [1.20.x]
go: [1.22.x]
os: [ubuntu-latest]
name: lint-plugin
runs-on: ${{ matrix.os }}
Expand All @@ -58,7 +58,7 @@ jobs:
name: Checkout code
- name: Install golangci-lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
- name: Build plugin
run: |
go build --buildmode plugin -o cerrl.so plugin/cerrl.go
Expand All @@ -71,7 +71,7 @@ jobs:
# lint-plugin:
# strategy:
# matrix:
# go: [1.20.x]
# go: [1.22.x]
# os: [ubuntu-latest]
# name: lint-plugin
# runs-on: ${{ matrix.os }}
Expand All @@ -83,7 +83,7 @@ jobs:
# name: Checkout code
# - name: Install golangci-lint
# run: |
# go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0
# go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
# - name: Build plugin
# run: |
# curl -L -o go-lint-cerrl.zip https://github.com/edenlabllc/go-lint-cerrl/archive/refs/tags/v0.1.0.zip
Expand Down
14 changes: 13 additions & 1 deletion config/.golangci-no-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ linters-settings:
# in the sense that it will only allow these assignments to be cuddled with variables being appended.
# Default: true
strict-append: false
depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax
files:
- $all
- "!$test"
allow:
- $gostd
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"

nestif:
# Minimal complexity of if statements to report.
Expand Down Expand Up @@ -187,4 +199,4 @@ issues:
text: "unnecessaryDefer:"
run:
timeout: 10m
go: '1.20'
go: '1.22'
2 changes: 1 addition & 1 deletion config/.golangci-plugin-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ issues:

run:
timeout: 10m
go: '1.20'
go: '1.20'
14 changes: 13 additions & 1 deletion config/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ linters-settings:
# in the sense that it will only allow these assignments to be cuddled with variables being appended.
# Default: true
strict-append: false
depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax
files:
- $all
- "!$test"
allow:
- $gostd
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"

nestif:
# Minimal complexity of if statements to report.
Expand Down Expand Up @@ -194,4 +206,4 @@ issues:

run:
timeout: 10m
go: '1.20'
go: '1.22'
2 changes: 1 addition & 1 deletion docker/docker-compose-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cd /app

go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1

go build --buildmode plugin -o /tmp/cerrl.so plugin/cerrl.go

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'

services:
golangci-lint-docker-compose:
image: golang:1.20
image: golang:1.22
container_name: golangci-lint-docker-compose
volumes:
- ..:/app
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/edenlabllc/go-lint-cerrl

go 1.20
go 1.22

require golang.org/x/tools v0.5.0
require golang.org/x/tools v0.22.0

require (
golang.org/x/mod v0.7.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/sync v0.7.0 // indirect
)
18 changes: 6 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
2 changes: 2 additions & 0 deletions pkg/cerrl/cerrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
isImportFinished = false
cerrPkgName = ""
}

if is.Path != nil && strings.HasSuffix(is.Path.Value, `/pkg/cerror"`) {
// is.Name == nil means the import has no alias
if is.Name == nil {
Expand All @@ -58,6 +59,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
cerrPkgName = is.Name.Name
}
}

return
}

Expand Down
Loading