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

update to go v1.23 and golangci-lint #103

Merged
merged 1 commit into from
Jan 21, 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
4 changes: 2 additions & 2 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.suse.com/bci/golang:1.22.7
FROM registry.suse.com/bci/golang:1.23

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
Expand All @@ -15,7 +15,7 @@ RUN export K8S_VERSION=1.24.2 && \
tar -C /usr/local/kubebuilder --strip-components=1 -zvxf envtest-bins.tar.gz

## install golangci
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.1
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.63.4

# The docker version in dapper is too old to have buildx. Install it manually.
RUN curl -sSfL https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-${ARCH} -o buildx-v0.13.1.linux-${ARCH} && \
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/harvester/pcidevices

go 1.22.7
go 1.23.4

require (
github.com/evanphx/json-patch v5.6.0+incompatible
Expand Down Expand Up @@ -155,7 +155,7 @@ require (
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/usbdevice/usbdevice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (h *DevHandler) getList(localUSBDevices map[int][]*deviceplugins.USBDevice,
ResourceName: resourceName(name),
NodeName: nodeName,
DevicePath: localUSBDevice.DevicePath,
Description: usbid.DescribeWithVendorAndProduct(gousb.ID(localUSBDevice.Vendor), gousb.ID(localUSBDevice.Product)),
Description: usbid.DescribeWithVendorAndProduct(gousb.ID(localUSBDevice.Vendor), gousb.ID(localUSBDevice.Product)), // nolint:gosec
PCIAddress: localUSBDevice.PCIAddress,
},
}
Expand All @@ -252,7 +252,7 @@ func (h *DevHandler) getList(localUSBDevices map[int][]*deviceplugins.USBDevice,
ResourceName: resourceName(usbDeviceName(nodeName, localUSBDevice)),
NodeName: nodeName,
DevicePath: localUSBDevice.DevicePath,
Description: usbid.DescribeWithVendorAndProduct(gousb.ID(localUSBDevice.Vendor), gousb.ID(localUSBDevice.Product)),
Description: usbid.DescribeWithVendorAndProduct(gousb.ID(localUSBDevice.Vendor), gousb.ID(localUSBDevice.Product)), // nolint:gosec
PCIAddress: localUSBDevice.PCIAddress,
}
updateList = append(updateList, existedCp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/gousb/usbid/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestDescribeWithVendorAndProduct(t *testing.T) {
vendor, _ := strconv.ParseInt(tc.vendor, 16, 64)
product, _ := strconv.ParseInt(tc.product, 16, 64)

output := DescribeWithVendorAndProduct(gousb.ID(vendor), gousb.ID(product))
output := DescribeWithVendorAndProduct(gousb.ID(vendor), gousb.ID(product)) // nolint:gosec

assert.Equal(t, tc.expected, output)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/util/gousb/usbid/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (p *Parser) split(s string) (kind string, level int, id uint64, name string
}

func (p *Parser) parseVendor(level int, raw uint64, name string) error {
id := gousb.ID(raw)
id := gousb.ID(raw) // nolint:gosec

switch level {
case 0:
Expand Down Expand Up @@ -175,7 +175,7 @@ func (p *Parser) parseClass(level int, id uint64, name string) error {
p.class = &Class{
Name: name,
}
p.classes[gousb.Class(id)] = p.class
p.classes[gousb.Class(id)] = p.class // nolint:gosec

case 1:
if p.class == nil {
Expand All @@ -188,7 +188,7 @@ func (p *Parser) parseClass(level int, id uint64, name string) error {
if p.class.SubClass == nil {
p.class.SubClass = make(map[gousb.Class]*SubClass)
}
p.class.SubClass[gousb.Class(id)] = p.subclass
p.class.SubClass[gousb.Class(id)] = p.subclass // nolint:gosec

case 2:
if p.subclass == nil {
Expand All @@ -198,7 +198,7 @@ func (p *Parser) parseClass(level int, id uint64, name string) error {
if p.subclass.Protocol == nil {
p.subclass.Protocol = make(map[gousb.Protocol]string)
}
p.subclass.Protocol[gousb.Protocol(id)] = name
p.subclass.Protocol[gousb.Protocol(id)] = name // nolint:gosec

default:
return fmt.Errorf("too many levels of nesting for class")
Expand Down
Loading