Skip to content

Commit c71e646

Browse files
committed
refactor: autofix by golangci-lint
1 parent 5905d56 commit c71e646

22 files changed

+131
-36
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* build(deps): update `github.com/golang-jwt/jwt` from v4 to v5
77
* refactor: replace `errgo` with `github.com/Scalingo/go-utils/errors/v3` (breaking change)
88
* feat(logs): `LogsURL` returns a parsed structure (breaking change)
9-
* refactor: autofix by `go fix`
9+
* refactor: autofix by `go fix` and `golangci-lint`
1010

1111
## 9.2.0
1212

alerts_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package scalingo
22

33
import (
4-
"context"
54
"encoding/json"
65
"net/http"
76
"net/http/httptest"
@@ -13,7 +12,7 @@ import (
1312
)
1413

1514
func TestAlertsClient(t *testing.T) {
16-
ctx := context.Background()
15+
ctx := t.Context()
1716
const appName = "my-app"
1817
alertID := "my-id"
1918

apps_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package scalingo
22

33
import (
44
"bytes"
5-
"context"
65
"encoding/json"
76
"net/http"
87
"net/http/httptest"
@@ -14,7 +13,7 @@ import (
1413
)
1514

1615
func TestAppsClient_Update(t *testing.T) {
17-
ctx := context.Background()
16+
ctx := t.Context()
1817
const appName = "my-app"
1918

2019
runs := map[string]struct {

cron_tasks_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package scalingo
22

33
import (
4-
"context"
54
"encoding/json"
65
"net/http"
76
"net/http/httptest"
@@ -13,7 +12,7 @@ import (
1312
)
1413

1514
func TestCronTasksClient_CronTasksGet(t *testing.T) {
16-
ctx := context.Background()
15+
ctx := t.Context()
1716
const appName = "my-app"
1817

1918
tests := []struct {

domains_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package scalingo
22

33
import (
44
"bytes"
5-
"context"
65
"encoding/json"
76
"net/http"
87
"net/http/httptest"
@@ -14,7 +13,7 @@ import (
1413
)
1514

1615
func TestDomainsClient_Domain_Updates(t *testing.T) {
17-
ctx := context.Background()
16+
ctx := t.Context()
1817
appName := "my-app"
1918
domainID := "domain-id"
2019

events_account.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "fmt"
44

55
type EventLoginSuccessType struct {
66
Event
7+
78
TypeData EventLoginSuccessTypeData `json:"type_data"`
89
}
910
type EventLoginSuccessTypeData EventSecurityTypeData
@@ -14,6 +15,7 @@ func (ev *EventLoginSuccessType) String() string {
1415

1516
type EventLoginFailureType struct {
1617
Event
18+
1719
TypeData EventLoginFailureTypeData `json:"type_data"`
1820
}
1921
type EventLoginFailureTypeData EventSecurityTypeData
@@ -24,6 +26,7 @@ func (ev *EventLoginFailureType) String() string {
2426

2527
type EventLoginLockType struct {
2628
Event
29+
2730
TypeData EventLoginLockTypeData `json:"type_data"`
2831
}
2932
type EventLoginLockTypeData EventSecurityTypeData
@@ -34,6 +37,7 @@ func (ev *EventLoginLockType) String() string {
3437

3538
type EventLoginUnlockSuccessType struct {
3639
Event
40+
3741
TypeData EventLoginUnlockSuccessTypeData `json:"type_data"`
3842
}
3943
type EventLoginUnlockSuccessTypeData EventSecurityTypeData
@@ -44,6 +48,7 @@ func (ev *EventLoginUnlockSuccessType) String() string {
4448

4549
type EventPasswordResetQueryType struct {
4650
Event
51+
4752
TypeData EventPasswordResetQueryTypeData `json:"type_data"`
4853
}
4954
type EventPasswordResetQueryTypeData EventSecurityTypeData
@@ -54,6 +59,7 @@ func (ev *EventPasswordResetQueryType) String() string {
5459

5560
type EventPasswordResetSuccessType struct {
5661
Event
62+
5763
TypeData EventPasswordResetSuccessTypeData `json:"type_data"`
5864
}
5965
type EventPasswordResetSuccessTypeData EventSecurityTypeData

events_addon.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type EventNewAddonTypeData struct {
1717

1818
type EventNewAddonType struct {
1919
Event
20+
2021
TypeData EventNewAddonTypeData `json:"type_data"`
2122
}
2223

@@ -29,12 +30,14 @@ func (ev *EventNewAddonType) String() string {
2930

3031
type EventUpgradeAddonTypeData struct {
3132
EventAddon
33+
3234
OldPlanName string `json:"old_plan_name"`
3335
NewPlanName string `json:"new_plan_name"`
3436
}
3537

3638
type EventUpgradeAddonType struct {
3739
Event
40+
3841
TypeData EventUpgradeAddonTypeData `json:"type_data"`
3942
}
4043

@@ -60,6 +63,7 @@ type EventAddonUpdatedTypeData struct {
6063

6164
type EventAddonUpdatedType struct {
6265
Event
66+
6367
TypeData EventAddonUpdatedTypeData `json:"type_data"`
6468
}
6569

@@ -77,6 +81,7 @@ type EventDeleteAddonTypeData struct {
7781

7882
type EventDeleteAddonType struct {
7983
Event
84+
8085
TypeData EventDeleteAddonTypeData `json:"type_data"`
8186
}
8287

@@ -93,6 +98,7 @@ type EventResumeAddonTypeData struct {
9398

9499
type EventResumeAddonType struct {
95100
Event
101+
96102
TypeData EventResumeAddonTypeData `json:"type_data"`
97103
}
98104

@@ -105,11 +111,13 @@ func (ev *EventResumeAddonType) String() string {
105111

106112
type EventSuspendAddonTypeData struct {
107113
EventAddon
114+
108115
Reason string `json:"reason"`
109116
}
110117

111118
type EventSuspendAddonType struct {
112119
Event
120+
113121
TypeData EventSuspendAddonTypeData `json:"type_data"`
114122
}
115123

@@ -122,6 +130,7 @@ func (ev *EventSuspendAddonType) String() string {
122130

123131
type EventDatabaseAddFeatureType struct {
124132
Event
133+
125134
TypeData EventDatabaseAddFeatureTypeData `json:"type_data"`
126135
}
127136

@@ -142,6 +151,7 @@ func (ev *EventDatabaseAddFeatureType) String() string {
142151

143152
type EventDatabaseRemoveFeatureType struct {
144153
Event
154+
145155
TypeData EventDatabaseRemoveFeatureTypeData `json:"type_data"`
146156
}
147157

@@ -162,6 +172,7 @@ func (ev *EventDatabaseRemoveFeatureType) String() string {
162172

163173
type EventDatabaseBackupSucceededType struct {
164174
Event
175+
165176
TypeData EventDatabaseBackupSucceededTypeData `json:"type_data"`
166177
}
167178

@@ -203,6 +214,7 @@ type EventDatabaseBackupSucceededTypeData struct {
203214

204215
type EventDatabaseBackupFailedType struct {
205216
Event
217+
206218
TypeData EventDatabaseBackupFailedTypeData `json:"type_data"`
207219
}
208220

events_alert.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type EventAlertTypeData struct {
1717

1818
type EventAlertType struct {
1919
Event
20+
2021
TypeData EventAlertTypeData `json:"type_data"`
2122
}
2223

@@ -49,6 +50,7 @@ type EventNewAlertTypeData struct {
4950

5051
type EventNewAlertType struct {
5152
Event
53+
5254
TypeData EventNewAlertTypeData `json:"type_data"`
5355
}
5456

@@ -64,6 +66,7 @@ type EventDeleteAlertTypeData struct {
6466

6567
type EventDeleteAlertType struct {
6668
Event
69+
6770
TypeData EventDeleteAlertTypeData `json:"type_data"`
6871
}
6972

events_app.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type EventNewAppTypeData struct {
1111

1212
type EventNewAppType struct {
1313
Event
14+
1415
TypeData EventNewAppTypeData `json:"type_data"`
1516
}
1617

@@ -24,6 +25,7 @@ type EventEditAppTypeData struct {
2425

2526
type EventEditAppType struct {
2627
Event
28+
2729
TypeData EventEditAppTypeData `json:"type_data"`
2830
}
2931

@@ -54,6 +56,7 @@ type EventRenameAppTypeData struct {
5456

5557
type EventRenameAppType struct {
5658
Event
59+
5760
TypeData EventRenameAppTypeData `json:"type_data"`
5861
}
5962

@@ -73,6 +76,7 @@ type EventUpdateAppProjectTypeData struct {
7376

7477
type EventUpdateAppProjectType struct {
7578
Event
79+
7680
TypeData EventUpdateAppProjectTypeData `json:"type_data"`
7781
}
7882

@@ -90,6 +94,7 @@ type EventTransferAppTypeData struct {
9094

9195
type EventTransferAppType struct {
9296
Event
97+
9398
TypeData EventTransferAppTypeData `json:"type_data"`
9499
}
95100

@@ -107,6 +112,7 @@ type EventRestartTypeData struct {
107112

108113
type EventRestartType struct {
109114
Event
115+
110116
TypeData EventRestartTypeData `json:"type_data"`
111117
}
112118

@@ -119,7 +125,7 @@ func (ev *EventRestartType) String() string {
119125

120126
func (ev *EventRestartType) Who() string {
121127
if ev.TypeData.AddonName != "" {
122-
return fmt.Sprintf("Addon %s", ev.TypeData.AddonName)
128+
return "Addon " + ev.TypeData.AddonName
123129
}
124130
return ev.Event.Who()
125131
}
@@ -130,6 +136,7 @@ type EventStopAppTypeData struct {
130136

131137
type EventStopAppType struct {
132138
Event
139+
133140
TypeData EventStopAppTypeData `json:"type_data"`
134141
}
135142

@@ -152,6 +159,7 @@ type EventScaleTypeData struct {
152159

153160
type EventScaleType struct {
154161
Event
162+
155163
TypeData EventScaleTypeData `json:"type_data"`
156164
}
157165

@@ -171,6 +179,7 @@ type EventCrashTypeData struct {
171179

172180
type EventCrashType struct {
173181
Event
182+
174183
TypeData EventCrashTypeData `json:"type_data"`
175184
}
176185

@@ -192,6 +201,7 @@ type EventRepeatedCrashTypeData struct {
192201

193202
type EventRepeatedCrashType struct {
194203
Event
204+
195205
TypeData EventRepeatedCrashTypeData `json:"type_data"`
196206
}
197207

@@ -216,6 +226,7 @@ type EventDeploymentTypeData struct {
216226

217227
type EventDeploymentType struct {
218228
Event
229+
219230
TypeData EventDeploymentTypeData `json:"type_data"`
220231
}
221232

events_billing.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
type EventAddCreditType struct {
1010
Event
11+
1112
TypeData EventAddCreditTypeData `json:"type_data"`
1213
}
1314

@@ -24,16 +25,17 @@ type EventAddCreditTypeData struct {
2425

2526
type EventAddPaymentMethodType struct {
2627
Event
28+
2729
TypeData EventAddPaymentMethodTypeData `json:"type_data"`
2830
}
2931

3032
func (ev *EventAddPaymentMethodType) String() string {
31-
if ev.TypeData.Profile.PaymentMethodType == billing.Stripe {
32-
p := ev.TypeData.Profile.Stripe
33+
if ev.TypeData.PaymentMethodType == billing.Stripe {
34+
p := ev.TypeData.Stripe
3335
return fmt.Sprintf("%s card ending with ...%s, expiring in %s", p.Brand, p.Last4, p.Exp)
3436
}
3537

36-
return fmt.Sprintf("'%s' payment method added", ev.TypeData.Profile.PaymentMethodType)
38+
return fmt.Sprintf("'%s' payment method added", ev.TypeData.PaymentMethodType)
3739
}
3840

3941
type EventAddPaymentMethodTypeData struct {
@@ -42,6 +44,7 @@ type EventAddPaymentMethodTypeData struct {
4244

4345
type EventAddVoucherType struct {
4446
Event
47+
4548
TypeData EventAddVoucherTypeData `json:"type_data"`
4649
}
4750

0 commit comments

Comments
 (0)