Skip to content

ci: update golangci-lint #1586

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

Merged
merged 4 commits into from
Nov 6, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/lib-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.1
version: v1.55.2
args: -v --timeout 5m

build:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ linters-settings:
simplify: true
golint:
min-confidence: 0.9
goconst:
ignore-tests: true
govet:
check-shadowing: true
enable:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= ""

CERT_MANAGER_VERSION ?= v1.13.2
CONTROLLER_GEN_VERSION ?= v0.13.0
GOLANGCI_LINT_VERSION ?= v1.54.2
GOLANGCI_LINT_VERSION ?= v1.55.2
KIND_VERSION ?= v0.20.0
GOLICENSES_VERSION ?= v1.6.0
# Default bundle image tag
Expand Down
2 changes: 1 addition & 1 deletion cmd/gpu_plugin/gpu_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func newDevicePlugin(sysfsDir, devfsDir string, options cliOptions) *devicePlugi
}

if _, err := os.ReadDir(dp.bypathDir); err != nil {
klog.Warningf("failed to read by-path dir: $+v", err)
klog.Warningf("failed to read by-path dir: %+v", err)

dp.bypathFound = false
}
Expand Down
4 changes: 2 additions & 2 deletions demo/sgx-sdk-demo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apt-get update && \
# SGX SDK is installed in /opt/intel directory.
WORKDIR /opt/intel

ARG DCAP_VERSION=DCAP_1.18
ARG DCAP_VERSION=DCAP_1.19

RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" | \
tee -a /etc/apt/sources.list.d/intel-sgx.list \
Expand All @@ -37,7 +37,7 @@ RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://d
libsgx-quote-ex-dev

# Install SGX SDK
ARG SGX_SDK_URL=https://download.01.org/intel-sgx/sgx-linux/2.21/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.21.100.1.bin
ARG SGX_SDK_URL=https://download.01.org/intel-sgx/sgx-linux/2.22/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.22.100.3.bin
RUN wget ${SGX_SDK_URL} \
&& export SGX_SDK_INSTALLER=$(basename $SGX_SDK_URL) \
&& chmod +x $SGX_SDK_INSTALLER \
Expand Down
8 changes: 3 additions & 5 deletions pkg/fpga/bitstream/bitstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import (
// GetFPGABitstream scans bitstream storage and returns first found bitstream by region and afu id.
func GetFPGABitstream(bitstreamDir, region, afu string) (File, error) {
bitstreamPath := ""
// Temporarily only support gbs bitstreams
// for _, ext := range []string{".gbs", ".aocx"} {
for _, ext := range []string{".gbs", ".aocx"} {
for _, ext := range []string{fileExtensionGBS, fileExtensionAOCX} {
bitstreamPath = filepath.Join(bitstreamDir, region, afu+ext)

_, err := os.Stat(bitstreamPath)
Expand All @@ -47,9 +45,9 @@ func GetFPGABitstream(bitstreamDir, region, afu string) (File, error) {
// Open bitstream file, detecting type based on the filename extension.
func Open(fname string) (File, error) {
switch filepath.Ext(fname) {
case ".gbs":
case fileExtensionGBS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO code would be clearer if this Open() function would be inlined into GetFPGABitstream() loop. That way one could more easily see that loop handles all cases that it ranges through.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me but it could be handled in another PR.

return OpenGBS(fname)
case ".aocx":
case fileExtensionAOCX:
return OpenAOCX(fname)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/fpga/bitstream/gbs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestFileGBSMethods(t *testing.T) {
interfaceUUID := "69528db6eb31577a8c3668f9faa081f6"
typeUUID := "d8424dc4a4a3c413f89e433683f9040b"

gbs, err := OpenGBS(filepath.Join("testdata/intel.com/fpga", interfaceUUID, typeUUID) + ".gbs")
gbs, err := OpenGBS(filepath.Join("testdata/intel.com/fpga", interfaceUUID, typeUUID) + fileExtensionGBS)
if err != nil {
t.Errorf("unexpected open error: %+v", err)
return
Expand All @@ -76,7 +76,7 @@ func TestFileGBSMethods(t *testing.T) {
}

installPath := gbs.InstallPath("")
if installPath != filepath.Join(interfaceUUID, typeUUID)+".gbs" {
if installPath != filepath.Join(interfaceUUID, typeUUID)+fileExtensionGBS {
t.Errorf("unexpected Install Path value: %s", installPath)
}

Expand Down