Skip to content
Open
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/tomarrell/wrapcheck/v2
go 1.24.0

require (
github.com/gobwas/glob v0.2.3
github.com/gobwas/glob v1.0.0
github.com/spf13/viper v1.12.0
github.com/stretchr/testify v1.7.2
golang.org/x/tools v0.39.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmV
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gobwas/glob v1.0.0 h1:p+FKbLEIsK1yZ39/OINwFvqNb5oyPY4H8xcy6uYu8dg=
github.com/gobwas/glob v1.0.0/go.mod h1:oWCdo522i2P1n/hMXGNWs7yoV4wy/ciZuUIbvKj5rkc=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down
12 changes: 6 additions & 6 deletions wrapcheck/wrapcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func run(cfg WrapcheckConfig) func(*analysis.Pass) (interface{}, error) {
var (
ignoreSigRegexp []*regexp.Regexp
ignoreInterfaceRegexps []*regexp.Regexp
ignorePackageGlobs []glob.Glob
ignorePackageGlobs []*glob.Pattern
err error
)

Expand Down Expand Up @@ -274,7 +274,7 @@ func reportUnwrapped(
cfg WrapcheckConfig,
regexpsSig []*regexp.Regexp,
regexpsInter []*regexp.Regexp,
pkgGlobs []glob.Glob,
pkgGlobs []*glob.Pattern,
) {

if cfg.ReportInternalErrors {
Expand Down Expand Up @@ -347,7 +347,7 @@ func isInterface(pass *analysis.Pass, sel *ast.SelectorExpr) bool {
// isFromotherPkg returns whether the function is defined in the package
// currently under analysis or is considered external. It will ignore packages
// defined in config.IgnorePackageGlobs.
func isFromOtherPkg(pass *analysis.Pass, sel *ast.SelectorExpr, pkgGlobs []glob.Glob) bool {
func isFromOtherPkg(pass *analysis.Pass, sel *ast.SelectorExpr, pkgGlobs []*glob.Pattern) bool {
// The package of the function that we are calling which returns the error
fn := pass.TypesInfo.ObjectOf(sel.Sel)
if containsMatchGlob(pkgGlobs, fn.Pkg().Path()) {
Expand Down Expand Up @@ -436,7 +436,7 @@ func containsMatch(regexps []*regexp.Regexp, el string) bool {
return false
}

func containsMatchGlob(globs []glob.Glob, el string) bool {
func containsMatchGlob(globs []*glob.Pattern, el string) bool {
for _, g := range globs {
if g.Match(el) {
return true
Expand Down Expand Up @@ -483,8 +483,8 @@ func compileRegexps(regexps []string) ([]*regexp.Regexp, error) {

// compileGlobs compiles a set of globs, returning them for use,
// or the first encountered error due to an invalid expression.
func compileGlobs(globs []string) ([]glob.Glob, error) {
compiledGlobs := make([]glob.Glob, len(globs))
func compileGlobs(globs []string) ([]*glob.Pattern, error) {
compiledGlobs := make([]*glob.Pattern, len(globs))
for idx, globString := range globs {
glob, err := glob.Compile(globString)
if err != nil {
Expand Down