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

Code maintenance #58

Merged
merged 7 commits into from
Nov 27, 2024
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
12 changes: 6 additions & 6 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Lint
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Check GRPC
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Run tests
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
# if this fails, run go mod tidy
- name: Check if module files are consistent with code
run: go mod tidy && git diff --exit-code
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- name: Generate coverage report
run: make cov-report
- name: Upload to Coveralls
Expand Down
21 changes: 5 additions & 16 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,21 @@ linters:
- bodyclose
- containedctx
- contextcheck
#- cyclop
- decorder
- depguard
- dogsled
- durationcheck
- errcheck
- errchkjson
- errname
#- errorlint
- execinquery
- exportloopref
- forbidigo
- forcetypeassert
- funlen
#- gocognit
- goconst
- gocritic
- gocyclo
#- goerr113
- gofmt
- goheader
- goimports
#- gomnd
- gomodguard
- goprintffuncname
- gosec
Expand All @@ -60,12 +52,11 @@ linters:
- ineffassign
- interfacebloat
- lll
- logrlint
- loggercheck
- maintidx
- makezero
- misspell
- nakedret
#- nestif
- nilerr
- nilnil
- noctx
Expand All @@ -89,7 +80,6 @@ linters:
- usestdlibvars
- wastedassign
- whitespace
#- wsl

linters-settings:
dupl:
Expand All @@ -106,13 +96,12 @@ linters-settings:
local-prefixes: github.com/Mellanox/nvidia-k8s-ipam
lll:
line-length: 120
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: [argument,case,condition,return]
misspell:
locale: US
revive:
rules:
- name: unused-parameter
disabled: true
stylecheck:
dot-import-whitelist:
- github.com/onsi/ginkgo
Expand Down
36 changes: 33 additions & 3 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
inpackage: False
testonly: False
with-expecter: True
keeptree: True
issue-845-fix: True
dir: "{{.InterfaceDir}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
filename: "{{.InterfaceName}}.go"
all: True
packages:
github.com/Mellanox/nvidia-k8s-ipam/pkg/cni/plugin:
config:
all: False
interfaces:
GRPCClient:
github.com/Mellanox/nvidia-k8s-ipam/pkg/cni/types:
config:
all: False
interfaces:
ConfLoader:
github.com/Mellanox/nvidia-k8s-ipam/pkg/ipam-node/allocator:
config:
all: False
interfaces:
IPAllocator:
github.com/Mellanox/nvidia-k8s-ipam/pkg/ipam-node/store:
config:
all: False
interfaces:
Store:
Session:
github.com/Mellanox/nvidia-k8s-ipam/pkg/pool:
config:
all: False
interfaces:
Manager:
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the image
FROM golang:1.21 AS builder
FROM golang:1.23 AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DOCKERFILE ?= Dockerfile
DOCKER_CMD ?= docker

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.27.1
ENVTEST_K8S_VERSION = 1.31.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -120,7 +120,7 @@ kind-load-image: ## Load ipam image to kind cluster

.PHONY: generate-mocks
generate-mocks: mockery ## generate mock objects
PATH=$(LOCALBIN):$(PATH) go generate ./...
PATH="$(LOCALBIN):$(PATH)" mockery

## Location to install dependencies to
LOCALBIN ?= $(PROJECT_DIR)/bin
Expand All @@ -146,14 +146,14 @@ BUF ?= $(LOCALBIN)/buf
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen

## Tool Versions
GOLANGCILINT_VERSION ?= v1.52.2
GOLANGCILINT_VERSION ?= v1.62.2
GCOV2LCOV_VERSION ?= v1.0.5
MOCKERY_VERSION ?= v2.27.1
PROTOC_VER ?= 23.4
PROTOC_GEN_GO_VER ?= 1.31.0
PROTOC_GEN_GO_GRPC_VER ?= 1.3.0
BUF_VERSION ?= 1.23.1
CONTROLLER_GEN_VERSION ?= v0.13.0
MOCKERY_VERSION ?= v2.49.1
PROTOC_VER ?= 28.3
PROTOC_GEN_GO_VER ?= 1.35.2
PROTOC_GEN_GO_GRPC_VER ?= 1.5.1
BUF_VERSION ?= 1.47.2
CONTROLLER_GEN_VERSION ?= v0.16.5

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
Expand Down Expand Up @@ -249,7 +249,7 @@ grpc-check: grpc-format grpc-lint protoc protoc-gen-go protoc-gen-go-grpc $(GRPC
grpc-lint: buf ## Lint GRPC files
@echo "lint protobuf files";
cd $(PROTO_DIR) && \
$(BUF) lint --config ../buf.yaml
$(BUF) lint --config ../buf.yaml .

.PHONY: grpc-format
grpc-format: buf ## Format GRPC files
Expand Down
4 changes: 2 additions & 2 deletions api/grpc/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: v1
lint:
use:
- DEFAULT
- PACKAGE_NO_IMPORT_CYCLE
- STANDARD
- COMMENTS
Loading
Loading