Skip to content

Commit

Permalink
Merge pull request #20 from gianlucam76/main
Browse files Browse the repository at this point in the history
Merge dev to main
  • Loading branch information
gianlucam76 authored Jan 5, 2024
2 parents 5765263 + c112499 commit 950b20d
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 101 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.8
go-version: 1.21.5
- name: Build
run: make build
- name: FMT
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.8
go-version: 1.21.5
- name: ut
run: make test
env:
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.8
go-version: 1.21.5
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
Expand Down
181 changes: 181 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
linters-settings:
dupl:
threshold: 200
errorlint:
# Use '%w' to format errors.
errorf: true
exhaustive:
# Ignore auto-generated code.
check-generated: false
default-signifies-exhaustive: false
forbidigo:
forbid:
# Forbid 'fmt.Print[|f|ln]() in shipping code.
- 'fmt\.Print.*'
funlen:
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint # conflicts with nolintlint config providing superset functionality
- wrapperFunc
gocyclo:
min-complexity: 20
goimports:
local-prefixes: github.com/projectsveltos
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
gomodguard:
# Although this is almost empty, we will evolve the list below with the
# modules we shouldn't use for technical and/or security reasons.
blocked:
modules:
- k8s.io/kubernetes:
reason: "There is no good, avoidable reason to use this package and often leads to issues such as https://bit.ly/3dlKScY. However, if you disagree please include @ravchama in code review highlighting the reason."
versions:
# Don't merge replace directives using local path.
local_replace_directives: true
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
grouper:
const-require-grouping: true
import-require-single-import: true
import-require-grouping: true
var-require-grouping: true
lll:
line-length: 160
maintidx:
# check https://bit.ly/3tlJX3n for maintainability index.
##
# starting with 25 to begin with, with the plan to bump it to 40 eventuallly.
##
under: 25
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
revive:
ignore-generated-header: true
# this is a new linter, so let's start with Warning instead of errors to
# begin with.
severity: warning
whitespace:
multi-if: true
multi-func: true

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
fast: false
enable:
- bidichk
- containedctx
- bodyclose
- dogsled
- dupl
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
- funlen
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
- ineffassign
- lll
- misspell
- maintidx
- nakedret
- noctx
- nolintlint
- nosprintfhostport
- predeclared
- revive
- staticcheck
- typecheck
- unconvert
- unparam
- whitespace

# don't enable:
# - asciicheck
# - exhaustivestruct # applicable to special cases.
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - golint # deprecated
# - interfacer # deprecated
# - maligned #deprecated
# - nestif
# - prealloc
# - scopelint # deprecated
# - testpackage
# - wsl

issues:
# Excluding configuration per path, per linter, per text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- grouper
- maintidx

# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"
# Maximum issues count per one linter.
# Set to 0 to disable.
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
max-same-issues: 0

run:
# Allow multiple parallel golangci-lint instances running.
allow-parallel-runners: true
# Timeout for analysis
timeout: 5m
# files to skip: they will be analyzed, but issues from them won't be reported.
skip-dirs:
- cmd/example/gen
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ KIND := $(TOOLS_BIN_DIR)/kind
KUBECTL := $(TOOLS_BIN_DIR)/kubectl
CLUSTERCTL := $(TOOLS_BIN_DIR)/clusterctl

GOLANGCI_LINT_VERSION := "v1.52.2"
CLUSTERCTL_VERSION := "v1.6.0-rc.1"
GOLANGCI_LINT_VERSION := "v1.55.2"
CLUSTERCTL_VERSION := "v1.6.0"

$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) sigs.k8s.io/controller-tools/cmd/controller-gen
Expand Down
38 changes: 19 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module github.com/projectsveltos/shard-controller

go 1.20
go 1.21

require (
github.com/TwiN/go-color v1.4.1
github.com/fluxcd/source-controller/api v1.1.2
github.com/go-logr/logr v1.3.0
github.com/onsi/ginkgo/v2 v2.13.1
github.com/fluxcd/source-controller/api v1.2.3
github.com/go-logr/logr v1.4.1
github.com/onsi/ginkgo/v2 v2.13.2
github.com/onsi/gomega v1.30.0
github.com/pkg/errors v0.9.1
github.com/projectsveltos/libsveltos v0.20.1-0.20231129081648-ef5be475b0c0
github.com/projectsveltos/libsveltos v0.21.1-0.20240104154531-101b29f82445
github.com/spf13/pflag v1.0.5
golang.org/x/text v0.14.0
k8s.io/api v0.28.4
k8s.io/apiextensions-apiserver v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
k8s.io/component-base v0.28.4
k8s.io/klog/v2 v2.100.1
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/cluster-api v1.6.0-rc.1
k8s.io/api v0.28.5
k8s.io/apiextensions-apiserver v0.28.5
k8s.io/apimachinery v0.28.5
k8s.io/client-go v0.28.5
k8s.io/component-base v0.28.5
k8s.io/klog/v2 v2.110.1
k8s.io/utils v0.0.0-20231127182322-b307cd553661
sigs.k8s.io/cluster-api v1.6.0
sigs.k8s.io/controller-runtime v0.16.3
)

Expand All @@ -31,7 +31,7 @@ require (
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fluxcd/pkg/apis/meta v1.1.2 // indirect
github.com/fluxcd/pkg/apis/meta v1.2.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand Down Expand Up @@ -61,10 +61,10 @@ require (
github.com/prometheus/procfs v0.11.1 // indirect
github.com/spf13/cobra v1.8.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.14.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
Expand All @@ -74,8 +74,8 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/kubectl v0.28.4 // indirect
k8s.io/kubectl v0.28.5 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit 950b20d

Please sign in to comment.