Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
damdo committed Oct 14, 2024
1 parent 8dbaa6e commit 751ce4e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: v1.58
version: v1.61
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ issues:
- linters:
- gosec
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
- linters:
- gosec
text: "G115: integer overflow conversion int -> int32"
- linters:
- govet
text: "printf: non-constant format string in call to sigs.k8s.io/cluster-api/util/conditions.MarkFalse"
- linters:
- revive
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/managedcontrolplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (s *ManagedControlPlaneScope) GetCredential() *Credential {

// GetAllNodePools gets all node pools for the control plane.
func (s *ManagedControlPlaneScope) GetAllNodePools(ctx context.Context) ([]infrav1exp.GCPManagedMachinePool, []clusterv1exp.MachinePool, error) {
if s.AllManagedMachinePools == nil || len(s.AllManagedMachinePools) == 0 {
if len(s.AllManagedMachinePools) == 0 {
listOptions := []client.ListOption{
client.InNamespace(s.GCPManagedControlPlane.Namespace),
client.MatchingLabels(map[string]string{clusterv1.ClusterNameLabel: s.Cluster.Name}),
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/managedmachinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func ConvertToSdkNodePool(nodePool infrav1exp.GCPManagedMachinePool, machinePool
sdkNodePool.Config.DiskType = string(*nodePool.Spec.DiskType)
}
if nodePool.Spec.DiskSizeGB != nil {
sdkNodePool.Config.DiskSizeGb = int32(*nodePool.Spec.DiskSizeGB)
sdkNodePool.Config.DiskSizeGb = int32(*nodePool.Spec.DiskSizeGB) //nolint:gosec
}
if len(nodePool.Spec.NodeNetwork.Tags) != 0 {
sdkNodePool.Config.Tags = nodePool.Spec.NodeNetwork.Tags
Expand Down
3 changes: 1 addition & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ func init() {
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)
// fetch the current config
suiteConfig, reporterConfig := GinkgoConfiguration()
_, reporterConfig := GinkgoConfiguration()
// adjust it
suiteConfig.FailFast = true
reporterConfig.FullTrace = true
RunSpecs(t, "Controller Suite", reporterConfig)
}
Expand Down
2 changes: 1 addition & 1 deletion exp/api/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestAPIs(t *testing.T) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

ctx, cancel = context.WithCancel(context.TODO())
ctx, cancel = context.WithCancel(context.TODO()) //nolint:fatcontext

By("bootstrapping test environment")
testEnv = &envtest.Environment{
Expand Down
2 changes: 1 addition & 1 deletion exp/controllers/gcpmanagedcontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
Namespace: gcpManagedControlPlane.Namespace,
Name: cluster.Spec.InfrastructureRef.Name,
}
if err := r.Client.Get(ctx, key, managedCluster); err != nil || managedCluster == nil {
if err := r.Client.Get(ctx, key, managedCluster); err != nil {
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
return ctrl.Result{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion exp/controllers/gcpmanagedmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
Name: cluster.Spec.InfrastructureRef.Name,
}
gcpManagedCluster := &infrav1exp.GCPManagedCluster{}
if err := r.Client.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil || gcpManagedCluster == nil {
if err := r.Client.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil {
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
return ctrl.Result{}, err
}
Expand Down

0 comments on commit 751ce4e

Please sign in to comment.