Skip to content

chore: enable govet fieldalignment #3027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion internal/datasource/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func notFound(err error) bool {
}

type TooManyResultsError struct {
Count int
LastRequest interface{}
Count int
}

func (e *TooManyResultsError) Error() string {
Expand Down
20 changes: 10 additions & 10 deletions internal/meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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{}
Expand Down
18 changes: 9 additions & 9 deletions internal/services/baremetal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions internal/services/domain/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}{
{
Expand Down Expand Up @@ -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
}{
{
Expand Down
2 changes: 1 addition & 1 deletion internal/services/instance/instancehelpers/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ type GetUnknownVolumeRequest struct {
}

type ResizeUnknownVolumeRequest struct {
Size *scw.Size
VolumeID string
Zone scw.Zone
Size *scw.Size
}

type DeleteUnknownVolumeRequest struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/lb/helpers_lb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

func TestIsEqualPrivateNetwork(t *testing.T) {
tests := []struct {
name string
A *lbSDK.PrivateNetwork
B *lbSDK.PrivateNetwork
name string
expected bool
}{
{
Expand Down
2 changes: 1 addition & 1 deletion internal/transport/retry_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Loading