Skip to content

Commit fec54e0

Browse files
Remove stale workflow; fix lint (#843)
* Add keep and stale label * Update .github/labels.yml Co-authored-by: Copilot <[email protected]> * Update .github/labels.yml Co-authored-by: Copilot <[email protected]> * Fix lint * Fix more lint issues * Remove no effect omitempty * Change `omitempty` to `omitzero` for `Devices` field in `FirewallCreateOptions` * Remove stale workflow completely --------- Co-authored-by: Copilot <[email protected]>
1 parent aa42ec3 commit fec54e0

18 files changed

+50
-53
lines changed

.github/workflows/stale.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

account_events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ func (c *Client) GetEvent(ctx context.Context, eventID int) (*Event, error) {
339339
}
340340

341341
// MarkEventRead marks a single Event as read.
342+
//
342343
// Deprecated: `MarkEventRead` is a deprecated API, please consider using `MarkEventsSeen` instead.
343344
// Please note that the `MarkEventsSeen` API functions differently and will mark all events up to and
344345
// including the referenced event-id as "seen" rather than individual events.

account_payment_methods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type PaymentMethod struct {
2424
Type string `json:"type"`
2525

2626
// The detailed data for the Payment Method, which can be of varying types.
27-
Data interface{} `json:"data"`
27+
Data any `json:"data"`
2828
}
2929

3030
// PaymentMethodDataCreditCard represents a PaymentMethodDataCreditCard object

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func (c *httpClient) logRequest(req *http.Request, method, url string, bodyBuffe
405405

406406
var logBuf bytes.Buffer
407407

408-
err := reqLogTemplate.Execute(&logBuf, map[string]interface{}{
408+
err := reqLogTemplate.Execute(&logBuf, map[string]any{
409409
"Method": method,
410410
"URL": url,
411411
"Headers": req.Header,
@@ -453,7 +453,7 @@ func (c *httpClient) logResponse(resp *http.Response) (*http.Response, error) {
453453

454454
var logBuf bytes.Buffer
455455

456-
err := respLogTemplate.Execute(&logBuf, map[string]interface{}{
456+
err := respLogTemplate.Execute(&logBuf, map[string]any{
457457
"Status": resp.Status,
458458
"Headers": resp.Header,
459459
"Body": respBody.String(),
@@ -468,7 +468,7 @@ func (c *httpClient) logResponse(resp *http.Response) (*http.Response, error) {
468468
}
469469

470470
// nolint:unused
471-
func (c *httpClient) decodeResponseBody(resp *http.Response, response interface{}) error {
471+
func (c *httpClient) decodeResponseBody(resp *http.Response, response any) error {
472472
if err := json.NewDecoder(resp.Body).Decode(response); err != nil {
473473
if c.debug && c.logger != nil {
474474
c.logger.Errorf("failed to decode response: %v", err)

errors.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"net/http"
99
"reflect"
10+
"slices"
1011
"strings"
1112

1213
"github.com/go-resty/resty/v2"
@@ -227,11 +228,6 @@ func ErrHasStatus(err error, code ...int) bool {
227228
}
228229

229230
ec := e.StatusCode()
230-
for _, c := range code {
231-
if ec == c {
232-
return true
233-
}
234-
}
235231

236-
return false
232+
return slices.Contains(code, ec)
237233
}

firewalls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type FirewallCreateOptions struct {
4141
Label string `json:"label,omitempty"`
4242
Rules FirewallRuleSet `json:"rules"`
4343
Tags []string `json:"tags,omitempty"`
44-
Devices DevicesCreationOptions `json:"devices,omitempty"`
44+
Devices DevicesCreationOptions `json:"devices,omitzero"`
4545
}
4646

4747
// FirewallUpdateOptions is an options struct used when Updating a Firewall

instances.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type InstanceBackup struct {
110110
Schedule struct {
111111
Day string `json:"day,omitempty"`
112112
Window string `json:"window,omitempty"`
113-
} `json:"schedule,omitempty"`
113+
} `json:"schedule"`
114114
}
115115

116116
type InstanceDiskEncryption string
@@ -132,8 +132,9 @@ type InstanceTransfer struct {
132132
Quota int `json:"quota"`
133133
}
134134

135-
// MonthlyInstanceTransferStats pool stats for a Linode Instance network transfer statistics for a specific month
136135
// Deprecated: use MonthlyInstanceTransferStatsV2 for new implementations
136+
//
137+
// MonthlyInstanceTransferStats pool stats for a Linode Instance network transfer statistics for a specific month
137138
type MonthlyInstanceTransferStats struct {
138139
// The amount of inbound public network traffic received by this Linode, in bytes, for a specific year/month.
139140
BytesIn int `json:"bytes_in"`

internal/testutil/mock.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ func CreateMockClient[T any](t *testing.T, createFunc func(*http.Client) T) *T {
9292
}
9393

9494
type Logger interface {
95-
Errorf(format string, v ...interface{})
96-
Warnf(format string, v ...interface{})
97-
Debugf(format string, v ...interface{})
95+
Errorf(format string, v ...any)
96+
Warnf(format string, v ...any)
97+
Debugf(format string, v ...any)
9898
}
9999

100100
func CreateLogger() *TestLogger {
@@ -108,19 +108,19 @@ type TestLogger struct {
108108
L *log.Logger
109109
}
110110

111-
func (l *TestLogger) Errorf(format string, v ...interface{}) {
111+
func (l *TestLogger) Errorf(format string, v ...any) {
112112
l.outputf("ERROR RESTY "+format, v...)
113113
}
114114

115-
func (l *TestLogger) Warnf(format string, v ...interface{}) {
115+
func (l *TestLogger) Warnf(format string, v ...any) {
116116
l.outputf("WARN RESTY "+format, v...)
117117
}
118118

119-
func (l *TestLogger) Debugf(format string, v ...interface{}) {
119+
func (l *TestLogger) Debugf(format string, v ...any) {
120120
l.outputf("DEBUG RESTY "+format, v...)
121121
}
122122

123-
func (l *TestLogger) outputf(format string, v ...interface{}) {
123+
func (l *TestLogger) outputf(format string, v ...any) {
124124
if len(v) == 0 {
125125
l.L.Print(format)
126126
return

logger.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77

88
//nolint:unused
99
type httpLogger interface {
10-
Errorf(format string, v ...interface{})
11-
Warnf(format string, v ...interface{})
12-
Debugf(format string, v ...interface{})
10+
Errorf(format string, v ...any)
11+
Warnf(format string, v ...any)
12+
Debugf(format string, v ...any)
1313
}
1414

1515
//nolint:unused
@@ -27,22 +27,22 @@ func createLogger() *logger {
2727
var _ httpLogger = (*logger)(nil)
2828

2929
//nolint:unused
30-
func (l *logger) Errorf(format string, v ...interface{}) {
30+
func (l *logger) Errorf(format string, v ...any) {
3131
l.output("ERROR RESTY "+format, v...)
3232
}
3333

3434
//nolint:unused
35-
func (l *logger) Warnf(format string, v ...interface{}) {
35+
func (l *logger) Warnf(format string, v ...any) {
3636
l.output("WARN RESTY "+format, v...)
3737
}
3838

3939
//nolint:unused
40-
func (l *logger) Debugf(format string, v ...interface{}) {
40+
func (l *logger) Debugf(format string, v ...any) {
4141
l.output("DEBUG RESTY "+format, v...)
4242
}
4343

4444
//nolint:unused
45-
func (l *logger) output(format string, v ...interface{}) { //nolint:goprintffuncname
45+
func (l *logger) output(format string, v ...any) { //nolint:goprintffuncname
4646
if len(v) == 0 {
4747
l.l.Print(format)
4848
return

monitor_api_services.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ type MetricRelativeTimeDuration struct {
9393

9494
// MetricAbsoluteTimeDuration specifies an absolute time range for data queries
9595
type MetricAbsoluteTimeDuration struct {
96-
Start time.Time `json:"start,omitempty"`
97-
End time.Time `json:"end,omitempty"`
96+
Start time.Time `json:"start"`
97+
End time.Time `json:"end"`
9898
}
9999

100100
// FetchEntityMetrics returns metrics information for the individual entities within a specific service type

0 commit comments

Comments
 (0)