Skip to content

Commit

Permalink
chore: Update build system
Browse files Browse the repository at this point in the history
* Use Go v1.21.2
** Add ignore opts to some tests because they failed due to the
   unexported context.backgroundCtx struct
* Bump golangci-lint to v1.54.0
* Bump build submodule

Copy (most of) .golancilint.yml from github.com/crossplane/crossplane
and fix the linter issues accordingly.

Go import order is now
1. Go standard packages
2. 3rd party packages
3. local packages

Signed-off-by: Maximilian Blatt (external expert on behalf of DB Netz) <[email protected]>
Co-authored-by: ivan katliarchuk <[email protected]>
  • Loading branch information
MisterMX and ivankatliarchuk committed Oct 10, 2023
1 parent 5833eb9 commit 5e2d8dd
Show file tree
Hide file tree
Showing 448 changed files with 1,369 additions and 1,741 deletions.
182 changes: 129 additions & 53 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

44 changes: 33 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ linters-settings:
# report about shadowed variables
check-shadowing: false

golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8

gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true

goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/crossplane-contrib/provider-aws
gci:
custom-order: true
sections:
- standard
- default
- prefix(github.com/crossplane-contrib/provider-aws)

gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
Expand Down Expand Up @@ -102,21 +100,40 @@ linters-settings:
rangeValCopy:
sizeThreshold: 32

nolintlint:
require-explanation: false
require-specific: true

revive:
rules:
- name: package-comments
disabled: true


linters:
enable:
- megacheck
- govet
- gocyclo
- gocritic
- interfacer
- goconst
- goimports
- gci
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- golint
- revive
- unconvert
- misspell
- nakedret
- nolintlint

disable:
# These linters are all deprecated as of golangci-lint v1.49.0. We disable
# them explicitly to avoid the linter logging deprecation warnings.
- deadcode
- varcheck
- scopelint
- structcheck
- interfacer

presets:
- bugs
Expand Down Expand Up @@ -174,6 +191,11 @@ issues:
- gosec
- gas

# Some k8s dependencies do not have JSON tags on all fields in structs.
- path: k8s.io/
linters:
- musttag

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
1 change: 0 additions & 1 deletion CODE_GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ package globalaccelerator
import (
ctrl "sigs.k8s.io/controller-runtime"
"github.com/crossplane/crossplane-runtime/pkg/controller"
"github.com/crossplane-contrib/provider-aws/pkg/controller/globalaccelerator/accelerator"
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
GO_LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION)
GO_SUBDIRS += cmd pkg apis
GO111MODULE = on
GOLANGCILINT_VERSION = 1.54.2
-include build/makelib/golang.mk

# ====================================================================================
Expand Down
4 changes: 2 additions & 2 deletions apis/apigatewayv2/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"fmt"
"strings"

ec2 "github.com/crossplane-contrib/provider-aws/apis/ec2/v1beta1"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/crossplane/crossplane-runtime/pkg/reference"
resource "github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

ec2 "github.com/crossplane-contrib/provider-aws/apis/ec2/v1beta1"
)

// ResolveReferences of this Stage
Expand Down
3 changes: 1 addition & 2 deletions apis/batch/manualv1alpha1/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package manualv1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ArrayProperties define an Batch array job.
Expand Down
3 changes: 1 addition & 2 deletions apis/batch/manualv1alpha1/jobdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package manualv1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// FargatePlatformConfiguration defines the platform configuration for jobs that are running on Fargate resources.
Expand Down
3 changes: 1 addition & 2 deletions apis/cache/v1alpha1/cachecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// CacheCluster states.
Expand Down
3 changes: 1 addition & 2 deletions apis/cache/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ package v1beta1
import (
"context"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/reference"

"github.com/crossplane-contrib/provider-aws/apis/cache/v1alpha1"
"github.com/crossplane-contrib/provider-aws/apis/ec2/v1beta1"
sns "github.com/crossplane-contrib/provider-aws/apis/sns/v1beta1"
Expand Down
3 changes: 1 addition & 2 deletions apis/cache/v1beta1/replication_group_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ReplicationGroup states.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package manualv1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ExternalAnnotation defines a virtual external name annotation for importing existing resources.
Expand Down
3 changes: 1 addition & 2 deletions apis/database/v1beta1/dbsubnetgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// DBSubnetGroupStateAvailable states that a DBSubnet Group is healthy and available
Expand Down
3 changes: 1 addition & 2 deletions apis/database/v1beta1/rdsinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// SQL database engines.
Expand Down
3 changes: 1 addition & 2 deletions apis/docdb/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ package v1alpha1
import (
"context"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/reference"

ec2 "github.com/crossplane-contrib/provider-aws/apis/ec2/v1beta1"
kms "github.com/crossplane-contrib/provider-aws/apis/kms/v1alpha1"
)
Expand Down
3 changes: 1 addition & 2 deletions apis/dynamodb/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ package v1alpha1
import (
"context"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/reference"
)

// ResolveReferences of this Backup
Expand Down
1 change: 0 additions & 1 deletion apis/ec2/manualv1alpha1/securitygrouprule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package manualv1alpha1

import (
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/manualv1alpha1/vpccidrblock_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package manualv1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// VPCCIDRBlockParameters define the desired state of an VPC CIDR Block
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/address_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// AddressParameters define the desired state of an AWS Elastic IP
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/internetgateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// AWS returns 'available` hence ec2.AttachmentStatusAttached doesn't work
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/natgateway_types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// Defines the states of NatGateway
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/routetable_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ToDo (haarchri): changed Route to RouteBeta otherwise we got error "CRD for Route.ec2.aws.crossplane.io has no storage version"
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/securitygroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// SecurityGroupParameters define the desired state of an AWS VPC Security
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// SubnetParameters define the desired state of an AWS VPC Subnet.
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/vpc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// VPCCIDRBlockState represents the state of a CIDR Block
Expand Down
3 changes: 1 addition & 2 deletions apis/ec2/v1beta1/vpccidrblock_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// VPCCIDRBlockParameters define the desired state of an VPC CIDR Block
Expand Down
3 changes: 1 addition & 2 deletions apis/ecr/v1alpha1/policy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// RepositoryPolicyParameters define the desired state of an AWS Elastic Container Repository
Expand Down
3 changes: 1 addition & 2 deletions apis/ecr/v1alpha1/repository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// RepositoryParameters define the desired state of an AWS Elastic Container Repository
Expand Down
3 changes: 1 addition & 2 deletions apis/ecr/v1beta1/policy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// RepositoryPolicyParameters define the desired state of an AWS Elastic Container Repository
Expand Down
3 changes: 1 addition & 2 deletions apis/ecr/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"context"
"fmt"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/reference"

iamv1beta1 "github.com/crossplane-contrib/provider-aws/apis/iam/v1beta1"
)

Expand Down
3 changes: 1 addition & 2 deletions apis/ecr/v1beta1/repository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// RepositoryParameters define the desired state of an AWS Elastic Container Repository
Expand Down
Loading

0 comments on commit 5e2d8dd

Please sign in to comment.