Skip to content

Commit 88de564

Browse files
authored
Merge pull request #3 from madflojo/errors
chore(lint): fixing some linter errors
2 parents 61c4d41 + 6645a25 commit 88de564

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ build:
22
$(MAKE) -C testdata/hello-go build
33

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

77
benchmarks: build
88
go test -bench=. -benchmem ./...

callbacks/router_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (c *Counter) Reset() {
3333
c.count = 0
3434
}
3535

36-
var ErrTestError = fmt.Errorf("test error")
36+
var ErrTestError = errors.New("test error")
3737

3838
type RouterTestCase struct {
3939
Name string
@@ -377,7 +377,7 @@ func ExampleNew() {
377377
Namespace: "example",
378378
Capability: "greeting",
379379
Operation: "hello",
380-
Func: func(input []byte) ([]byte, error) {
380+
Func: func(_ []byte) ([]byte, error) {
381381
fmt.Println("Hello World!")
382382
return []byte(""), nil
383383
},

engine/module.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package engine
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"time"
78

@@ -10,7 +11,7 @@ import (
1011

1112
var (
1213
// ErrInvalidModuleConfig is returned when a ModuleConfig is invalid.
13-
ErrInvalidModuleConfig = fmt.Errorf("invalid module config")
14+
ErrInvalidModuleConfig = errors.New("invalid module config")
1415
)
1516

1617
const (

engine/wasm.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package engine
2020

2121
import (
2222
"context"
23+
"errors"
2324
"fmt"
2425
"os"
2526
"sync"
@@ -30,7 +31,10 @@ import (
3031

3132
var (
3233
// ErrModuleNotFound is returned when a module is not found.
33-
ErrModuleNotFound = fmt.Errorf("module not found")
34+
ErrModuleNotFound = errors.New("module not found")
35+
36+
// ErrCallbackNil is returned when the callback function is nil.
37+
ErrCallbackNil = errors.New("callback cannot be nil")
3438
)
3539

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

6771
if cfg.Callback == nil {
68-
return s, fmt.Errorf("callback cannot be nil")
72+
return s, ErrCallbackNil
6973
}
7074

7175
s.callback = cfg.Callback

0 commit comments

Comments
 (0)