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

Bump golangci-lint to 1.63.4 #311

Merged
merged 1 commit into from
Jan 17, 2025
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
10 changes: 8 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ issues:
- virt-tests
- vm-images

# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Don't complain about integer overflows
- text: "G115:"
linters:
- gosec

linters:
enable-all: true
disable:
Expand Down Expand Up @@ -58,7 +65,6 @@ linters:
- godot
- godox # complains about TODO etc
- gofumpt
- gomnd
- gomoddirectives
- inamedparam
- interfacebloat
Expand Down Expand Up @@ -86,7 +92,7 @@ linters:
- wsl
- wrapcheck
# the following linters are deprecated
- execinquery
- exportloopref
# we don't want to change code to Go 1.22+ yet
- intrange
- copyloopvar
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ebpf:
ebpf-profiler: generate ebpf
go build $(GO_FLAGS) -tags $(GO_TAGS)

GOLANGCI_LINT_VERSION = "v1.60.1"
GOLANGCI_LINT_VERSION = "v1.63.4"
lint: generate vanity-import-check
$(MAKE) lint -C support/ebpf
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) version
Expand Down
2 changes: 1 addition & 1 deletion libpf/basehash/hash128.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
//
// hi represents the most significant 64 bits and lo represents the least
// significant 64 bits.
type Hash128 struct {
type Hash128 struct { //nolint:recvcheck
hi uint64
lo uint64
}
Expand Down
2 changes: 1 addition & 1 deletion libpf/frameid.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (f FrameID) AddressOrLine() AddressOrLineno {

// AsIP returns the FrameID as a net.IP type to be used
// for the PC range in profiling-symbols-*.
func (f *FrameID) AsIP() net.IP {
func (f FrameID) AsIP() net.IP {
bytes := f.Bytes()
ip := make([]byte, 16)
copy(ip[:8], bytes[:8]) // first 64bits of FileID
Expand Down
11 changes: 1 addition & 10 deletions processmanager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func generateDummyFiles(t *testing.T, num int) []string {

for i := 0; i < num; i++ {
name := fmt.Sprintf("dummy%d", i)
tmpfile, err := os.CreateTemp("", "*"+name)
tmpfile, err := os.CreateTemp(t.TempDir(), "*"+name)
require.NoError(t, err)

// The generated fileID is based on the content of the file.
Expand Down Expand Up @@ -381,10 +381,6 @@ func TestNewMapping(t *testing.T) {
expectedStackDeltas: 27},
}

cacheDir, err := os.MkdirTemp("", "*_cacheDir")
require.NoError(t, err)
defer os.RemoveAll(cacheDir)

for name, testcase := range tests {
testcase := testcase
t.Run(name, func(t *testing.T) {
Expand Down Expand Up @@ -419,11 +415,6 @@ func TestNewMapping(t *testing.T) {
}

execs := generateDummyFiles(t, len(testcase.newMapping))
defer func() {
for _, exe := range execs {
os.Remove(exe)
}
}()

if testcase.duplicate {
execs = append(execs, execs...)
Expand Down
2 changes: 1 addition & 1 deletion reporter/internal/pdata/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (

// Generate generates a pdata request out of internal profiles data, to be
// exported.
func (p Pdata) Generate(events map[libpf.Origin]samples.KeyToEventMapping) pprofile.Profiles {
func (p *Pdata) Generate(events map[libpf.Origin]samples.KeyToEventMapping) pprofile.Profiles {
profiles := pprofile.NewProfiles()
rp := profiles.ResourceProfiles().AppendEmpty()
sp := rp.ScopeProfiles().AppendEmpty()
Expand Down
2 changes: 1 addition & 1 deletion reporter/internal/pdata/pdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func New(samplesPerSecond int, executablesCacheElements, framesCacheElements uin
}

// Purge purges all the expired data
func (p Pdata) Purge() {
func (p *Pdata) Purge() {
p.Executables.PurgeExpired()
p.Frames.PurgeExpired()
}
4 changes: 2 additions & 2 deletions tools/zstpak/lib/zstpak_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"go.opentelemetry.io/ebpf-profiler/testsupport"
zstpak "go.opentelemetry.io/ebpf-profiler/tools/zstpak/lib"
)
Expand All @@ -27,9 +28,8 @@ func testRandomAccesses(t *testing.T, seqLen uint8, fileSize uint64,
file := generateInputFile(seqLen, fileSize)
reader := bytes.NewReader(file)

temp, err := os.CreateTemp("", "")
temp, err := os.CreateTemp(t.TempDir(), "")
require.NoError(t, err)
defer os.Remove(temp.Name())

err = zstpak.CompressInto(reader, temp, chunkSize)
require.NoError(t, err)
Expand Down
Loading