Skip to content

Commit

Permalink
lint: enable -nolintlint and fix findings
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDXY committed Aug 29, 2023
1 parent a604321 commit d942668
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ linters:
- nakedret
- nilerr
- noctx
# - nolintlint
- nolintlint
- nosprintfhostport
- prealloc
- predeclared
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

// Convert_v1beta1_VirtualMachineCloneSpec_To_v1alpha4_VirtualMachineCloneSpec is an autogenerated conversion function.
//
//nolint:golint,revive,stylecheck
//nolint:golint
func Convert_v1beta1_VirtualMachineCloneSpec_To_v1alpha4_VirtualMachineCloneSpec(in *infrav1.VirtualMachineCloneSpec, out *VirtualMachineCloneSpec, s conversion.Scope) error {
return autoConvert_v1beta1_VirtualMachineCloneSpec_To_v1alpha4_VirtualMachineCloneSpec(in, out, s)
}
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha4/vspherecluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:forcetypeassert,golint,revive,stylecheck
//nolint:forcetypeassert,golint
package v1alpha4

import (
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha4/vsphereclusteridentity_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (src *VSphereClusterIdentity) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereClusterIdentity.
func (dst *VSphereClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereClusterIdentity)
return Convert_v1beta1_VSphereClusterIdentity_To_v1alpha4_VSphereClusterIdentity(src, dst, nil)
}
Expand All @@ -41,7 +41,7 @@ func (src *VSphereClusterIdentityList) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts this VSphereClusterIdentityList to the Hub version (v1beta1).
func (dst *VSphereClusterIdentityList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereClusterIdentityList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereClusterIdentityList)
return Convert_v1beta1_VSphereClusterIdentityList_To_v1alpha4_VSphereClusterIdentityList(src, dst, nil)
}
1 change: 0 additions & 1 deletion apis/v1alpha4/vsphereclusteridentity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1alpha4

import (
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha4/vsphereclustertemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (src *VSphereClusterTemplate) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereClusterTemplate.
func (dst *VSphereClusterTemplate) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereClusterTemplate) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereClusterTemplate)
return Convert_v1beta1_VSphereClusterTemplate_To_v1alpha4_VSphereClusterTemplate(src, dst, nil)
}
Expand All @@ -41,7 +41,7 @@ func (src *VSphereClusterTemplateList) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts this VSphereClusterIdentityList to the Hub version (v1beta1).
func (dst *VSphereClusterTemplateList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereClusterTemplateList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereClusterTemplateList)
return Convert_v1beta1_VSphereClusterTemplateList_To_v1alpha4_VSphereClusterTemplateList(src, dst, nil)
}
4 changes: 2 additions & 2 deletions apis/v1alpha4/vspheredeploymentzone_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (src *VSphereDeploymentZone) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereDeploymentZone.
func (dst *VSphereDeploymentZone) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereDeploymentZone) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereDeploymentZone)
return Convert_v1beta1_VSphereDeploymentZone_To_v1alpha4_VSphereDeploymentZone(src, dst, nil)
}
Expand All @@ -41,7 +41,7 @@ func (src *VSphereDeploymentZoneList) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts this VSphereDeploymentZoneList to the Hub version (v1beta1).
func (dst *VSphereDeploymentZoneList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereDeploymentZoneList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereDeploymentZoneList)
return Convert_v1beta1_VSphereDeploymentZoneList_To_v1alpha4_VSphereDeploymentZoneList(src, dst, nil)
}
4 changes: 2 additions & 2 deletions apis/v1alpha4/vspherefailuredomain_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (src *VSphereFailureDomain) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereFailureDomain.
func (dst *VSphereFailureDomain) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereFailureDomain) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereFailureDomain)
return Convert_v1beta1_VSphereFailureDomain_To_v1alpha4_VSphereFailureDomain(src, dst, nil)
}
Expand All @@ -41,7 +41,7 @@ func (src *VSphereFailureDomainList) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts this VSphereFailureDomainList to the Hub version (v1beta1).
func (dst *VSphereFailureDomainList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *VSphereFailureDomainList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.VSphereFailureDomainList)
return Convert_v1beta1_VSphereFailureDomainList_To_v1alpha4_VSphereFailureDomainList(src, dst, nil)
}
2 changes: 1 addition & 1 deletion apis/v1alpha4/vspheremachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:forcetypeassert,golint,revive,stylecheck
//nolint:forcetypeassert,golint
package v1alpha4

