Skip to content

Commit 52442d2

Browse files
committed
[lint] fix more issues
1 parent a6dda30 commit 52442d2

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

internal/sms-gateway/models/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type Device struct {
4545
}
4646

4747
func NewDevice(name, pushToken *string) *Device {
48-
//nolint:exhaustruct // pertial constructor
48+
//nolint:exhaustruct // partial constructor
4949
return &Device{
5050
Name: name,
5151
PushToken: pushToken,

internal/sms-gateway/modules/push/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package push
22

33
import (
4+
"errors"
45
"fmt"
56

67
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/push/client"
78
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/push/fcm"
89
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/push/upstream"
910
)
1011

12+
var ErrInvalidPushMode = errors.New("invalid push mode")
13+
1114
func newClient(config Config) (client.Client, error) {
1215
var (
1316
c client.Client
@@ -20,7 +23,7 @@ func newClient(config Config) (client.Client, error) {
2023
case ModeUpstream:
2124
c, err = upstream.New(config.ClientOptions)
2225
default:
23-
return nil, fmt.Errorf("invalid push mode: %s", config.Mode)
26+
return nil, fmt.Errorf("%w: %s", ErrInvalidPushMode, config.Mode)
2427
}
2528

2629
if err != nil {

internal/sms-gateway/modules/webhooks/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Webhook struct {
2525
}
2626

2727
func newWebhook(extID string, url string, event smsgateway.WebhookEvent, userID string, deviceID *string) *Webhook {
28+
//nolint:exhaustruct // partial constructor
2829
return &Webhook{
2930
ExtID: extID,
3031
URL: url,

internal/sms-gateway/pubsub/pubsub.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package pubsub
22

33
import (
4+
"errors"
45
"fmt"
56
"net/url"
67

@@ -13,6 +14,8 @@ const (
1314

1415
type PubSub = pubsub.PubSub
1516

17+
var ErrInvalidScheme = errors.New("invalid scheme")
18+
1619
func New(config Config) (PubSub, error) {
1720
if config.URL == "" {
1821
config.URL = "memory://"
@@ -37,7 +40,7 @@ func New(config Config) (PubSub, error) {
3740
Prefix: topicPrefix,
3841
}, opts...)
3942
default:
40-
return nil, fmt.Errorf("invalid scheme: %s", u.Scheme)
43+
return nil, fmt.Errorf("%w: %s", ErrInvalidScheme, u.Scheme)
4144
}
4245

4346
if err != nil {

0 commit comments

Comments
 (0)