Skip to content

Commit

Permalink
Update golangci-lint to v1.26.0 (#152)
Browse files Browse the repository at this point in the history
* dependencies: update golangci-lint to v1.26.0

* golangci-lint: update golangci definitions

* lint: fix lint issues

* update manifests
  • Loading branch information
cpanato authored May 2, 2020
1 parent e75bf8c commit 3a362e4
Show file tree
Hide file tree
Showing 18 changed files with 93 additions and 53 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ linters:
disable:
- dupl
- funlen
- goerr113
- gochecknoglobals
- gochecknoinits
- lll
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha2/docluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
ClusterFinalizer = "docluster.infrastructure.cluster.x-k8s.io"
)

// DOClusterSpec defines the desired state of DOCluster
// DOClusterSpec defines the desired state of DOCluster.
type DOClusterSpec struct {
// The DigitalOcean Region the cluster lives in.
// It must be one of available region on DigitalOcean. See https://developers.digitalocean.com/documentation/v2/#list-all-regions
Expand All @@ -36,7 +36,7 @@ type DOClusterSpec struct {
Network DONetwork `json:"network,omitempty"`
}

// DOClusterStatus defines the observed state of DOCluster
// DOClusterStatus defines the observed state of DOCluster.
type DOClusterStatus struct {
// Ready denotes that the cluster (infrastructure) is ready.
// +optional
Expand All @@ -54,7 +54,7 @@ type DOClusterStatus struct {
// +kubebuilder:storageversion
// +kubebuilder:subresource:status

// DOCluster is the Schema for the dOClusters API
// DOCluster is the Schema for the dOClusters API.
type DOCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -65,7 +65,7 @@ type DOCluster struct {

// +kubebuilder:object:root=true

// DOClusterList contains a list of DOCluster
// DOClusterList contains a list of DOCluster.
type DOClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha2/domachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
MachineFinalizer = "domachine.infrastructure.cluster.x-k8s.io"
)

// DOMachineSpec defines the desired state of DOMachine
// DOMachineSpec defines the desired state of DOMachine.
type DOMachineSpec struct {
// ProviderID is the unique identifier as specified by the cloud provider.
// +optional
Expand All @@ -47,7 +47,7 @@ type DOMachineSpec struct {
AdditionalTags Tags `json:"additionalTags,omitempty"`
}

// DOMachineStatus defines the observed state of DOMachine
// DOMachineStatus defines the observed state of DOMachine.
type DOMachineStatus struct {
// Ready is true when the provider resource is ready.
// +optional
Expand Down Expand Up @@ -100,7 +100,7 @@ type DOMachineStatus struct {
// +kubebuilder:storageversion
// +kubebuilder:subresource:status

// DOMachine is the Schema for the domachines API
// DOMachine is the Schema for the domachines API.
type DOMachine struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -111,7 +111,7 @@ type DOMachine struct {

// +kubebuilder:object:root=true

// DOMachineList contains a list of DOMachine
// DOMachineList contains a list of DOMachine.
type DOMachineList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/domachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// DOMachineTemplateSpec defines the desired state of DOMachineTemplate
// DOMachineTemplateSpec defines the desired state of DOMachineTemplate.
type DOMachineTemplateSpec struct {
Template DOMachineTemplateResource `json:"template"`
}
Expand All @@ -29,7 +29,7 @@ type DOMachineTemplateSpec struct {
// +kubebuilder:resource:path=domachinetemplates,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion

// DOMachineTemplate is the Schema for the domachinetemplates API
// DOMachineTemplate is the Schema for the domachinetemplates API.
type DOMachineTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -39,7 +39,7 @@ type DOMachineTemplate struct {

// +kubebuilder:object:root=true

// DOMachineTemplateList contains a list of DOMachineTemplate
// DOMachineTemplateList contains a list of DOMachineTemplate.
type DOMachineTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha2/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ const (
)

// ClusterNameTag generates the tag with prefix `NameDigitalOceanProviderPrefix`
// for resources associated with a cluster. It will generated tag like `sigs-k8s-io:capdo:{clusterName}`
// for resources associated with a cluster. It will generated tag like `sigs-k8s-io:capdo:{clusterName}`.
func ClusterNameTag(clusterName string) string {
return fmt.Sprintf("%s:%s", NameDigitalOceanProviderPrefix, clusterName)
}

// ClusterNameRoleTag generates the tag with prefix `NameDigitalOceanProviderPrefix` and `RoleValue` as suffix
// It will generated tag like `sigs-k8s-io:capdo:{clusterName}:{role}`
// It will generated tag like `sigs-k8s-io:capdo:{clusterName}:{role}`.
func ClusterNameRoleTag(clusterName, role string) string {
return fmt.Sprintf("%s:%s:%s", NameDigitalOceanProviderPrefix, clusterName, role)
}

// NameTagFromName returns DigitalOcean safe name tag from name
// NameTagFromName returns DigitalOcean safe name tag from name.
func NameTagFromName(name string) string {
return fmt.Sprintf("name:%s", DOSafeName(name))
}
Expand All @@ -63,7 +63,7 @@ type BuildTagParams struct {
Additional Tags
}

// Build builds tags including the cluster tag and returns them in map form.
// BuildTags builds tags including the cluster tag and returns them in map form.
func BuildTags(params BuildTagParams) Tags {
var tags Tags
tags = append(tags, ClusterNameTag(params.ClusterName))
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type DONetworkResource struct {
APIServerLoadbalancersRef DOResourceReference `json:"apiServerLoadbalancersRef,omitempty"`
}

// DOMachineTemplateResource describes the data needed to create am DOMachine from a template
// DOMachineTemplateResource describes the data needed to create am DOMachine from a template.
type DOMachineTemplateResource struct {
// Spec is the specification of the desired behavior of the machine.
Spec DOMachineSpec `json:"spec"`
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (s *ClusterScope) Network() *infrav1.DONetworkResource {
return &s.DOCluster.Status.Network
}

// SetReady sets the DOCluster Ready Status
// SetReady sets the DOCluster Ready Status.
func (s *ClusterScope) SetReady() {
s.DOCluster.Status.Ready = true
}
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (m *MachineScope) SetInstanceStatus(v infrav1.DOResourceStatus) {
m.DOMachine.Status.InstanceStatus = &v
}

// SetReady sets the DOMachine Ready Status
// SetReady sets the DOMachine Ready Status.
func (m *MachineScope) SetReady() {
m.DOMachine.Status.Ready = true
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/services/computes/droplets.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
corev1 "k8s.io/api/core/v1"
)

// GetDroplet get a droplet instance
// GetDroplet get a droplet instance.
func (s *Service) GetDroplet(id string) (*godo.Droplet, error) {
if id == "" {
s.scope.Info("DOMachine does not have an instance id")
Expand Down Expand Up @@ -135,7 +135,7 @@ func (s *Service) DeleteDroplet(id string) error {
return nil
}

// GetDropletAddress convert droplet IPs to corev1.NodeAddresses
// GetDropletAddress convert droplet IPs to corev1.NodeAddresses.
func (s *Service) GetDropletAddress(droplet *godo.Droplet) ([]corev1.NodeAddress, error) {
addresses := []corev1.NodeAddress{}
privatev4, err := droplet.PrivateIPv4()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: DOCluster is the Schema for the dOClusters API
description: DOCluster is the Schema for the dOClusters API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -36,7 +36,7 @@ spec:
metadata:
type: object
spec:
description: DOClusterSpec defines the desired state of DOCluster
description: DOClusterSpec defines the desired state of DOCluster.
properties:
network:
description: Network configurations
Expand Down Expand Up @@ -105,7 +105,7 @@ spec:
- region
type: object
status:
description: DOClusterStatus defines the observed state of DOCluster
description: DOClusterStatus defines the observed state of DOCluster.
properties:
apiEndpoints:
description: APIEndpoints represents the endpoints to communicate with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: DOMachine is the Schema for the domachines API
description: DOMachine is the Schema for the domachines API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -36,7 +36,7 @@ spec:
metadata:
type: object
spec:
description: DOMachineSpec defines the desired state of DOMachine
description: DOMachineSpec defines the desired state of DOMachine.
properties:
additionalTags:
description: AdditionalTags is an optional set of tags to add to DigitalOcean
Expand Down Expand Up @@ -73,7 +73,7 @@ spec:
- sshKeys
type: object
status:
description: DOMachineStatus defines the observed state of DOMachine
description: DOMachineStatus defines the observed state of DOMachine.
properties:
addresses:
description: Addresses contains the DigitalOcean droplet associated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
scope: Namespaced
validation:
openAPIV3Schema:
description: DOMachineTemplate is the Schema for the domachinetemplates API
description: DOMachineTemplate is the Schema for the domachinetemplates API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -34,11 +34,11 @@ spec:
metadata:
type: object
spec:
description: DOMachineTemplateSpec defines the desired state of DOMachineTemplate
description: DOMachineTemplateSpec defines the desired state of DOMachineTemplate.
properties:
template:
description: DOMachineTemplateResource describes the data needed to
create am DOMachine from a template
create am DOMachine from a template.
properties:
spec:
description: Spec is the specification of the desired behavior of
Expand Down
2 changes: 1 addition & 1 deletion controllers/docluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

// DOClusterReconciler reconciles a DOCluster object
// DOClusterReconciler reconciles a DOCluster object.
type DOClusterReconciler struct {
client.Client
Log logr.Logger
Expand Down
2 changes: 1 addition & 1 deletion controllers/domachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/source"
)

// DOMachineReconciler reconciles a DOMachine object
// DOMachineReconciler reconciles a DOMachine object.
type DOMachineReconciler struct {
client.Client
Log logr.Logger
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.13

require (
github.com/golang/mock v1.4.3
github.com/golangci/golangci-lint v1.23.1
github.com/golangci/golangci-lint v1.26.0
k8s.io/code-generator v0.17.2
sigs.k8s.io/cluster-api/hack/tools v0.0.0-20200122215034-ee0b0eb29a57
sigs.k8s.io/controller-tools v0.2.4
Expand Down
Loading

0 comments on commit 3a362e4

Please sign in to comment.