Skip to content

Commit

Permalink
Enable golangci-lint to check the examples directory (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
muzzammilshahid authored Oct 28, 2024
1 parent 33f83e2 commit a919320
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ run:

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
skip-dirs-use-default: false

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
Expand Down Expand Up @@ -153,6 +153,10 @@ issues:
- unparam
- unused

- path: examples/(serializers|authentications)\.go
linters:
- unused

# disable noise from errcheck
- linters:
- errcheck
Expand Down
5 changes: 2 additions & 3 deletions examples/authentications.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"

"github.com/xconnio/wampproto-go/auth"

"github.com/xconnio/xconn-go"
)

func connect(url, realm string, authenticator auth.ClientAuthenticator, serializerSpec xconn.WSSerializerSpec) (*xconn.Session, error) {
func connect(url, realm string, authenticator auth.ClientAuthenticator, serializerSpec xconn.WSSerializerSpec) (*xconn.Session, error) { // nolint:lll
client := xconn.Client{Authenticator: authenticator, SerializerSpec: serializerSpec}

return client.Connect(context.Background(), url, realm)
Expand All @@ -26,7 +25,7 @@ func connectCRA(url, realm, authid, secret string, serializerSpec xconn.WSSerial
return connect(url, realm, ticketAuthenticator, serializerSpec)
}

func connectCryptosign(url, realm, authid, privateKey string, serializerSpec xconn.WSSerializerSpec) (*xconn.Session, error) {
func connectCryptosign(url, realm, authid, privateKey string, serializerSpec xconn.WSSerializerSpec) (*xconn.Session, error) { // nolint:lll
ticketAuthenticator, err := auth.NewCryptoSignAuthenticator(authid, map[string]any{}, privateKey)
if err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion examples/pubsub/publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func main() {
}

// Publish event with args and kwargs
err = publisher.Publish(testTopic, []any{"Hello", "World"}, map[string]any{"Hello World!": "I love WAMP"}, map[string]any{})
err = publisher.Publish(testTopic, []any{"Hello", "World"}, map[string]any{"Hello World!": "I love WAMP"},
map[string]any{})
if err != nil {
log.Fatalf("Failed to publish: %s", err)
}
Expand Down
3 changes: 1 addition & 2 deletions examples/rpc/callee/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import (
"os/signal"

"github.com/xconnio/wampproto-go/messages"

"github.com/xconnio/xconn-go"
)

const testProcedureEcho = "io.xconn.echo"
const testProcedureSum = "io.xconn.sum"

// Function to handle received Invocation for "io.xconn.sum"
// Function to handle received Invocation for "io.xconn.sum".
func sumHandler(_ context.Context, inv *xconn.Invocation) *xconn.Result {
log.Printf("Received invocation: args=%s, kwargs=%s, details=%s", inv.Arguments, inv.KwArguments, inv.Details)
sum := int64(0)
Expand Down

0 comments on commit a919320

Please sign in to comment.