Skip to content

Commit

Permalink
integration: add static code analysis tool;
Browse files Browse the repository at this point in the history
  • Loading branch information
ss89 committed Dec 7, 2020
1 parent c5ffd20 commit 8f6affc
Show file tree
Hide file tree
Showing 50 changed files with 110 additions and 154 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:

- name: Set up Go 1.15
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.15

Expand All @@ -38,9 +38,15 @@ jobs:
- name: Build
run: go build -v ./...

- name: Static code analysis
- name: Static code analysis (go vet)
run: go vet ./...

- name: Install staticcheck
run: go get honnef.co/go/tools/cmd/staticcheck

- name: Static code analysis (staticcheck)
run: staticcheck ./...

- name: Test
run: go test ./...

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ require (
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
gopkg.in/yaml.v2 v2.2.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2
honnef.co/go/tools v0.0.1-2020.1.6 // indirect
)

go 1.15
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ github.com/xitongsys/parquet-go v1.4.0 h1:+3+QFRRwAilhTdNcJU2hPxslLCAKJ+Tn8C2Ohn
github.com/xitongsys/parquet-go v1.4.0/go.mod h1:on8bl2K/PEouGNEJqxht0t3K4IyN/ABeFu84Hh3lzrE=
github.com/xitongsys/parquet-go-source v0.0.0-20191104003508-ecfa341356a6 h1:KPDKkdchSII+K5KS7iMpE062MVh2OucaM31599ER4U0=
github.com/xitongsys/parquet-go-source v0.0.0-20191104003508-ecfa341356a6/go.mod h1:xxCx7Wpym/3QCo6JhujJX51dzSXrwmb0oH6FQb39SEA=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583 h1:SZPG5w7Qxq7bMcMVl6e3Ht2X7f+AAGQdzjkbyOnNNZ8=
github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
Expand All @@ -446,6 +447,7 @@ golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaE
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand All @@ -456,6 +458,7 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -472,6 +475,7 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -534,11 +538,16 @@ golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBn
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200410194907-79a7a3126eef h1:RHORRhs540cYZYrzgU2CPUyykkwZM78hGdzocOo9P8A=
golang.org/x/tools v0.0.0-20200410194907-79a7a3126eef/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
Expand Down Expand Up @@ -601,4 +610,7 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
honnef.co/go/tools v0.0.1-2020.1.6/go.mod h1:pyyisuGw24ruLjrr1ddx39WE0y9OooInRzEYLhQB2YY=
4 changes: 3 additions & 1 deletion pkg/apiserver/auth/config_google.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package auth

import (
"context"
"fmt"
"github.com/applike/gosoline/pkg/cfg"
"github.com/applike/gosoline/pkg/mon"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"google.golang.org/api/oauth2/v2"
"google.golang.org/api/option"
"net/http"
"regexp"
"sync"
Expand Down Expand Up @@ -56,7 +58,7 @@ func NewConfigGoogleHandler(config cfg.Config, logger mon.Logger) gin.HandlerFun
}

