Skip to content

Commit

Permalink
Merge pull request #87 from rsharifnasab/main
Browse files Browse the repository at this point in the history
Update go and deps version
  • Loading branch information
1995parham authored Nov 23, 2024
2 parents 7489c12 + 3799dcc commit 5f48d89
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 83 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Go

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.23.2

- name: lint
uses: golangci/golangci-lint-action@v6
Expand Down
15 changes: 3 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
run:
skip-files:
issues:
exclude-files:
- ".*_test.go"
linters:
enable-all: true
Expand All @@ -9,18 +9,9 @@ linters:
# it should improve to support more known patterns
- varnamelen
# deprecated linters
- varcheck
- deadcode
- nosnakecase
- revive
- ifshort
- structcheck
- maligned
- scopelint
- golint
- interfacer
- exhaustivestruct
- ireturn
- cyclop
- wrapcheck
- nolintlint
- exportloopref
14 changes: 7 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/json"
"time"

quic "github.com/lucas-clemente/quic-go"
quic "github.com/quic-go/quic-go"
"github.com/snapp-incubator/qsse/internal"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -42,7 +42,7 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
processedConfig := processConfig(config)
l := internal.NewLogger().Named("client")

connection, err := quic.DialAddr(address, processedConfig.TLSConfig, nil)
connection, err := quic.DialAddr(context.Background(), address, processedConfig.TLSConfig, nil)
if err != nil {
if processedConfig.ReconnectPolicy.Retry {
l.Warn("Failed to connect to server, retrying...")
Expand Down Expand Up @@ -90,12 +90,12 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
stream, err := connection.OpenUniStream()
if err != nil {
l.Error("failed to open send stream", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToCreateStream,
internal.ErrFailedToCreateStream,
)

if err != nil {
l.Error("failed to close client connection", zap.Error(err))
}
Expand All @@ -106,12 +106,12 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
err = internal.WriteData(bytes, stream)
if err != nil {
l.Error("failed to send offer to server", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToSendOffer,
internal.ErrFailedToSendOffer,
)

if err != nil {
l.Error("failed to close client connection", zap.Error(err))
}
Expand All @@ -124,12 +124,12 @@ func NewClient(address string, topics []string, config *ClientConfig) (Client, e
receiveStream, err := connection.AcceptUniStream(context.Background())
if err != nil {
l.Error("failed to open receive stream", zap.Error(err))

err = internal.CloseClientConnection(
connection,
internal.CodeFailedToCreateStream,
internal.ErrFailedToCreateStream,
)

if err != nil {
l.Error("failed to close client connection", zap.Error(err))
}
Expand Down Expand Up @@ -173,8 +173,8 @@ func processConfig(config *ClientConfig) ClientConfig {

//nolint:typecheck
func reconnect(policy ReconnectPolicy, address string, tlcCfg *tls.Config, l *zap.Logger) (quic.Connection, bool) {
for i := 0; i < policy.RetryTimes; i++ {
connection, err := quic.DialAddr(address, tlcCfg, nil)
for range policy.RetryTimes {
connection, err := quic.DialAddr(context.Background(), address, tlcCfg, nil)
if err == nil {
return connection, true
}
Expand Down
3 changes: 2 additions & 1 deletion examples/multiple-generators/server/generator.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"github.com/snapp-incubator/qsse"
"math/rand"
"time"

"github.com/snapp-incubator/qsse"
)

func RandomText(length int) []byte {
Expand Down
28 changes: 13 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/snapp-incubator/qsse

go 1.19
go 1.23.3

require (
github.com/go-errors/errors v1.5.1
github.com/lucas-clemente/quic-go v0.31.1
github.com/mehditeymorian/koi v1.0.1
github.com/prometheus/client_golang v1.19.1
github.com/quic-go/quic-go v0.48.1
github.com/stretchr/testify v1.9.0
github.com/tchap/zapext/v2 v2.1.1
go.uber.org/atomic v1.11.0
Expand All @@ -18,24 +18,22 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.4 // indirect
github.com/marten-seemann/qtls-go1-19 v0.1.2 // indirect
github.com/onsi/ginkgo/v2 v2.9.7 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/tools v0.9.3 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 5f48d89

Please sign in to comment.