Skip to content

Commit b6d7370

Browse files
committed
style: format go code
1 parent 40eb1a8 commit b6d7370

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+650
-651
lines changed

account.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func (a *AccountServiceHandler) Get(ctx context.Context) (*Account, *http.Respon
4141

4242
account := new(accountBase)
4343
resp, err := a.client.DoWithContext(ctx, req, account)
44-
if err != nil {
45-
return nil,resp, err
44+
if err != nil {
45+
return nil, resp, err
4646
}
4747

4848
return account.Account, resp, nil

account_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func TestAccountServiceHandler_Get(t *testing.T) {
4040
t.Errorf("Account.Get returned error: %v", err)
4141
}
4242

43-
4443
expected := &Account{Balance: -5519.11, PendingCharges: 57.03, LastPaymentDate: "2014-07-18 15:31:01", LastPaymentAmount: -1.00, Name: "Test Tester", Email: "[email protected]", ACL: []string{"subscriptions", "billing", "support", "provisioning"}}
4544

4645
if !reflect.DeepEqual(account, expected) {

application.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// ApplicationService is the interface to interact with the Application endpoint on the Vultr API.
1111
// Link : https://www.vultr.com/api/#tag/application
1212
type ApplicationService interface {
13-
List(ctx context.Context, options *ListOptions) ([]Application, *Meta,*http.Response, error)
13+
List(ctx context.Context, options *ListOptions) ([]Application, *Meta, *http.Response, error)
1414
}
1515

1616
// ApplicationServiceHandler handles interaction with the application methods for the Vultr API.
@@ -35,26 +35,26 @@ type applicationBase struct {
3535
}
3636

3737
// List retrieves a list of available applications that can be launched when creating a Vultr instance
38-
func (a *ApplicationServiceHandler) List(ctx context.Context, options *ListOptions) ([]Application, *Meta,*http.Response, error) {
38+
func (a *ApplicationServiceHandler) List(ctx context.Context, options *ListOptions) ([]Application, *Meta, *http.Response, error) {
3939
uri := "/v2/applications"
4040

4141
req, err := a.client.NewRequest(ctx, http.MethodGet, uri, nil)
4242
if err != nil {
43-
return nil, nil,nil, err
43+
return nil, nil, nil, err
4444
}
4545

4646
newValues, err := query.Values(options)
4747
if err != nil {
48-
return nil, nil,nil, err
48+
return nil, nil, nil, err
4949
}
5050

5151
req.URL.RawQuery = newValues.Encode()
5252
apps := new(applicationBase)
5353

54-
resp,err := a.client.DoWithContext(ctx, req, apps)
54+
resp, err := a.client.DoWithContext(ctx, req, apps)
5555
if err != nil {
56-
return nil, nil,resp, err
56+
return nil, nil, resp, err
5757
}
5858

59-
return apps.Applications, apps.Meta,resp, nil
59+
return apps.Applications, apps.Meta, resp, nil
6060
}

application_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestApplicationServiceHandler_List(t *testing.T) {
4343
PerPage: 1,
4444
Cursor: "",
4545
}
46-
apps, meta,_, err := client.Application.List(ctx, options)
46+
apps, meta, _, err := client.Application.List(ctx, options)
4747
if err != nil {
4848
t.Errorf("Application.List returned error: %v", err)
4949
}

backup_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func TestBackupServiceHandler_GetEmpty(t *testing.T) {
165165
fmt.Fprint(w, response)
166166
})
167167

168-
backup,_, err := client.Backup.Get(ctx, "543d34149403a")
168+
backup, _, err := client.Backup.Get(ctx, "543d34149403a")
169169
if err != nil {
170170
t.Errorf("Backup.Get returned error: %v", err)
171171
}

bare_metal_server.go

+38-38
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ const bmPath = "/v2/bare-metals"
1313
// BareMetalServerService is the interface to interact with the Bare Metal endpoints on the Vultr API
1414
// Link : https://www.vultr.com/api/#tag/baremetal
1515
type BareMetalServerService interface {
16-
Create(ctx context.Context, bmCreate *BareMetalCreate) (*BareMetalServer,*http.Response, error)
16+
Create(ctx context.Context, bmCreate *BareMetalCreate) (*BareMetalServer, *http.Response, error)
1717
Get(ctx context.Context, serverID string) (*BareMetalServer, *http.Response, error)
1818
Update(ctx context.Context, serverID string, bmReq *BareMetalUpdate) (*BareMetalServer, *http.Response, error)
1919
Delete(ctx context.Context, serverID string) error
20-
List(ctx context.Context, options *ListOptions) ([]BareMetalServer, *Meta,*http.Response, error)
20+
List(ctx context.Context, options *ListOptions) ([]BareMetalServer, *Meta, *http.Response, error)
2121

22-
GetBandwidth(ctx context.Context, serverID string) (*Bandwidth,*http.Response, error)
23-
GetUserData(ctx context.Context, serverID string) (*UserData, *http.Response,error)
24-
GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl,*http.Response, error)
22+
GetBandwidth(ctx context.Context, serverID string) (*Bandwidth, *http.Response, error)
23+
GetUserData(ctx context.Context, serverID string) (*UserData, *http.Response, error)
24+
GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl, *http.Response, error)
2525

26-
ListIPv4s(ctx context.Context, serverID string, options *ListOptions) ([]IPv4, *Meta,*http.Response, error)
27-
ListIPv6s(ctx context.Context, serverID string, options *ListOptions) ([]IPv6, *Meta,*http.Response, error)
26+
ListIPv4s(ctx context.Context, serverID string, options *ListOptions) ([]IPv4, *Meta, *http.Response, error)
27+
ListIPv6s(ctx context.Context, serverID string, options *ListOptions) ([]IPv6, *Meta, *http.Response, error)
2828

2929
Halt(ctx context.Context, serverID string) error
3030
Reboot(ctx context.Context, serverID string) error
@@ -146,18 +146,18 @@ func (b *BareMetalServerServiceHandler) Create(ctx context.Context, bmCreate *Ba
146146
bm := new(bareMetalBase)
147147
resp, err := b.client.DoWithContext(ctx, req, bm)
148148
if err != nil {
149-
return nil,resp, err
149+
return nil, resp, err
150150
}
151151

152-
return bm.BareMetal,resp, nil
152+
return bm.BareMetal, resp, nil
153153
}
154154

155155
// Get information for a Bare Metal instance.
156-
func (b *BareMetalServerServiceHandler) Get(ctx context.Context, serverID string) (*BareMetalServer,*http.Response, error) {
156+
func (b *BareMetalServerServiceHandler) Get(ctx context.Context, serverID string) (*BareMetalServer, *http.Response, error) {
157157
uri := fmt.Sprintf("%s/%s", bmPath, serverID)
158158
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
159159
if err != nil {
160-
return nil,nil,err
160+
return nil, nil, err
161161
}
162162

163163
bms := new(bareMetalBase)
@@ -166,15 +166,15 @@ func (b *BareMetalServerServiceHandler) Get(ctx context.Context, serverID string
166166
return nil, resp, err
167167
}
168168

169-
return bms.BareMetal,resp, nil
169+
return bms.BareMetal, resp, nil
170170
}
171171

172172
// Update a Bare Metal server
173-
func (b *BareMetalServerServiceHandler) Update(ctx context.Context, serverID string, bmReq *BareMetalUpdate) (*BareMetalServer,*http.Response,error) {
173+
func (b *BareMetalServerServiceHandler) Update(ctx context.Context, serverID string, bmReq *BareMetalUpdate) (*BareMetalServer, *http.Response, error) {
174174
uri := fmt.Sprintf("%s/%s", bmPath, serverID)
175175
req, err := b.client.NewRequest(ctx, http.MethodPatch, uri, bmReq)
176176
if err != nil {
177-
return nil,nil, err
177+
return nil, nil, err
178178
}
179179

180180
bms := new(bareMetalBase)
@@ -183,7 +183,7 @@ func (b *BareMetalServerServiceHandler) Update(ctx context.Context, serverID str
183183
return nil, resp, err
184184
}
185185

186-
return bms.BareMetal,resp, nil
186+
return bms.BareMetal, resp, nil
187187
}
188188

189189
// Delete a Bare Metal server.
@@ -193,7 +193,7 @@ func (b *BareMetalServerServiceHandler) Delete(ctx context.Context, serverID str
193193
if err != nil {
194194
return nil
195195
}
196-
_, err = b.client.DoWithContext(ctx, req, nil)
196+
_, err = b.client.DoWithContext(ctx, req, nil)
197197
return err
198198
}
199199

@@ -214,14 +214,14 @@ func (b *BareMetalServerServiceHandler) List(ctx context.Context, options *ListO
214214
bms := new(bareMetalsBase)
215215
resp, err := b.client.DoWithContext(ctx, req, bms)
216216
if err != nil {
217-
return nil, nil,resp, err
217+
return nil, nil, resp, err
218218
}
219219

220220
return bms.BareMetals, bms.Meta, resp, nil
221221
}
222222

223223
// GetBandwidth used by a Bare Metal server.
224-
func (b *BareMetalServerServiceHandler) GetBandwidth(ctx context.Context, serverID string) (*Bandwidth,*http.Response, error) {
224+
func (b *BareMetalServerServiceHandler) GetBandwidth(ctx context.Context, serverID string) (*Bandwidth, *http.Response, error) {
225225
uri := fmt.Sprintf("%s/%s/bandwidth", bmPath, serverID)
226226
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
227227
if err != nil {
@@ -242,11 +242,11 @@ func (b *BareMetalServerServiceHandler) GetUserData(ctx context.Context, serverI
242242
uri := fmt.Sprintf("%s/%s/user-data", bmPath, serverID)
243243
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
244244
if err != nil {
245-
return nil,nil, err
245+
return nil, nil, err
246246
}
247247

248248
userData := new(userDataBase)
249-
resp,err := b.client.DoWithContext(ctx, req, userData)
249+
resp, err := b.client.DoWithContext(ctx, req, userData)
250250
if err != nil {
251251
return nil, nil, err
252252
}
@@ -255,17 +255,17 @@ func (b *BareMetalServerServiceHandler) GetUserData(ctx context.Context, serverI
255255
}
256256

257257
// GetVNCUrl gets the vnc url for a given Bare Metal server.
258-
func (b *BareMetalServerServiceHandler) GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl, *http.Response, error) {
258+
func (b *BareMetalServerServiceHandler) GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl, *http.Response, error) {
259259
uri := fmt.Sprintf("%s/%s/vnc", bmPath, serverID)
260260
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
261261
if err != nil {
262262
return nil, nil, err
263263
}
264264

265265
vnc := new(vncBase)
266-
resp,err := b.client.DoWithContext(ctx, req, vnc)
266+
resp, err := b.client.DoWithContext(ctx, req, vnc)
267267
if err != nil {
268-
return nil,resp, err
268+
return nil, resp, err
269269
}
270270

271271
return vnc.VNCUrl, resp, nil
@@ -277,18 +277,18 @@ func (b *BareMetalServerServiceHandler) ListIPv4s(ctx context.Context, serverID
277277
uri := fmt.Sprintf("%s/%s/ipv4", bmPath, serverID)
278278
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
279279
if err != nil {
280-
return nil, nil,nil,err
280+
return nil, nil, nil, err
281281
}
282282

283283
newValues, err := query.Values(options)
284284
if err != nil {
285-
return nil, nil,nil, err
285+
return nil, nil, nil, err
286286
}
287287

288288
req.URL.RawQuery = newValues.Encode()
289289

290290
ipv4 := new(ipBase)
291-
resp, err := b.client.DoWithContext(ctx, req, ipv4)
291+
resp, err := b.client.DoWithContext(ctx, req, ipv4)
292292
if err != nil {
293293
return nil, nil, resp, err
294294
}
@@ -303,20 +303,20 @@ func (b *BareMetalServerServiceHandler) ListIPv6s(ctx context.Context, serverID
303303
uri := fmt.Sprintf("%s/%s/ipv6", bmPath, serverID)
304304
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
305305
if err != nil {
306-
return nil, nil,nil, err
306+
return nil, nil, nil, err
307307
}
308308

309309
newValues, err := query.Values(options)
310310
if err != nil {
311-
return nil, nil,nil, err
311+
return nil, nil, nil, err
312312
}
313313

314314
req.URL.RawQuery = newValues.Encode()
315315

316316
ipv6 := new(ipBase)
317-
resp, err := b.client.DoWithContext(ctx, req, ipv6)
317+
resp, err := b.client.DoWithContext(ctx, req, ipv6)
318318
if err != nil {
319-
return nil, nil,resp, err
319+
return nil, nil, resp, err
320320
}
321321

322322
return ipv6.IPv6s, ipv6.Meta, resp, nil
@@ -332,7 +332,7 @@ func (b *BareMetalServerServiceHandler) Halt(ctx context.Context, serverID strin
332332
return err
333333
}
334334

335-
_, err = b.client.DoWithContext(ctx, req, nil)
335+
_, err = b.client.DoWithContext(ctx, req, nil)
336336
return err
337337
}
338338

@@ -363,7 +363,7 @@ func (b *BareMetalServerServiceHandler) Start(ctx context.Context, serverID stri
363363

364364
// Reinstall the operating system on a Bare Metal server.
365365
// All data will be permanently lost, but the IP address will remain the same.
366-
func (b *BareMetalServerServiceHandler) Reinstall(ctx context.Context, serverID string) (*BareMetalServer, *http.Response,error) {
366+
func (b *BareMetalServerServiceHandler) Reinstall(ctx context.Context, serverID string) (*BareMetalServer, *http.Response, error) {
367367
uri := fmt.Sprintf("%s/%s/reinstall", bmPath, serverID)
368368
req, err := b.client.NewRequest(ctx, http.MethodPost, uri, nil)
369369
if err != nil {
@@ -376,7 +376,7 @@ func (b *BareMetalServerServiceHandler) Reinstall(ctx context.Context, serverID
376376
return nil, resp, err
377377
}
378378

379-
return bms.BareMetal,resp, nil
379+
return bms.BareMetal, resp, nil
380380
}
381381

382382
// MassStart will start a list of Bare Metal servers the machine is already running, it will be restarted.
@@ -419,18 +419,18 @@ func (b *BareMetalServerServiceHandler) MassReboot(ctx context.Context, serverLi
419419
}
420420

421421
// GetUpgrades that are available for a Bare Metal server.
422-
func (b *BareMetalServerServiceHandler) GetUpgrades(ctx context.Context, serverID string) (*Upgrades, *http.Response,error) {
422+
func (b *BareMetalServerServiceHandler) GetUpgrades(ctx context.Context, serverID string) (*Upgrades, *http.Response, error) {
423423
uri := fmt.Sprintf("%s/%s/upgrades", bmPath, serverID)
424424
req, err := b.client.NewRequest(ctx, http.MethodGet, uri, nil)
425425
if err != nil {
426-
return nil,nil, err
426+
return nil, nil, err
427427
}
428428

429429
upgrades := new(upgradeBase)
430-
resp,err := b.client.DoWithContext(ctx, req, upgrades)
430+
resp, err := b.client.DoWithContext(ctx, req, upgrades)
431431
if err != nil {
432-
return nil,resp, err
432+
return nil, resp, err
433433
}
434434

435-
return upgrades.Upgrades,resp,nil
435+
return upgrades.Upgrades, resp, nil
436436
}

0 commit comments

Comments
 (0)