Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golangci/golangci-lint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.55.0
Choose a base ref
...
head repository: golangci/golangci-lint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.55.1
Choose a head ref
  • 6 commits
  • 8 files changed
  • 3 contributors

Commits on Oct 20, 2023

  1. Copy the full SHA
    063f2c8 View commit details
  2. Copy the full SHA
    17e1a5f View commit details

Commits on Oct 23, 2023

  1. Copy the full SHA
    4068be1 View commit details

Commits on Oct 24, 2023

  1. Copy the full SHA
    5c19d1d View commit details
  2. Copy the full SHA
    3d58209 View commit details
  3. output: convert backslashes to forward slashes for GitHub Action anno…

    …tations printer (#4149)
    
    Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
    surik and ldez authored Oct 24, 2023
    Copy the full SHA
    9b20d49 View commit details
Showing with 87 additions and 15 deletions.
  1. +1 −1 .github/workflows/documentation.yml
  2. +1 −1 .github/workflows/post-release.yml
  3. +39 −0 CHANGELOG.md
  4. +6 −2 assets/github-action-config.json
  5. +3 −3 go.mod
  6. +8 −7 go.sum
  7. +7 −1 pkg/printers/github.go
  8. +22 −0 pkg/printers/github_test.go
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ jobs:
- run: go mod download

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
2 changes: 1 addition & 1 deletion .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
- name: Update GitHub action config
run: make assets/github-action-config.json

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "15"
check-latest: true
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,45 @@ Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint)

There is the most valuable changes log:

### v1.55.0

1. new linters
* `gochecksumtype`: https://github.com/alecthomas/go-check-sumtype
* `inamedparam`: https://github.com/macabu/inamedparam
* `perfsprint`: https://github.com/catenacyber/perfsprint
* `protogetter`: https://github.com/ghostiam/protogetter
* `sloglint`: https://github.com/go-simpler/sloglint
* `testifylint`: https://github.com/Antonboom/testifylint
2. updated linters
* `bidichk`: from 0.2.4 to 0.2.7
* `decorder`: from 0.4.0 to 0.4.1
* `dupword`: from 0.0.12 to 0.0.13
* `errchkjson`: from 0.3.1 to 0.3.6
* `gci`: from 0.11.0 to 0.11.2
* `ginkgolinter`: from 0.13.5 to 0.14.0
* `go-errorlint`: from 1.4.4 to 1.4.5
* `gocognit`: from 1.0.7 to 1.1.0
* `goconst`: from 1.5.1 to 1.6.0
* `godot`: from 1.4.14 to 1.4.15
* `gofmt`: update to HEAD
* `goimports`: update to HEAD
* `gosec`: from 2.17.0 to 2.18.1
* `gosmopolitan`: from 1.2.1 to 1.2.2
* `govet`: add `appends` analyzer
* `ireturn`: from 0.2.0 to 0.2.1
* `protogetter`: from 0.2.2 to 0.2.3
* `revgrep`: from 745bb2f7c2e6 to v0.5.0
* `revive`: from 1.3.2 to 1.3.4
* `sqlclosecheck`: from 0.4.0 to 0.5.1
* `staticcheck`: from 0.4.5 to 0.4.6
* `tagalign`: from 1.3.2 to 1.3.3
* `unused`: support passing in options
3. misc.
* Add a pre-commit hook to check all files
4. Documentation
* add source options to exclude-rules docs
* `gosec`: add G602 to includes/excludes inside .golangci.reference.yml

### v1.54.2

1. updated linters:
8 changes: 6 additions & 2 deletions assets/github-action-config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"MinorVersionToConfig": {
"latest": {
"TargetVersion": "v1.54.2",
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.54.2/golangci-lint-1.54.2-linux-amd64.tar.gz"
"TargetVersion": "v1.55.0",
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.55.0/golangci-lint-1.55.0-linux-amd64.tar.gz"
},
"v1.10": {
"Error": "golangci-lint version 'v1.10' isn't supported: we support only v1.14.0 and later versions"
@@ -189,6 +189,10 @@
"TargetVersion": "v1.54.2",
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.54.2/golangci-lint-1.54.2-linux-amd64.tar.gz"
},
"v1.55": {
"TargetVersion": "v1.55.0",
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.55.0/golangci-lint-1.55.0-linux-amd64.tar.gz"
},
"v1.6": {
"Error": "golangci-lint version 'v1.6' isn't supported: we support only v1.14.0 and later versions"
},
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ require (
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
github.com/golangci/misspell v0.4.1
github.com/golangci/revgrep v0.5.0
github.com/golangci/revgrep v0.5.2
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601
github.com/gostaticanalysis/forcetypeassert v0.1.0
@@ -90,7 +90,7 @@ require (
github.com/sanposhiho/wastedassign/v2 v2.0.7
github.com/sashamelentyev/interfacebloat v1.1.0
github.com/sashamelentyev/usestdlibvars v1.24.0
github.com/securego/gosec/v2 v2.18.1
github.com/securego/gosec/v2 v2.18.2
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.23.9
github.com/sirupsen/logrus v1.9.3
@@ -151,7 +151,7 @@ require (
github.com/go-toolsmith/typep v1.1.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.4.2 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
15 changes: 8 additions & 7 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion pkg/printers/github.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package printers
import (
"fmt"
"io"
"path/filepath"

"github.com/golangci/golangci-lint/pkg/result"
)
@@ -26,7 +27,12 @@ func formatIssueAsGithub(issue *result.Issue) string {
severity = issue.Severity
}

ret := fmt.Sprintf("::%s file=%s,line=%d", severity, issue.FilePath(), issue.Line())
// Convert backslashes to forward slashes.
// This is needed when running on windows.
// Otherwise, GitHub won't be able to show the annotations pointing to the file path with backslashes.
file := filepath.ToSlash(issue.FilePath())

ret := fmt.Sprintf("::%s file=%s,line=%d", severity, file, issue.Line())
if issue.Pos.Column != 0 {
ret += fmt.Sprintf(",col=%d", issue.Pos.Column)
}
22 changes: 22 additions & 0 deletions pkg/printers/github_test.go
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ package printers
import (
"bytes"
"go/token"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
@@ -72,3 +73,24 @@ func TestFormatGithubIssue(t *testing.T) {
sampleIssue.Pos.Column = 0
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
}

func TestFormatGithubIssueWindows(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("Skipping test on non Windows")
}

sampleIssue := result.Issue{
FromLinter: "sample-linter",
Text: "some issue",
Pos: token.Position{
Filename: "path\\to\\file.go",
Offset: 2,
Line: 10,
Column: 4,
},
}
require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))

sampleIssue.Pos.Column = 0
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
}