Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lint): fixing some linter errors #3

Merged
merged 3 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ build:
$(MAKE) -C testdata/hello-go build

tests: build
go test --race -v -covermode=atomic -coverprofile=coverage.out ./...
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...

benchmarks: build
go test -bench=. -benchmem ./...
4 changes: 2 additions & 2 deletions callbacks/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (c *Counter) Reset() {
c.count = 0
}

var ErrTestError = fmt.Errorf("test error")
var ErrTestError = errors.New("test error")

type RouterTestCase struct {
Name string
Expand Down Expand Up @@ -377,7 +377,7 @@ func ExampleNew() {
Namespace: "example",
Capability: "greeting",
Operation: "hello",
Func: func(input []byte) ([]byte, error) {
Func: func(_ []byte) ([]byte, error) {
fmt.Println("Hello World!")
return []byte(""), nil
},
Expand Down
3 changes: 2 additions & 1 deletion engine/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package engine

import (
"context"
"errors"
"fmt"
"time"

Expand All @@ -10,7 +11,7 @@ import (

var (
// ErrInvalidModuleConfig is returned when a ModuleConfig is invalid.
ErrInvalidModuleConfig = fmt.Errorf("invalid module config")
ErrInvalidModuleConfig = errors.New("invalid module config")
)

const (
Expand Down
8 changes: 6 additions & 2 deletions engine/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package engine

import (
"context"
"errors"
"fmt"
"os"
"sync"
Expand All @@ -30,7 +31,10 @@ import (

var (
// ErrModuleNotFound is returned when a module is not found.
ErrModuleNotFound = fmt.Errorf("module not found")
ErrModuleNotFound = errors.New("module not found")

// ErrCallbackNil is returned when the callback function is nil.
ErrCallbackNil = errors.New("callback cannot be nil")
)

// ServerConfig is used to configure the initial Server.
Expand Down Expand Up @@ -65,7 +69,7 @@ func New(cfg ServerConfig) (*Server, error) {
s.modules = make(map[string]*Module)

if cfg.Callback == nil {
return s, fmt.Errorf("callback cannot be nil")
return s, ErrCallbackNil
}

s.callback = cfg.Callback
Expand Down
Loading