From d11caf0207487b974769f88c37cfea1148f84f36 Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Mon, 26 Feb 2024 23:38:18 -0800 Subject: [PATCH] Bump golangci-lint to latest --- .github/workflows/ci.yml | 4 ++-- cmd/ebpf_exporter/main.go | 4 ++-- decoder/pci.go | 8 ++++---- decoder/pci_class.go | 2 +- decoder/pci_device.go | 2 +- decoder/pci_subclass.go | 2 +- decoder/pci_test.go | 4 ++-- decoder/pci_vendor.go | 2 +- tracing/demos/sock/main.go | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 736ccf59..a1294645 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -344,9 +344,9 @@ jobs: run: go mod verify - name: Run golangci-lint - uses: golangci/golangci-lint-action@c67416616c29c3c48d26b59c45cadb56966d80aa # https://github.com/golangci/golangci-lint-action/issues/953 + uses: golangci/golangci-lint-action@v4 with: - version: v1.54.2 + version: v1.56.2 env: CGO_CFLAGS: "-I${{ github.workspace }}/libbpf/dest/usr/include" diff --git a/cmd/ebpf_exporter/main.go b/cmd/ebpf_exporter/main.go index 4180d847..3d49d4fe 100644 --- a/cmd/ebpf_exporter/main.go +++ b/cmd/ebpf_exporter/main.go @@ -38,7 +38,7 @@ func main() { libbpfgoCallbacks := libbpfgo.Callbacks{Log: libbpfLogCallback} if !*debug { - libbpfgoCallbacks.LogFilters = append(libbpfgoCallbacks.LogFilters, func(libLevel int, msg string) bool { + libbpfgoCallbacks.LogFilters = append(libbpfgoCallbacks.LogFilters, func(libLevel int, _ string) bool { return libLevel == libbpfgo.LibbpfDebugLevel }) } @@ -109,7 +109,7 @@ func main() { } http.Handle(*metricsPath, promhttp.Handler()) - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { _, err = w.Write([]byte(` eBPF Exporter diff --git a/decoder/pci.go b/decoder/pci.go index 691eb1e4..8d45e0e6 100644 --- a/decoder/pci.go +++ b/decoder/pci.go @@ -7,14 +7,14 @@ import ( "github.com/jaypipes/pcidb" ) -const pciIdsPath = "/usr/share/misc/pci.ids" -const missingPciIdsText = "missing pci.ids db" +const pciIDsPath = "/usr/share/misc/pci.ids" +const missingPciIDsText = "missing pci.ids db" var pci *pcidb.PCIDB func init() { - if _, err := os.Stat(pciIdsPath); err != nil { - log.Printf("PCI DB path %q is not accessible: %v", pciIdsPath, err) + if _, err := os.Stat(pciIDsPath); err != nil { + log.Printf("PCI DB path %q is not accessible: %v", pciIDsPath, err) return } diff --git a/decoder/pci_class.go b/decoder/pci_class.go index 484a3541..134a7c2e 100644 --- a/decoder/pci_class.go +++ b/decoder/pci_class.go @@ -13,7 +13,7 @@ type PCIClass struct{} // Decode transforms PCI class id into a name func (d *PCIClass) Decode(in []byte, _ config.Decoder) ([]byte, error) { if pci == nil { - return []byte(missingPciIdsText), nil + return []byte(missingPciIDsText), nil } num, err := strconv.Atoi(string(in)) diff --git a/decoder/pci_device.go b/decoder/pci_device.go index b7147169..e3817e13 100644 --- a/decoder/pci_device.go +++ b/decoder/pci_device.go @@ -13,7 +13,7 @@ type PCIDevice struct{} // Decode transforms PCI device id into a name func (d *PCIDevice) Decode(in []byte, _ config.Decoder) ([]byte, error) { if pci == nil { - return []byte(missingPciIdsText), nil + return []byte(missingPciIDsText), nil } num, err := strconv.Atoi(string(in)) diff --git a/decoder/pci_subclass.go b/decoder/pci_subclass.go index 1a815be4..a5d75100 100644 --- a/decoder/pci_subclass.go +++ b/decoder/pci_subclass.go @@ -13,7 +13,7 @@ type PCISubClass struct{} // Decode transforms PCI class id into a name func (d *PCISubClass) Decode(in []byte, _ config.Decoder) ([]byte, error) { if pci == nil { - return []byte(missingPciIdsText), nil + return []byte(missingPciIDsText), nil } num, err := strconv.Atoi(string(in)) diff --git a/decoder/pci_test.go b/decoder/pci_test.go index c4c3de71..1925168d 100644 --- a/decoder/pci_test.go +++ b/decoder/pci_test.go @@ -18,8 +18,8 @@ func testPCIMissing(t *testing.T, d Decoder, cases [][]byte) { t.Errorf("Error decoding %#v: %v", c, err) } - if !bytes.Equal(out, []byte(missingPciIdsText)) { - t.Errorf("Expected %q, got %s", missingPciIdsText, out) + if !bytes.Equal(out, []byte(missingPciIDsText)) { + t.Errorf("Expected %q, got %s", missingPciIDsText, out) } } } diff --git a/decoder/pci_vendor.go b/decoder/pci_vendor.go index 26bf95a7..2317622c 100644 --- a/decoder/pci_vendor.go +++ b/decoder/pci_vendor.go @@ -13,7 +13,7 @@ type PCIVendor struct{} // Decode transforms PCI vendor id into a name func (d *PCIVendor) Decode(in []byte, _ config.Decoder) ([]byte, error) { if pci == nil { - return []byte(missingPciIdsText), nil + return []byte(missingPciIDsText), nil } num, err := strconv.Atoi(string(in)) diff --git a/tracing/demos/sock/main.go b/tracing/demos/sock/main.go index 23692684..8fc83e1e 100644 --- a/tracing/demos/sock/main.go +++ b/tracing/demos/sock/main.go @@ -28,7 +28,7 @@ func main() { _, dialSpan := tracer.Start(ctx, "dial") dialer := net.Dialer{ - Control: func(network, address string, c syscall.RawConn) error { + Control: func(_, _ string, c syscall.RawConn) error { return c.Control(func(fd uintptr) { sockSentParentSpan(fd, dialSpan) connFd = fd