import (
Expand Down
4 changes: 1 addition & 3 deletions apis/v1alpha4/vspheremachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:golint,revive,stylecheck
//nolint:golint
package v1alpha4

import (
Expand Down Expand Up @@ -76,14 +76,12 @@ func (dst *VSphereMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error
return Convert_v1beta1_VSphereMachineTemplateList_To_v1alpha4_VSphereMachineTemplateList(src, dst, nil)
}

// nolint
func Convert_v1alpha4_ObjectMeta_To_v1beta1_ObjectMeta(in *clusterv1alpha4.ObjectMeta, out *clusterv1.ObjectMeta, s apiconversion.Scope) error {
// wrapping the conversion func to avoid having compile errors due to compileErrorOnMissingConversion()
// more details at https://github.com/kubernetes/kubernetes/issues/98380
return clusterv1alpha4.Convert_v1alpha4_ObjectMeta_To_v1beta1_ObjectMeta(in, out, s)
}

// nolint
func Convert_v1beta1_ObjectMeta_To_v1alpha4_ObjectMeta(in *clusterv1.ObjectMeta, out *clusterv1alpha4.ObjectMeta, s apiconversion.Scope) error {
// wrapping the conversion func to avoid having compile errors due to compileErrorOnMissingConversion()
// more details at https://github.com/kubernetes/kubernetes/issues/98380
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha4/vspherevm_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:forcetypeassert,golint,revive,stylecheck
//nolint:forcetypeassert,golint
package v1alpha4

import (
Expand Down
4 changes: 0 additions & 4 deletions apis/v1beta1/vspheremachine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ func TestVsphereMachine_Default(t *testing.T) {
g.Expect(m.Spec.Datacenter).To(Equal("*"))
}

//nolint:all
func TestVSphereMachine_ValidateCreate(t *testing.T) {

g := NewWithT(t)
tests := []struct {
name string
Expand Down Expand Up @@ -107,9 +105,7 @@ func TestVSphereMachine_ValidateCreate(t *testing.T) {
}
}

//nolint:all
func TestVSphereMachine_ValidateUpdate(t *testing.T) {

g := NewWithT(t)

tests := []struct {
Expand Down
2 changes: 1 addition & 1 deletion controllers/vmware/test/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func getTestEnv() (*envtest.Environment, *rest.Config) {
utilruntime.Must(vmwarev1.AddToScheme(scheme.Scheme))

// Get the root of the current file to use in CRD paths.
_, filename, _, _ := goruntime.Caller(0) //nolint
_, filename, _, _ := goruntime.Caller(0) //nolint:dogsled
root := path.Join(path.Dir(filename), "..", "..", "..")

localTestEnv := &envtest.Environment{
Expand Down
2 changes: 1 addition & 1 deletion pkg/identity/identity_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func init() {
utilruntime.Must(infrav1.AddToScheme(scheme))
utilruntime.Must(infrav1alpha3.AddToScheme(scheme))

_, filename, _, _ := goruntime.Caller(0) //nolint
_, filename, _, _ := goruntime.Caller(0) //nolint:dogsled
root := path.Join(path.Dir(filename), "..", "..")

crdPaths := []string{
Expand Down
3 changes: 1 addition & 2 deletions pkg/services/govmomi/vcenter/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ limitations under the License.

package vcenter

//nolint:all
//nolint:goimports
import (
ctx "context"
"crypto/tls"
"testing"

"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/simulator"

// run init func to register the tagging API endpoints.
_ "github.com/vmware/govmomi/vapi/simulator"
"github.com/vmware/govmomi/vim25/types"
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/envtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func init() {
utilruntime.Must(infrav1.AddToScheme(scheme))

// Get the root of the current file to use in CRD paths.
_, filename, _, _ := goruntime.Caller(0) //nolint
_, filename, _, _ := goruntime.Caller(0) //nolint:dogsled
root := path.Join(path.Dir(filename), "..", "..")

crdPaths := []string{
Expand Down
3 changes: 1 addition & 2 deletions test/helpers/vcsim/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ limitations under the License.

package vcsim

//nolint:all
//nolint:goimports
import (
"fmt"
"net/url"

"github.com/onsi/gomega/gbytes"
"github.com/vmware/govmomi/simulator"

// run init func to register the tagging API endpoints.
_ "github.com/vmware/govmomi/vapi/simulator"
)
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func appendWebhookConfiguration(configyamlFile []byte, tag string) ([]*v1.Mutati

func initializeWebhookInEnvironment() {
// Get the root of the current file to use in CRD paths.
_, filename, _, _ := goruntime.Caller(0) //nolint
_, filename, _, _ := goruntime.Caller(0) //nolint:dogsled
root := path.Join(path.Dir(filename), "..", "..")
configyamlFile, err := os.ReadFile(filepath.Join(root, "config", "webhook", "manifests.yaml"))
if err != nil {
Expand Down

0 comments on commit d942668

Please sign in to comment.