Skip to content

Commit 6f2f988

Browse files
authored
chore: enable govet fieldalignment (#3027)
1 parent e7eadbb commit 6f2f988

File tree

9 files changed

+30
-26
lines changed

9 files changed

+30
-26
lines changed

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ linters:
105105
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
106106

107107
settings:
108+
govet:
109+
disable-all: true
110+
enable:
111+
- fieldalignment
108112
goconst:
109113
min-len: 5
110114
gosec:

internal/datasource/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func notFound(err error) bool {
6060
}
6161

6262
type TooManyResultsError struct {
63-
Count int
6463
LastRequest interface{}
64+
Count int
6565
}
6666

6767
func (e *TooManyResultsError) Error() string {

internal/meta/meta.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ func (m Meta) ZoneSource() string {
7575

7676
type Config struct {
7777
ProviderSchema *schema.ResourceData
78+
HTTPClient *http.Client
7879
TerraformVersion string
7980
ForceZone scw.Zone
8081
ForceProjectID string
8182
ForceOrganizationID string
8283
ForceAccessKey string
8384
ForceSecretKey string
84-
HTTPClient *http.Client
8585
}
8686

8787
// NewMeta creates the Meta object containing the SDK client.
@@ -247,26 +247,26 @@ func loadProfile(ctx context.Context, d *schema.ResourceData) (*scw.Profile, *Cr
247247
// GetCredentialsSource infers the source of the credentials based on the priority order of the different profiles
248248
func GetCredentialsSource(defaultZoneProfile, activeProfile, providerProfile, envProfile *scw.Profile) *CredentialsSource {
249249
type SourceProfilePair struct {
250-
Source string
251250
Profile *scw.Profile
251+
Source string
252252
}
253253

254254
profilesInOrder := []SourceProfilePair{
255255
{
256-
CredentialsSourceDefault,
257-
defaultZoneProfile,
256+
Source: CredentialsSourceDefault,
257+
Profile: defaultZoneProfile,
258258
},
259259
{
260-
CredentialsSourceActiveProfile,
261-
activeProfile,
260+
Source: CredentialsSourceActiveProfile,
261+
Profile: activeProfile,
262262
},
263263
{
264-
CredentialsSourceProviderProfile,
265-
providerProfile,
264+
Source: CredentialsSourceProviderProfile,
265+
Profile: providerProfile,
266266
},
267267
{
268-
CredentialsSourceEnvironment,
269-
envProfile,
268+
Source: CredentialsSourceEnvironment,
269+
Profile: envProfile,
270270
},
271271
}
272272
credentialsSource := &CredentialsSource{}

internal/services/baremetal/server.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -754,24 +754,24 @@ func validateInstallConfig(ctx context.Context, d *schema.ResourceData, m interf
754754
diags := diag.Diagnostics(nil)
755755

756756
installAttributes := []struct {
757-
Attribute string
758757
Field *baremetal.OSOSField
758+
Attribute string
759759
}{
760760
{
761-
"user",
762-
os.User,
761+
Attribute: "user",
762+
Field: os.User,
763763
},
764764
{
765-
"password",
766-
os.Password,
765+
Attribute: "password",
766+
Field: os.Password,
767767
},
768768
{
769-
"service_user",
770-
os.ServiceUser,
769+
Attribute: "service_user",
770+
Field: os.ServiceUser,
771771
},
772772
{
773-
"service_password",
774-
os.ServicePassword,
773+
Attribute: "service_password",
774+
Field: os.ServicePassword,
775775
},
776776
}
777777
for _, installAttr := range installAttributes {

internal/services/domain/helpers_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
func TestExpandContact(t *testing.T) {
1313
tests := []struct {
14-
name string
1514
contactMap map[string]interface{}
1615
expected *domainSDK.Contact
16+
name string
1717
expectError bool
1818
}{
1919
{
@@ -94,9 +94,9 @@ func TestExpandContact(t *testing.T) {
9494

9595
func TestExpandNewContact(t *testing.T) {
9696
tests := []struct {
97-
name string
9897
contactMap map[string]interface{}
9998
expected *domainSDK.NewContact
99+
name string
100100
expectError bool
101101
}{
102102
{

internal/services/instance/instancehelpers/block.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ type GetUnknownVolumeRequest struct {
5252
}
5353

5454
type ResizeUnknownVolumeRequest struct {
55+
Size *scw.Size
5556
VolumeID string
5657
Zone scw.Zone
57-
Size *scw.Size
5858
}
5959

6060
type DeleteUnknownVolumeRequest struct {

internal/services/instance/instancehelpers/waiters_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
func TestUnknownVolume_VolumeTemplate(t *testing.T) {
1313
tests := []struct {
14-
name string
1514
volume *instancehelpers.UnknownVolume
1615
want *instance.VolumeServerTemplate
16+
name string
1717
}{
1818
{
1919
name: "Root Volume",

internal/services/lb/helpers_lb_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
func TestIsEqualPrivateNetwork(t *testing.T) {
1313
tests := []struct {
14-
name string
1514
A *lbSDK.PrivateNetwork
1615
B *lbSDK.PrivateNetwork
16+
name string
1717
expected bool
1818
}{
1919
{

internal/transport/retry_aws.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ func retryWhen[T any](ctx context.Context, config *RetryWhenConfig[T], shouldRet
5656
}
5757

5858
type RetryWhenConfig[T any] struct {
59+
Function func() (T, error)
5960
Timeout time.Duration
6061
Interval time.Duration
61-
Function func() (T, error)
6262
}
6363

6464
var ErrRetryWhenTimeout = errors.New("timeout reached")

0 commit comments

Comments
 (0)