func NewConfigGoogleAuthenticator(config cfg.Config, logger mon.Logger) Authenticator {
oauth2Service, err := oauth2.New(http.DefaultClient)
oauth2Service, err := oauth2.NewService(context.Background(), option.WithHTTPClient(http.DefaultClient))

if err != nil {
logger.Panic(err, "failed creating google oauth2 client")
Expand Down
4 changes: 1 addition & 3 deletions pkg/apiserver/crud/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ func AddDeleteHandler(d *apiserver.Definitions, version int, basePath string, ha
}

func AddListHandler(d *apiserver.Definitions, version int, basePath string, handler ListHandler) {
path, _ := getHandlerPaths(version, basePath)

plural := inflection.Plural(basePath)
path = fmt.Sprintf("/v%d/%s", version, plural)
path := fmt.Sprintf("/v%d/%s", version, plural)
d.POST(path, NewListHandler(handler))
}

Expand Down
1 change: 0 additions & 1 deletion pkg/apiserver/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (d *Definition) getAbsolutePath() string {
groupPath := d.group.getAbsolutePath()

absolutePath := fmt.Sprintf("%s/%s", groupPath, d.relativePath)
absolutePath = fmt.Sprintf("%s/%s", groupPath, d.relativePath)
absolutePath = strings.TrimRight(absolutePath, "/")

return removeDuplicates(absolutePath)
Expand Down
12 changes: 4 additions & 8 deletions pkg/blob/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestStreamBytes(t *testing.T) {

reader := stream.AsReader()

buf := make([]byte, 1, 1)
buf := make([]byte, 1)
n, err := reader.Read(buf)
assert.NoError(t, err)
assert.Equal(t, 1, n)
Expand Down Expand Up @@ -103,9 +103,7 @@ func TestStreamReaderWithSeek(t *testing.T) {

assert.GreaterOrEqual(t, len(buffer), len(data))

for i, b := range data {
buffer[i] = b
}
copy(buffer, data)

reader.On("Read", mock.Anything).Return(0, io.EOF).Once()
}).Return(len(data), nil).Once()
Expand All @@ -124,7 +122,7 @@ func TestStreamReaderWithoutSeek(t *testing.T) {
stream := blob.StreamReader(reader)
streamReader := stream.AsReader()

buffer := make([]byte, 1, 1)
buffer := make([]byte, 1)

reader.On("Read", buffer).Return(1, nil)
n, err := streamReader.Read(buffer)
Expand All @@ -150,9 +148,7 @@ func TestStreamReaderWithoutSeek(t *testing.T) {

assert.GreaterOrEqual(t, len(buffer), len(data))

for i, b := range data {
buffer[i] = b
}
copy(buffer, data)

reader.On("Read", mock.Anything).Return(0, io.EOF).Once()
}).Return(len(data), nil).Once()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/ccache.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *Cache) Expire(key string) bool {
return false
}

remaining := item.Expires().Sub(time.Now())
remaining := time.Until(item.Expires())
item.Extend(-1 * remaining)

return true
Expand Down
2 changes: 1 addition & 1 deletion pkg/cast/string.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cast

func ToSlicePtrString(s []string) []*string {
out := make([]*string, len(s), len(s))
out := make([]*string, len(s))

for i, v := range s {
v := v
Expand Down
4 changes: 2 additions & 2 deletions pkg/cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type config struct {
envKeyReplacer *strings.Replacer
}

var templateRegex = regexp.MustCompile("{([\\w.\\-]+)}")
var templateRegex = regexp.MustCompile(`{([\w.\-]+)}`)

func New() GosoConf {
return NewWithInterfaces(os.LookupEnv)
Expand Down Expand Up @@ -539,7 +539,7 @@ func (c *config) resolveEnvKey(prefix string, key string) string {
key = strings.Join([]string{prefix, key}, ".")
}

rp := regexp.MustCompile("\\[(\\d)\\]")
rp := regexp.MustCompile(`\[(\d)\]`)
matches := rp.FindAllStringSubmatch(key, -1)

for _, m := range matches {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cfg/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func (s *ConfigTestSuite) TestConfig_UnmarshalKey_Map() {
"KEY_KEY3_FOO": "env",
})

cm := make(map[string]configMap, 0)
cm := map[string]configMap{}
s.config.UnmarshalKey("key", &cm)

s.Len(cm, 3)
Expand Down
1 change: 0 additions & 1 deletion pkg/cfg/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func (m *Map) doSet(current map[string]interface{}, key string, index int, value

arrayValue.Index(index).Set(reflectValue)
current[key] = arrayValue.Interface()
return
}

func (m *Map) doSetSlice(current map[string]interface{}, key string, value reflect.Value) {
Expand Down
10 changes: 2 additions & 8 deletions pkg/cloud/aws/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ func IsAwsError(err error, awsCode string) bool {
}

func IsAwsErrorCodeRequestCanceled(err error) bool {
if IsAwsError(err, request.CanceledErrorCode) {
return true
}

return false
return IsAwsError(err, request.CanceledErrorCode)
}

func CheckConnectionError(_ interface{}, err error) exec.ErrorType {
Expand All @@ -77,9 +73,7 @@ func CheckConnectionError(_ interface{}, err error) exec.ErrorType {
func IsConnectionError(err error) bool {
var awsErr awserr.Error

if errors.As(err, &awsErr) {
err = awsErr.OrigErr()
}
errors.As(err, &awsErr)

return exec.IsConnectionError(awsErr)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/conc/ddb_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func newDdbLock(manager *ddbLockProvider, ctx context.Context, resource string,

func (l *ddbLock) Renew(ctx context.Context, lockTime time.Duration) error {
if l == nil {
return NotOwnedError
return ErrNotOwnedError
}

err := l.manager.renew(ctx, lockTime, l.resource, l.token)
Expand All @@ -44,7 +44,7 @@ func (l *ddbLock) Renew(ctx context.Context, lockTime time.Duration) error {

func (l *ddbLock) Release() error {
if l == nil {
return NotOwnedError
return ErrNotOwnedError
}

// stop the debug thread if needed
Expand Down
6 changes: 3 additions & 3 deletions pkg/conc/ddb_lock_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (m *ddbLockProvider) Acquire(ctx context.Context, resource string) (Distrib
}

if result.ConditionalCheckFailed {
return OwnedLockError
return ErrOwnedLockError
}

m.logger.WithContext(ctx).WithFields(mon.Fields{
Expand Down Expand Up @@ -143,7 +143,7 @@ func (m *ddbLockProvider) renew(ctx context.Context, lockTime time.Duration, res
}

if result.ConditionalCheckFailed {
return backoff.Permanent(NotOwnedError)
return backoff.Permanent(ErrNotOwnedError)
}

m.logger.WithContext(ctx).WithFields(mon.Fields{
Expand All @@ -170,7 +170,7 @@ func (m *ddbLockProvider) release(ctx context.Context, resource string, token st
}

if result.ConditionalCheckFailed {
return NotOwnedError
return ErrNotOwnedError
}

m.logger.WithContext(ctx).WithFields(mon.Fields{
Expand Down
10 changes: 5 additions & 5 deletions pkg/conc/ddb_lock_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ func (s *ddbLockProviderTestSuite) TestDdbLockProvider_AcquireCanceled() {
// (although that should always fail)
err = l.Renew(s.ctx, time.Hour)
s.Error(err)
s.Equal(conc.NotOwnedError, err)
s.Equal(conc.ErrNotOwnedError, err)

err = l.Release()
s.Error(err)
s.Equal(conc.NotOwnedError, err)
s.Equal(conc.ErrNotOwnedError, err)

qb.AssertExpectations(s.T())
s.repo.AssertExpectations(s.T())
Expand All @@ -180,7 +180,7 @@ func (s *ddbLockProviderTestSuite) TestDdbLockProvider_AcquireFails() {
l, err := s.provider.Acquire(s.ctx, s.resource[5:])
s.Nil(l)
s.Error(err)
s.Equal(conc.OwnedLockError, err)
s.Equal(conc.ErrOwnedLockError, err)

qb.AssertExpectations(s.T())
s.repo.AssertExpectations(s.T())
Expand All @@ -202,7 +202,7 @@ func (s *ddbLockProviderTestSuite) TestDdbLockProvider_AcquireThenReleaseTooLate

err := l.Release()
s.Error(err)
s.Equal(conc.NotOwnedError, err)
s.Equal(conc.ErrNotOwnedError, err)

qb.AssertExpectations(s.T())
s.repo.AssertExpectations(s.T())
Expand Down Expand Up @@ -274,7 +274,7 @@ func (s *ddbLockProviderTestSuite) TestDdbLockProvider_AcquireThenRenewFails() {

err := l.Renew(s.ctx, time.Hour)
s.Error(err)
s.Equal(conc.NotOwnedError, err)
s.Equal(conc.ErrNotOwnedError, err)

qb.AssertExpectations(s.T())
s.repo.AssertExpectations(s.T())
Expand Down
8 changes: 4 additions & 4 deletions pkg/conc/distributed_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
)

// you failed to acquire a lock before the operation timed out
var OwnedLockError = errors.New("lock owned")
var ErrOwnedLockError = errors.New("lock owned")

// you tried to release a lock which you (no longer) own. Make sure
// you are not releasing a lock twice and are releasing a lock in a timely manner.
var NotOwnedError = errors.New("the lock was not (no longer) owned by you")
var ErrNotOwnedError = errors.New("the lock was not (no longer) owned by you")

//go:generate mockery -name DistributedLockProvider
type DistributedLockProvider interface {
Expand All @@ -29,10 +29,10 @@ type DistributedLock interface {
// now + 5 seconds).
// Aborts the operation if the context gets canceled before
// the operation finishes.
// Might fail with NotOwnedError if you are no longer the
// Might fail with ErrNotOwnedError if you are no longer the
// owner of the lock.
Renew(ctx context.Context, lockTime time.Duration) error
// Release a lock. Might fail with NotOwnedError if you are
// Release a lock. Might fail with ErrNotOwnedError if you are
// releasing a lock too late.
Release() error
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/conc/poisoned_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
)

var AlreadyPoisonedErr = errors.New("lock was already poisoned")
var ErrAlreadyPoisonedErr = errors.New("lock was already poisoned")

//go:generate mockery -name=PoisonedLock
type PoisonedLock interface {
Expand All @@ -26,7 +26,7 @@ func (p *poisonedLock) TryLock() error {
if p.poisoned {
p.lck.Unlock()

return AlreadyPoisonedErr
return ErrAlreadyPoisonedErr
}

return nil
Expand Down

0 comments on commit 8f6affc

Please sign in to comment.