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

Upgrade GolangCI-lint to v1.48.0 #427

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 .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ issues:
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.47.x # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.48.x # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COMMON_GO_ARGS=-race
GIT_COMMIT=$(shell script/create-version-files.sh)
GIT_RELEASE=$(shell script/get-git-release.sh)
GIT_PREVIOUS_RELEASE=$(shell script/get-git-previous-release.sh)
GOLANGCI_VERSION=v1.47.3
GOLANGCI_VERSION=v1.48.0
LINKER_TNF_RELEASE_FLAGS=-X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitCommit=${GIT_COMMIT}
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitRelease=${GIT_RELEASE}
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitPreviousRelease=${GIT_PREVIOUS_RELEASE}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ At a minimum, the following dependencies must be installed *prior* to running `m
Dependency|Minimum Version
---|---
[GoLang](https://golang.org/dl/)|1.18
[golangci-lint](https://golangci-lint.run/usage/install/)|1.47.0
[golangci-lint](https://golangci-lint.run/usage/install/)|1.48.0
[jq](https://stedolan.github.io/jq/)|1.6
[OpenShift Client](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)|4.7

Expand Down
21 changes: 11 additions & 10 deletions cmd/tnf/generate/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ func emitTextFromFile(filename string) error {
// createPrintableCatalogFromIdentifiers creates an structured catalogue.
// Decompose claim.Identifier urls like http://test-network-function.com/testcases/SuiteName/TestName
// to get SuiteNames and TestNames and build a "more printable" catalogue in the way of:
// {
// suiteNameA: [
// {testName, identifier{url, version}},
// {testName2, identifier{url, version}}
// ]
// suiteNameB: [
// {testName3, identifier{url, version}},
// {testName4, identifier{url, version}}
// ]
// }
//
// {
// suiteNameA: [
// {testName, identifier{url, version}},
// {testName2, identifier{url, version}}
// ]
// suiteNameB: [
// {testName3, identifier{url, version}},
// {testName4, identifier{url, version}}
// ]
// }
func createPrintableCatalogFromIdentifiers(keys []claim.Identifier) map[string][]catalogElement {
catalog := make(map[string][]catalogElement)
// we need the list of suite's names
Expand Down
2 changes: 2 additions & 0 deletions cnf-certification-test/accesscontrol/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ func TestPodServiceAccount(env *provider.TestEnvironment) {
}

// TestPodRoleBindings verifies that the pod utilizes a valid role binding that does not cross namespaces
//
//nolint:dupl
func TestPodRoleBindings(env *provider.TestEnvironment) {
ginkgo.By("Should not have RoleBinding in other namespaces")
Expand Down Expand Up @@ -396,6 +397,7 @@ func TestPodRoleBindings(env *provider.TestEnvironment) {
}

// TestPodClusterRoleBindings verifies that the pod utilizes a valid cluster role binding that does not cross namespaces
//
//nolint:dupl
func TestPodClusterRoleBindings(env *provider.TestEnvironment) {
ginkgo.By("Should not have ClusterRoleBinding in other namespaces")
Expand Down
3 changes: 2 additions & 1 deletion cnf-certification-test/chaostesting/pod_delete/pod_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ func parseLitmusResult(crs *unstructured.UnstructuredList) bool {

// createResource is a helper function that uses a yaml decoder to create in the cluster
// all the resources defined in the underlying yaml file.
//nolint:funlen //
//
//nolint:funlen
func createResource(decoder *yamlutil.YAMLOrJSONDecoder) error {
oc := clientsholder.GetClientsHolder()
k8sClient := oc.K8sClient
Expand Down
2 changes: 0 additions & 2 deletions cnf-certification-test/lifecycle/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ const (
minWorkerNodesForLifecycle = 2
)

//
// All actual test code belongs below here. Utilities belong above.
//
var _ = ginkgo.Describe(common.LifecycleTestKey, func() {
var env provider.TestEnvironment
ginkgo.BeforeEach(func() {
Expand Down
2 changes: 0 additions & 2 deletions cnf-certification-test/networking/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ type Port []struct {
Protocol string
}

//
// All actual test code belongs below here. Utilities belong above.
//
var _ = ginkgo.Describe(common.NetworkingTestKey, func() {
logrus.Debugf("Entering %s suite", common.NetworkingTestKey)

Expand Down
2 changes: 0 additions & 2 deletions cnf-certification-test/observability/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ import (
policyv1 "k8s.io/api/policy/v1"
)

//
// All actual test code belongs below here. Utilities belong above.
//
var _ = ginkgo.Describe(common.ObservabilityTestKey, func() {
var env provider.TestEnvironment
ginkgo.BeforeEach(func() {
Expand Down
2 changes: 0 additions & 2 deletions cnf-certification-test/operator/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//
// All actual test code belongs below here. Utilities belong above.
//
var _ = ginkgo.Describe(common.OperatorTestKey, func() {
var env provider.TestEnvironment
ginkgo.BeforeEach(func() {
Expand Down
4 changes: 3 additions & 1 deletion cnf-certification-test/platform/cnffsdiff/fsdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ var (

// fsDiffJSON is a helper struct to unmarshall the "podman diff --format json" output: a slice of
// folders/filepaths (strings) for each event type changed/added/deleted:
// {"changed": ["folder1, folder2"], added": ["folder5", "folder6"], "deleted": ["folder3", "folder4"]"}
//
// {"changed": ["folder1, folder2"], added": ["folder5", "folder6"], "deleted": ["folder3", "folder4"]"}
//
// We'll only care about deleted and changed types, though, as in case a folder/file is created to any of them,
// there will be two entries, one for the "added" and another for the "changed".
type fsDiffJSON struct {
Expand Down
2 changes: 0 additions & 2 deletions cnf-certification-test/platform/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const (
istioContainerName = "istio-proxy"
)

//
// All actual test code belongs below here. Utilities belong above.
//
var _ = ginkgo.Describe(common.PlatformAlterationTestKey, func() {
logrus.Debugf("Entering %s suite", common.PlatformAlterationTestKey)
var env provider.TestEnvironment
Expand Down
1 change: 1 addition & 0 deletions internal/clientsholder/clientsholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func SetupFakeOlmClient(olmMockObjects []runtime.Object) {
// Only pure k8s interfaces will be available. The runtime objects must be pure k8s ones.
// For other (OLM, )
// runtime mocking objects loading, use the proper clientset mocking function.
//
//nolint:funlen
func GetTestClientsHolder(k8sMockObjects []runtime.Object, filenames ...string) *ClientsHolder {
// Build slices of different objects depending on what client
Expand Down
3 changes: 2 additions & 1 deletion pkg/autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ func buildLabelKeyValue(label configuration.Label) (key, value string) {
return key, value
}

//nolint:funlen
// DoAutoDiscover finds objects under test
//
//nolint:funlen
func DoAutoDiscover() DiscoveredTestData {
data.Env = *configuration.GetTestParameters()

Expand Down
6 changes: 0 additions & 6 deletions pkg/autodiscover/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ package autodiscover

const (
defaultNamespace = "default"
// debugDaemonSet = "debug"
debugLabelPrefix = "test-network-function.com"
debugLabelName = "app"
debugLabelValue = "debug"

// nodeLabelName = "test-network-function.com/node"
// nodeLabelValue = "target"
// addlabelCommand = "oc label node %s %s=%s --overwrite=true"
// deletelabelCommand = "oc label node %s %s- --overwrite=true"
)
1 change: 0 additions & 1 deletion pkg/claimhelper/claimhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func WriteClaimOutput(claimOutputFile string, payload []byte) {
}
}

//no-lint:commentedOutCode
func GenerateNodes() map[string]interface{} {
const (
nodeSummaryField = "nodeSummary"
Expand Down
1 change: 1 addition & 0 deletions pkg/loghelper/loghelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type CuratedLogLines struct {
}

// AddLogLine checks a slice for a given string.
//
//nolint:goprintffuncname
func (list *CuratedLogLines) AddLogLine(format string, args ...interface{}) {
message := fmt.Sprintf(format+"\n", args...)
Expand Down