Skip to content

Commit

Permalink
golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nikandfor committed Jul 28, 2024
1 parent f0febee commit 0172663
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
version: v1.59

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ linters-settings:
- builtinShadow
- commentedOutCode
- octalLiteral
- sloppyTestFuncName
- unnamedResult
- whyNoLint
- yodaStyleExpr
Expand All @@ -72,9 +71,10 @@ linters:
- gochecknoglobals
- gochecknoinits
- godox
- goerr113
- err113
- golint
- gomnd
- mnd
- nakedret
- nlreturn
- nonamedreturns
Expand Down
35 changes: 2 additions & 33 deletions location_stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package loc

import (
"fmt"
"path"
"regexp"
"strings"
"testing"

"github.com/stretchr/testify/assert"
)

// align line numbers for tests

func TestLocationFillCallers(t *testing.T) {
st := make(PCs, 1)

Expand Down Expand Up @@ -95,34 +95,3 @@ at [\w.-/]*location_stack_test.go:78
v := st.FormatString("+")
assert.True(t, regexp.MustCompile(re).MatchString(v), "expected:\n%vgot:\n%v", re, v)
}

func innerFuncName(fn PC, n int) string {
var s string

switch {
// case regexp.MustCompile("go1.16.*").MatchString(gover()):
// return ".func1"
case regexp.MustCompile("go1.21.*").MatchString(gover()):
name, _, _ := fn.NameFileLine()
name = path.Base(name)
name = name[strings.IndexByte(name, '.')+1:]

s = "." + name

for i := 0; i < n; i++ {
s += fmt.Sprintf(".func%v", i+1)
}
default:
s = ".func"

for i := 0; i < n; i++ {
if i != 0 {
s += "."
}

s += "1"
}
}

return s
}
4 changes: 0 additions & 4 deletions runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,3 @@ func BenchmarkRuntimeCallerFileLine(b *testing.B) {
b.Errorf("not ok")
}
}

func gover() string {
return runtime.Version()
}
2 changes: 1 addition & 1 deletion unsafe.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package loc

import _ "unsafe"
import _ "unsafe" // for linkname

//go:noescape
//go:linkname callers runtime.callers
Expand Down

0 comments on commit 0172663

Please sign in to comment.