Skip to content

Commit

Permalink
Upgrade golangci-lint for go1.18 compatibility (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
kovayur authored Nov 7, 2022
1 parent 3cf2981 commit ac4af15
Show file tree
Hide file tree
Showing 83 changed files with 88 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This runs checks to verify if code is properly formatted and that tests (unit and integration against a mocked environment) are passing.
name: Lint & Test
name: Verify & Test

on:
push:
Expand Down Expand Up @@ -57,8 +57,8 @@ env:
TEST_TIMEOUT: 30m

jobs:
lint-test:
name: "Lint & Test"
verify-test:
name: "Verify & Test"
runs-on: ubuntu-latest
services:
postgres:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
echo -n "${{ secrets.POSTGRES_PASSWORD }}" > secrets/db.password
- name: Run Migration Script
run: make db/migrate
- name: Lint & Test
- name: Verify & Test
run: |
export GOPATH=$(go env GOPATH)
export PATH=${PATH}:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args: ["--baseline", ".secrets.baseline"]
exclude: ^pkg/client/redhatsso/api/
- repo: https://github.com/golangci/golangci-lint
rev: v1.46.2
rev: v1.50.1
hooks:
- id: golangci-lint
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This Changelog should be updated for:

### Added
- Data Plane terraforming scripts migration from BitWarden to Parameter Store
- Update go version to 1.18
### Changed
### Deprecated
### Removed
23 changes: 3 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ LOCAL_BIN_PATH := ${PROJECT_PATH}/bin
# for `go generate` to use project-level bin directory binaries first
export PATH := ${LOCAL_BIN_PATH}:$(PATH)

GOLANGCI_LINT ?= $(LOCAL_BIN_PATH)/golangci-lint
golangci-lint:
ifeq (, $(shell which $(LOCAL_BIN_PATH)/golangci-lint 2> /dev/null))
@{ \
set -e ;\
VERSION="v1.43.0" ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$${VERSION}/install.sh | sh -s -- -b ${LOCAL_BIN_PATH} $${VERSION} ;\
}
endif

LOCAL_GOTESTSUM = $(LOCAL_BIN_PATH)/gotestsum
GOTESTSUM ?= $(LOCAL_GOTESTSUM)
gotestsum:
Expand Down Expand Up @@ -304,17 +294,10 @@ verify: check-gopath openapi/validate
.PHONY: verify

# Runs linter against go files and .y(a)ml files in the templates directory
# Requires golangci-lint to be installed @ $(go env GOPATH)/bin/golangci-lint
# Requires pre-commit to be installed: See https://pre-commit.com/index.html for installation instructions.
# and spectral installed via npm
lint: golangci-lint specinstall
$(GOLANGCI_LINT) run \
./cmd/... \
./pkg/... \
./internal/... \
./test/... \
./fleetshard/... \
./probe/...

lint: specinstall
pre-commit run golangci-lint --all-files
spectral lint templates/*.yml templates/*.yaml --ignore-unknown-format --ruleset .validate-templates.yaml
.PHONY: lint

Expand Down
1 change: 1 addition & 0 deletions cmd/fleet-manager/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main ...
package main

import (
Expand Down
1 change: 1 addition & 0 deletions e2e/dns/records_loader.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package dns ...
package dns

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/config/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package config ...
package config

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main ...
package main

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/central/charts/charts.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package charts ...
package charts

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/central/client/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package client ...
package client

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/fleetshardmetrics/metrics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package fleetshardmetrics ...
package fleetshardmetrics

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/k8s/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package k8s ...
package k8s

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package runtime ...
package runtime

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/testutils/k8s.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package testutils ...
package testutils

import (
Expand Down
1 change: 1 addition & 0 deletions fleetshard/pkg/util/hash.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package util ...
package util

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/compat/compat.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package compat ...
package compat

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/constants/central.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package constants ...
package constants

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/api/dbapi/central_request_types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package dbapi ...
package dbapi

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/clusters/cluster_builder.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package clusters ...
package clusters

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/clusters/types/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package types ...
package types

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/cmd/observatorium/cmd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package observatorium ...
package observatorium

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/config/aws.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package config ...
package config

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/converters/cluster.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package converters ...
package converters

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/defaults/default_central_spec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package defaults ...
package defaults

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/dinosaurs/types/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package types ...
package types

import "github.com/stackrox/acs-fleet-manager/pkg/client/ocm"
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/environments/development.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package environments ...
package environments

import "github.com/stackrox/acs-fleet-manager/pkg/environments"
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/handlers/admin_dinosaur.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package handlers ...
package handlers

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/metrics/component_versions.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package metrics ...
package metrics

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package migrations ...
package migrations

// Migrations should NEVER use types from other packages. Types can change
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/presenters/admin_dinosaur.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package presenters ...
package presenters

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/routes/route_loader.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package routes ...
package routes

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/services/cloud_providers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package services ...
package services

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/services/quota/ams_quota_service.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package quota ...
package quota

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/pkg/workers/clusters_mgr.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package workers ...
package workers

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package dinosaurmgrs ...
package dinosaurmgrs

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/providers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package dinosaur ...
package dinosaur

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/routes/constants.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package routes ...
package routes

// Version ...
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/test/common/cluster_pollers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package common ...
package common

import (
Expand Down
1 change: 1 addition & 0 deletions internal/dinosaur/test/helper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package test ...
package test

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package fleetshardsync ...
package fleetshardsync

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/acl/access_control_list.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package acl ...
package acl

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/api/cloud_provider_types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package api ...
package api

// CloudProvider ...
Expand Down
1 change: 1 addition & 0 deletions pkg/api/observability/v1/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package v1 ...
package v1

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/auth/acs_claims.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package auth ...
package auth

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/aws/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package aws ...
package aws

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/fleetmanager/auth.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package fleetmanager ...
package fleetmanager

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/iam/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package iam ...
package iam

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/observatorium/api.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package observatorium ...
package observatorium

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/ocm/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package ocm ...
package ocm

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/redhatsso/dynamicclients/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package dynamicclients ...
package dynamicclients

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/redhatsso/serviceaccounts/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package serviceaccounts ...
package serviceaccounts

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/client/redhatsso/sso_auth_http_client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package redhatsso ...
package redhatsso

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/migrate/cmd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package migrate ...
package migrate

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/serve/cmd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package serve ...
package serve

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/constants/operators.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package constants ...
package constants

// CentralOperatorNamespace ...
Expand Down
1 change: 1 addition & 0 deletions pkg/db/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package db ...
package db

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/environments/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package environments ...
package environments

// EnvName ...
Expand Down
1 change: 1 addition & 0 deletions pkg/errors/errors.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package errors ...
package errors

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/handlers/errors.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package handlers ...
package handlers

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package logger ...
package logger

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package metrics ...
package metrics

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/providers/core.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package providers ...
package providers

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/quotamanagement/account.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package quotamanagement ...
package quotamanagement

// Account ...
Expand Down
1 change: 1 addition & 0 deletions pkg/server/api_server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package server ...
package server

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/server/logging/formatter.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package logging ...
package logging

import "net/http"
Expand Down
1 change: 1 addition & 0 deletions pkg/services/account/account_mock.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package account ...
package account

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/services/authorization/authorization.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package authorization ...
package authorization

import (
Expand Down
Loading

0 comments on commit ac4af15

Please sign in to comment.