diff --git a/.golangci.yml b/.golangci.yml index 0ba66d6789..74daa9c348 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -105,6 +105,10 @@ linters: - varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false] settings: + govet: + disable-all: true + enable: + - fieldalignment goconst: min-len: 5 gosec: diff --git a/internal/datasource/search.go b/internal/datasource/search.go index ebe96c35ab..ec71b44169 100644 --- a/internal/datasource/search.go +++ b/internal/datasource/search.go @@ -60,8 +60,8 @@ func notFound(err error) bool { } type TooManyResultsError struct { - Count int LastRequest interface{} + Count int } func (e *TooManyResultsError) Error() string { diff --git a/internal/meta/meta.go b/internal/meta/meta.go index 084b18991f..aeb16ffb5b 100644 --- a/internal/meta/meta.go +++ b/internal/meta/meta.go @@ -75,13 +75,13 @@ func (m Meta) ZoneSource() string { type Config struct { ProviderSchema *schema.ResourceData + HTTPClient *http.Client TerraformVersion string ForceZone scw.Zone ForceProjectID string ForceOrganizationID string ForceAccessKey string ForceSecretKey string - HTTPClient *http.Client } // NewMeta creates the Meta object containing the SDK client. @@ -247,26 +247,26 @@ func loadProfile(ctx context.Context, d *schema.ResourceData) (*scw.Profile, *Cr // GetCredentialsSource infers the source of the credentials based on the priority order of the different profiles func GetCredentialsSource(defaultZoneProfile, activeProfile, providerProfile, envProfile *scw.Profile) *CredentialsSource { type SourceProfilePair struct { - Source string Profile *scw.Profile + Source string } profilesInOrder := []SourceProfilePair{ { - CredentialsSourceDefault, - defaultZoneProfile, + Source: CredentialsSourceDefault, + Profile: defaultZoneProfile, }, { - CredentialsSourceActiveProfile, - activeProfile, + Source: CredentialsSourceActiveProfile, + Profile: activeProfile, }, { - CredentialsSourceProviderProfile, - providerProfile, + Source: CredentialsSourceProviderProfile, + Profile: providerProfile, }, { - CredentialsSourceEnvironment, - envProfile, + Source: CredentialsSourceEnvironment, + Profile: envProfile, }, } credentialsSource := &CredentialsSource{} diff --git a/internal/services/baremetal/server.go b/internal/services/baremetal/server.go index cd59797fad..f144bacffa 100644 --- a/internal/services/baremetal/server.go +++ b/internal/services/baremetal/server.go @@ -734,24 +734,24 @@ func validateInstallConfig(ctx context.Context, d *schema.ResourceData, m interf diags := diag.Diagnostics(nil) installAttributes := []struct { - Attribute string Field *baremetal.OSOSField + Attribute string }{ { - "user", - os.User, + Attribute: "user", + Field: os.User, }, { - "password", - os.Password, + Attribute: "password", + Field: os.Password, }, { - "service_user", - os.ServiceUser, + Attribute: "service_user", + Field: os.ServiceUser, }, { - "service_password", - os.ServicePassword, + Attribute: "service_password", + Field: os.ServicePassword, }, } for _, installAttr := range installAttributes { diff --git a/internal/services/domain/helpers_test.go b/internal/services/domain/helpers_test.go index fb47d95106..e0e42e8e8c 100644 --- a/internal/services/domain/helpers_test.go +++ b/internal/services/domain/helpers_test.go @@ -11,9 +11,9 @@ import ( func TestExpandContact(t *testing.T) { tests := []struct { - name string contactMap map[string]interface{} expected *domainSDK.Contact + name string expectError bool }{ { @@ -94,9 +94,9 @@ func TestExpandContact(t *testing.T) { func TestExpandNewContact(t *testing.T) { tests := []struct { - name string contactMap map[string]interface{} expected *domainSDK.NewContact + name string expectError bool }{ { diff --git a/internal/services/instance/instancehelpers/block.go b/internal/services/instance/instancehelpers/block.go index 7456afb1c0..4e4b581c69 100644 --- a/internal/services/instance/instancehelpers/block.go +++ b/internal/services/instance/instancehelpers/block.go @@ -52,9 +52,9 @@ type GetUnknownVolumeRequest struct { } type ResizeUnknownVolumeRequest struct { + Size *scw.Size VolumeID string Zone scw.Zone - Size *scw.Size } type DeleteUnknownVolumeRequest struct { diff --git a/internal/services/instance/instancehelpers/waiters_test.go b/internal/services/instance/instancehelpers/waiters_test.go index de24528c0a..24751fab6d 100644 --- a/internal/services/instance/instancehelpers/waiters_test.go +++ b/internal/services/instance/instancehelpers/waiters_test.go @@ -11,9 +11,9 @@ import ( func TestUnknownVolume_VolumeTemplate(t *testing.T) { tests := []struct { - name string volume *instancehelpers.UnknownVolume want *instance.VolumeServerTemplate + name string }{ { name: "Root Volume", diff --git a/internal/services/lb/helpers_lb_test.go b/internal/services/lb/helpers_lb_test.go index 3468c37dc4..811b50be25 100644 --- a/internal/services/lb/helpers_lb_test.go +++ b/internal/services/lb/helpers_lb_test.go @@ -11,9 +11,9 @@ import ( func TestIsEqualPrivateNetwork(t *testing.T) { tests := []struct { - name string A *lbSDK.PrivateNetwork B *lbSDK.PrivateNetwork + name string expected bool }{ { diff --git a/internal/transport/retry_aws.go b/internal/transport/retry_aws.go index c724cf55c3..0afa9f1c74 100644 --- a/internal/transport/retry_aws.go +++ b/internal/transport/retry_aws.go @@ -56,9 +56,9 @@ func retryWhen[T any](ctx context.Context, config *RetryWhenConfig[T], shouldRet } type RetryWhenConfig[T any] struct { + Function func() (T, error) Timeout time.Duration Interval time.Duration - Function func() (T, error) } var ErrRetryWhenTimeout = errors.New("timeout reached")