Skip to content
Open
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
18 changes: 9 additions & 9 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,32 @@ jobs:
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
- uses: actions/checkout@v3
go-version: '1.26'
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v7
with:
version: v1.50
version: v2.11.3
env:
CGO_ENABLED: 0
tests:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
- uses: actions/checkout@v3
go-version: '1.26'
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run natsjs tests
run: |
cd natsjs/
go test -v -cover ./...
env:
CGO_ENABLED: 0
CGO_ENABLED: 0
164 changes: 99 additions & 65 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,17 @@
linters-settings:
dupl:
threshold: 100
funlen:
lines: 120
statements: 60
gci:
local-prefixes: github.com/velmie/broker
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 20
goimports:
local-prefixes: github.com/velmie/broker
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: [ argument,case,condition,return ]
govet:
check-shadowing: true
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

version: "2"
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
default: none
enable:
- bodyclose
- deadcode
- dogsled
- errcheck
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
Expand All @@ -67,23 +20,104 @@ linters:
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

issues:
exclude-rules:
- linters:
- funlen
path: _test\.go$
run:
timeout: 5m
skip-dirs:
- vendor
- cmd
- test*
settings:
dupl:
threshold: 100
funlen:
lines: 120
statements: 60
goconst:
min-len: 2
min-occurrences: 2
errcheck:
# Common ack/close patterns in tests and tear-downs; team historically
# ignores these errors per legacy v1.50 config.
exclude-functions:
- (*github.com/nats-io/nats.go.Msg).Ack
- (*github.com/nats-io/nats.go.Msg).AckSync
- (*github.com/nats-io/nats.go.Msg).Nak
- (*github.com/nats-io/nats.go.Msg).NakWithDelay
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
# Pre-existing patterns kept for parity with legacy v1 config.
- appendAssign
- hugeParam
- sloppyReassign
- elseif
gocyclo:
min-complexity: 20
lll:
line-length: 145
misspell:
locale: US
nolintlint:
require-explanation: false
require-specific: false
allow-unused: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Tests: relaxed rules (parity with legacy v1 behavior).
- linters:
- errcheck
- funlen
- goconst
- gocritic
- gochecknoinits
- gosec
- govet
- lll
- mnd
- misspell
- staticcheck
- unparam
- whitespace
path: _test\.go$
# otelbroker middleware: pre-existing patterns kept for parity.
- linters:
- staticcheck
- unparam
path: otelbroker/middleware\.go$
# azuresb: pre-existing patterns kept for parity.
- linters:
- gosec
path: azuresb/subscription\.go$
text: 'G118'
- linters:
- misspell
path: azuresb/receiver\.go$
text: 'cancelled'
paths:
- third_party$
- builtin$
- examples$
- _examples
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/velmie/broker
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
1 change: 1 addition & 0 deletions azuresb/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus"
"github.com/pkg/errors"

"github.com/velmie/broker"
)

Expand Down
1 change: 1 addition & 0 deletions azuresb/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus"
"github.com/stretchr/testify/require"

"github.com/velmie/broker"

"github.com/velmie/broker/azuresb"
Expand Down
3 changes: 2 additions & 1 deletion idempotency/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"strings"
"time"

"github.com/velmie/broker"
"github.com/velmie/idempo"

"github.com/velmie/broker"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion idempotency/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"strconv"
"strings"

"github.com/velmie/broker"
"github.com/velmie/idempo"

"github.com/velmie/broker"
)

const defaultOperation = "consume"
Expand Down
5 changes: 3 additions & 2 deletions idempotency/middleware_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"testing"
"time"

"github.com/velmie/broker"
"github.com/velmie/broker/idempotency"
"github.com/velmie/idempo"
"github.com/velmie/idempo/memory"

"github.com/velmie/broker"
"github.com/velmie/broker/idempotency"
)

func TestMiddleware_PanicsOnNilEngine(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions idempotency/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"errors"
"testing"

"github.com/velmie/broker"
"github.com/velmie/broker/idempotency"
"github.com/velmie/idempo"
"github.com/velmie/idempo/memory"

"github.com/velmie/broker"
"github.com/velmie/broker/idempotency"
)

type testEvent struct {
Expand Down
12 changes: 6 additions & 6 deletions natsjs/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/velmie/broker/natsjs/v2

go 1.19
go 1.26

require (
github.com/nats-io/nats.go v1.25.0
github.com/nats-io/nats.go v1.52.0
github.com/ory/dockertest/v3 v3.10.0
github.com/pkg/errors v0.9.1
github.com/velmie/broker v0.2.1-0.20230206145033-e6db259820e4
Expand All @@ -22,10 +22,10 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/nats-io/nats-server/v2 v2.9.16 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nkeys v0.4.15 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
Expand All @@ -34,9 +34,9 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/tools v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading
Loading