Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
129207: build: update errcheck r=RaduBerinde a=RaduBerinde

Update kisielk/errcheck package.

Epic: none
Release note: None

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
  • Loading branch information
craig[bot] and RaduBerinde committed Aug 19, 2024
2 parents 14c0bf9 + b4d3ef5 commit 09a29c8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5526,10 +5526,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_kisielk_errcheck.patch",
],
sha256 = "99d3220891162cb684f8e05d54f3d0dc58abdd496a2f0cfda7fd4a28917a719e",
strip_prefix = "github.com/kisielk/errcheck@v1.6.1-0.20210625163953-8ddee489636a",
sha256 = "f394d1df1f2332387ce142d98734c5c44fb94e9a8a2af2a9b75aa4ec4a64b963",
strip_prefix = "github.com/kisielk/errcheck@v1.7.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/errcheck/com_github_kisielk_errcheck-v1.6.1-0.20210625163953-8ddee489636a.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/errcheck/com_github_kisielk_errcheck-v1.7.0.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kataras/tunnel/com_github_kataras_tunnel-v0.0.4.zip": "1ae8dcc9a6ca3f47c5f8b57767a08b0acd916eceef49c48aa9859547316db8e2",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kballard/go-shellquote/com_github_kballard_go_shellquote-v0.0.0-20180428030007-95032a82bc51.zip": "ae4cb7b097dc4eb0c248dff00ed3bbf0f36984c4162ad1d615266084e58bd6cc",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kevinburke/go-bindata/com_github_kevinburke_go_bindata-v3.13.0+incompatible.zip": "f087b3a77624a113883bac519ebd1a4de07b70ab2ebe73e61e52325ac30777e0",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/errcheck/com_github_kisielk_errcheck-v1.6.1-0.20210625163953-8ddee489636a.zip": "99d3220891162cb684f8e05d54f3d0dc58abdd496a2f0cfda7fd4a28917a719e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/errcheck/com_github_kisielk_errcheck-v1.7.0.zip": "f394d1df1f2332387ce142d98734c5c44fb94e9a8a2af2a9b75aa4ec4a64b963",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/gotool/com_github_kisielk_gotool-v1.0.0.zip": "089dbba6e3aa09944fdb40d72acc86694e8bdde01cfc0f40fe0248309eb80a3f",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/klauspost/asmfmt/com_github_klauspost_asmfmt-v1.3.2.zip": "fa6a350a8677a77e0dbf3664c6baf23aab5c0b60a64b8f3c00299da5d279021f",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.17.8.zip": "648bbc7813dec448eec1a5a467750696bc7e41e1ac0a00b76a967c589826afb6",
Expand Down
21 changes: 9 additions & 12 deletions build/patches/com_github_kisielk_errcheck.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
diff -urN a/errcheck/analyzer.go b/errcheck/analyzer.go
--- a/errcheck/analyzer.go
+++ b/errcheck/analyzer.go
@@ -3,9 +3,9 @@ package errcheck
import (
"fmt"
@@ -5,6 +5,7 @@
"go/ast"
- "go/token"
"reflect"
"regexp"
+ "strings"

"golang.org/x/tools/go/analysis"
)
@@ -21,6 +21,7 @@
@@ -20,6 +21,7 @@
argBlank bool
argAsserts bool
argExcludeFile string
+ argExcludes string
argExcludeOnly bool
)

@@ -28,6 +29,7 @@
@@ -27,6 +29,7 @@
Analyzer.Flags.BoolVar(&argBlank, "blank", false, "if true, check for errors assigned to blank identifier")
Analyzer.Flags.BoolVar(&argAsserts, "assert", false, "if true, check for ignored type assertion results")
Analyzer.Flags.StringVar(&argExcludeFile, "exclude", "", "Path to a file containing a list of functions to exclude from checking")
+ Analyzer.Flags.StringVar(&argExcludes, "excludes", "", "Contents of the exclude file as a string (overrides -exclude)")
Analyzer.Flags.BoolVar(&argExcludeOnly, "excludeonly", false, "Use only excludes from exclude file")
}

@@ -39,7 +41,14 @@
@@ -37,7 +40,14 @@
exclude[name] = true
}
}
Expand All @@ -44,14 +41,14 @@ diff -urN a/errcheck/analyzer.go b/errcheck/analyzer.go
excludes, err := ReadExcludes(argExcludeFile)
if err != nil {
return nil, fmt.Errorf("Could not read exclude file: %v\n", err)
@@ -65,8 +74,9 @@
@@ -63,8 +73,9 @@
ast.Walk(v, f)

for _, err := range v.errors {
+ fsetFile := pass.Fset.File(f.Pos())
pass.Report(analysis.Diagnostic{
- Pos: token.Pos(int(f.Pos()) + err.Pos.Offset),
+ Pos: fsetFile.Pos(err.Pos.Offset),
Message: "unchecked error",
- Pos: pass.Fset.File(f.Pos()).Pos(err.Pos.Offset),
+ Pos: fsetFile.Pos(err.Pos.Offset),
Message: "unchecked error",
Category: "errcheck",
})
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ require (
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
github.com/jordanlewis/gcassert v0.0.0-20240401195008-3141cbd028c0
github.com/kevinburke/go-bindata v3.13.0+incompatible
github.com/kisielk/errcheck v1.6.1-0.20210625163953-8ddee489636a
github.com/kisielk/errcheck v1.7.0
github.com/kisielk/gotool v1.0.0
github.com/klauspost/compress v1.17.8
github.com/klauspost/pgzip v1.2.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1534,8 +1534,8 @@ github.com/kevinburke/go-bindata v3.13.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/errcheck v1.6.1-0.20210625163953-8ddee489636a h1:o2feyvFn8r1nJu/iVn89h0kT+CH6pROXZZHQO60NbrI=
github.com/kisielk/errcheck v1.6.1-0.20210625163953-8ddee489636a/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0=
github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ=
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4=
Expand Down

0 comments on commit 09a29c8

Please sign in to comment.