Skip to content

Commit

Permalink
fix(lint)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsharifnasab committed Nov 19, 2024
1 parent 2b12857 commit 3799dcc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
15 changes: 3 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
run:
skip-files:
issues:
exclude-files:
- ".*_test.go"
linters:
enable-all: true
Expand All @@ -9,18 +9,9 @@ linters:
# it should improve to support more known patterns
- varnamelen
# deprecated linters
- varcheck
- deadcode
- nosnakecase
- revive
- ifshort
- structcheck
- maligned
- scopelint
- golint
- interfacer
- exhaustivestruct
- ireturn
- cyclop
- wrapcheck
- nolintlint
- exportloopref
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
stream, err := connection.OpenUniStream()
if err != nil {
l.Error("failed to open send stream", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToCreateStream,
Expand All @@ -105,6 +106,7 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
err = internal.WriteData(bytes, stream)
if err != nil {
l.Error("failed to send offer to server", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToSendOffer,
Expand All @@ -122,6 +124,7 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
receiveStream, err := connection.AcceptUniStream(context.Background())
if err != nil {
l.Error("failed to open receive stream", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToCreateStream,
Expand Down Expand Up @@ -170,7 +173,7 @@ func processConfig(config *ClientConfig) ClientConfig {

//nolint:typecheck
func reconnect(policy ReconnectPolicy, address string, tlcCfg *tls.Config, l *zap.Logger) (quic.Connection, bool) {
for i := 0; i < policy.RetryTimes; i++ {
for range policy.RetryTimes {
connection, err := quic.DialAddr(context.Background(), address, tlcCfg, nil)
if err == nil {
return connection, true
Expand Down
2 changes: 1 addition & 1 deletion internal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func SendError(sendStream quic.SendStream, e *Error) error {
return WriteData(errEvent, sendStream)
}

func CloseClientConnection(connection quic.Connection, code int, err error) error {
func CloseClientConnection(connection quic.Connection, code uint64, err error) error {
appCode := quic.ApplicationErrorCode(code)

if err = connection.CloseWithError(appCode, err.Error()); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ type MetricConfig struct {
type Server interface {
Publish(topic string, event []byte)

SetAuthenticator(auth.Authenticator)
SetAuthenticatorFunc(auth.AuthenticatorFunc)
SetAuthenticator(authenticator auth.Authenticator)
SetAuthenticatorFunc(authenticatorFunc auth.AuthenticatorFunc)

SetAuthorizer(auth.Authorizer)
SetAuthorizerFunc(auth.AuthorizerFunc)
SetAuthorizer(authorizer auth.Authorizer)
SetAuthorizerFunc(authorizer auth.AuthorizerFunc)

MetricHandler() http.Handler
}
Expand Down

0 comments on commit 3799dcc

Please sign in to comment.