Skip to content

Commit

Permalink
Merge pull request #3 from vmkteam/new-jetstream-api
Browse files Browse the repository at this point in the history
Migrate to new JetStream API, update linter settings, use go 1.22
  • Loading branch information
sas1024 authored Aug 12, 2024
2 parents ae5e115 + cf785b9 commit 50173a5
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 115 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.20.x'
go-version: '1.22.x'

- name: Test
env:
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-go-version: '1.20.x'
go-go-version: '1.22.x'

- name: Build
run: go build -v ./...
5 changes: 2 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- v*
branches:
- master
- main
pull_request:
permissions:
contents: read
Expand All @@ -18,13 +17,13 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20.x'
go-version: '1.22.x'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2
version: v1.59.1

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
36 changes: 14 additions & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ run:
# include test files or not, default is true
tests: true

# skip files
skip-files:
issues:
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- ".*\\_gen\\.go$"

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# Default:
# formats:
# - format: colored-line-number
# path: stdout
formats:
- format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
Expand All @@ -34,32 +44,14 @@ linters-settings:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-checks:
- appendAssign
- appendCombine
- assignOp
- badCond
- boolExprSimplify
- captLocal
- caseOrder
- defaultCaseOrder
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- emptyFallthrough
- emptyStringTest
- equalFold
- exitAfterDefer
- flagName
- hexLiteral
- indexAlloc
- nilValReturn
- offBy1
- regexpMust
- sloppyLen
- switchTrue
- wrapperFunc
- yodaStyleExpr

linters:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine AS builder
FROM golang:1.22-alpine AS builder
COPY . /build
RUN cd /build && go install -mod=mod ./cmd/brokersrv

Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,18 @@ RpcServices = [ "testsrv" ]
...

import (
"github.com/nats-io/nats.go"
"github.com/vmkteam/brokersrv/pkg/rpcqueue"
)

...

nc, err := nats.Connect("nats://localhost:4222", nats.Name("testsrv"), nats.MaxReconnects(100), nats.ReconnectWait(3*time.Second))
nc, err := rpcqueue.NewClient("nats://localhost:4222", "testsrv")

...

js, err := nc.JetStream()


...

rpcQueue := rpcqueue.New("testsrv", js, zenrpcSrv, someLoggerPrintF)

rpcQueue := rpcqueue.New("testsrv", nc.JetStreamConn, zenrpcSrv, someLoggerPrintF)
go rpcQueue.Run()

```

### Send test RPC request
Expand Down
27 changes: 13 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/vmkteam/brokersrv

go 1.20
go 1.22

require (
github.com/BurntSushi/toml v1.3.2
github.com/labstack/echo/v4 v4.11.4
github.com/BurntSushi/toml v1.4.0
github.com/labstack/echo/v4 v4.12.0
github.com/namsral/flag v1.7.4-pre
github.com/nats-io/nats.go v1.32.0
github.com/prometheus/client_golang v1.18.0
github.com/vmkteam/zenrpc-middleware v1.1.5
github.com/vmkteam/zenrpc/v2 v2.2.11
github.com/nats-io/nats.go v1.36.0
github.com/prometheus/client_golang v1.19.1
github.com/vmkteam/zenrpc-middleware v1.1.6
github.com/vmkteam/zenrpc/v2 v2.2.12
)

require (
Expand All @@ -24,11 +24,10 @@ require (
github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
Expand All @@ -37,10 +36,10 @@ require (
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
mellium.im/sasl v0.3.0 // indirect
)
Loading

0 comments on commit 50173a5

Please sign in to comment.