Skip to content

Commit d7f6fff

Browse files
authored
Update deps and CI (#36)
1 parent 4ab54ab commit d7f6fff

File tree

18 files changed

+163
-131
lines changed

18 files changed

+163
-131
lines changed

.github/workflows/bench.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
GO111MODULE: "on"
2222
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
2323
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
24-
GO_VERSION: 1.22.x
24+
GO_VERSION: 1.23.x
2525
jobs:
2626
bench:
2727
runs-on: ubuntu-latest

.github/workflows/golangci-lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
steps:
2222
- uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.22.x
24+
go-version: 1.23.x
2525
- uses: actions/checkout@v2
2626
- name: golangci-lint
27-
uses: golangci/golangci-lint-action@v3.7.0
27+
uses: golangci/golangci-lint-action@v6.1.0
2828
with:
2929
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
30-
version: v1.55.2
30+
version: v1.61.0
3131

3232
# Optional: working directory, useful for monorepos
3333
# working-directory: somedir

.github/workflows/gorelease.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
GO_VERSION: 1.22.x
12+
GO_VERSION: 1.23.x
1313
jobs:
1414
gorelease:
1515
runs-on: ubuntu-latest

.github/workflows/release-assets.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- created
99
env:
1010
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
GO_VERSION: 1.22.x
11+
GO_VERSION: 1.23.x
1212
jobs:
1313
build:
1414
name: Upload Release Assets

.github/workflows/test-unit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
test:
2222
strategy:
2323
matrix:
24-
go-version: [ 1.19.x, 1.20.x, 1.21.x, 1.22.x ]
24+
go-version: [ 1.22.x, 1.23.x ]
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Install Go stable

.golangci.yml

+13-14
Original file line numberDiff line numberDiff line change
@@ -20,60 +20,59 @@ linters-settings:
2020
linters:
2121
enable-all: true
2222
disable:
23+
- err113
2324
- noctx
2425
- errorlint
2526
- cyclop
26-
- goerr113
2727
- gomnd
2828
- gocyclo
2929
- gochecknoglobals
3030
- funlen
3131
- gocognit
3232
- lll
33-
- maligned
3433
- gochecknoglobals
3534
- gomnd
3635
- wrapcheck
3736
- paralleltest
3837
- forbidigo
39-
- exhaustivestruct
40-
- interfacer # deprecated
4138
- forcetypeassert
42-
- scopelint # deprecated
43-
- ifshort # too many false positives
44-
- golint # deprecated
4539
- varnamelen
4640
- tagliatelle
4741
- errname
4842
- ireturn
4943
- exhaustruct
5044
- nonamedreturns
51-
- nosnakecase
52-
- structcheck
53-
- varcheck
54-
- deadcode
5545
- testableexamples
5646
- dupword
5747
- depguard
5848
- tagalign
49+
- execinquery
50+
- mnd
51+
- testifylint
52+
- intrange
5953

6054
issues:
6155
exclude-use-default: false
6256
exclude-rules:
6357
- linters:
6458
- gomnd
59+
- mnd
6560
- goconst
66-
- goerr113
6761
- noctx
6862
- funlen
6963
- dupl
70-
- structcheck
7164
- unused
7265
- unparam
73-
- nosnakecase
7466
path: "_test.go"
7567
- linters:
7668
- errcheck # Error checking omitted for brevity.
7769
- gosec
7870
path: "example_"
71+
- linters:
72+
- errcheck
73+
text: "Error return value of `fmt.Fprint"
74+
- linters:
75+
- revive
76+
text: "unused-parameter: parameter"
77+
7978

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#GOLANGCI_LINT_VERSION := "v1.55.2" # Optional configuration to pinpoint golangci-lint version.
1+
#GOLANGCI_LINT_VERSION := "v1.61.0" # Optional configuration to pinpoint golangci-lint version.
22

33
# The head of Makefile determines location of dev-go to include standard targets.
44
GO ?= go

_examples/cplt/cplt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"net/http"
55
"strconv"
66

7-
"github.com/alecthomas/kingpin"
7+
"github.com/alecthomas/kingpin/v2"
88
"github.com/vearutop/plt/curl"
99
"github.com/vearutop/plt/loadgen"
1010
"github.com/vearutop/plt/nethttp"

curl/cmd.go

+24-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import (
55
"encoding/base64"
66
"errors"
77
"fmt"
8-
"log"
98
"net/http"
109
"regexp"
1110
"strings"
1211

13-
"github.com/alecthomas/kingpin"
12+
"github.com/alecthomas/kingpin/v2"
1413
"github.com/vearutop/plt/fasthttp"
1514
"github.com/vearutop/plt/loadgen"
1615
"github.com/vearutop/plt/nethttp"
1716
)
1817

1918
// AddCommand registers curl command into CLI app.
19+
//
20+
//nolint:maintidx
2021
func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp.Flags, j loadgen.JobProducer)) {
2122
var (
2223
flags nethttp.Flags
@@ -25,6 +26,8 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
2526
data []string
2627
compressed bool
2728
user string
29+
output string
30+
head bool
2831
}
2932
captureStrings = map[string]*[]string{
3033
"header": &capture.header,
@@ -38,11 +41,13 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
3841
"url": &flags.URL,
3942
"request": &flags.Method,
4043
"user": &capture.user,
44+
"output": &capture.output,
4145
}
4246
captureBool = map[string]*bool{
4347
"compressed": &capture.compressed,
4448
"no-keepalive": &flags.NoKeepalive,
4549
"http2": &flags.HTTP2,
50+
"head": &capture.head,
4651
}
4752
ignoredString = map[string]*string{}
4853
ignoredBool = map[string]*bool{}
@@ -118,18 +123,21 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
118123

119124
curl.Action(func(kp *kingpin.ParseContext) error {
120125
ignoredFlags := make([]string, 0)
126+
121127
for f, v := range ignoredString {
122128
if v != nil && *v != "" {
123129
ignoredFlags = append(ignoredFlags, f)
124130
}
125131
}
132+
126133
for f, v := range ignoredBool {
127134
if v != nil && *v {
128135
ignoredFlags = append(ignoredFlags, f)
129136
}
130137
}
138+
131139
if len(ignoredFlags) > 0 {
132-
log.Printf("Warning, these Flags are ignored: %v\n", ignoredFlags)
140+
return fmt.Errorf("these flags are ignored: %v", ignoredFlags)
133141
}
134142

135143
if len(capture.data) == 1 {
@@ -139,13 +147,19 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
139147
}
140148

141149
flags.HeaderMap = make(map[string]string, len(capture.header))
150+
142151
if capture.user != "" {
143152
if !strings.Contains(capture.user, ":") {
144153
return errors.New("user parameter must be in form user:pass")
145154
}
155+
146156
flags.HeaderMap["Authorization"] = "Basic " + base64.StdEncoding.EncodeToString([]byte(capture.user))
147157
}
148158

159+
if capture.head {
160+
flags.Method = http.MethodHead
161+
}
162+
149163
if flags.Body != "" {
150164
flags.HeaderMap["Content-Type"] = "application/x-www-form-urlencoded"
151165

@@ -159,13 +173,20 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
159173
if len(parts) != 2 {
160174
continue
161175
}
176+
162177
flags.HeaderMap[http.CanonicalHeaderKey(parts[0])] = strings.Trim(parts[1], " ")
163178
}
179+
164180
if capture.compressed {
165181
if _, ok := flags.HeaderMap["Accept-Encoding"]; !ok {
166182
flags.HeaderMap["Accept-Encoding"] = "gzip, deflate"
167183
}
168184
}
185+
186+
if flags.NoKeepalive && (capture.output == "/dev/null" || capture.output == "nul") {
187+
flags.IgnoreResponseBody = true
188+
}
189+
169190
if !strings.HasPrefix(strings.ToLower(flags.URL), "http://") &&
170191
!strings.HasPrefix(strings.ToLower(flags.URL), "https://") {
171192
flags.URL = "http://" + flags.URL

fasthttp/job_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
func TestNewJobProducer(t *testing.T) {
19-
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
19+
srv := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
2020
require.Equal(t, "/?foo=bar", r.URL.RequestURI())
2121
}))
2222
defer srv.Close()
@@ -43,7 +43,7 @@ func TestNewJobProducer(t *testing.T) {
4343
j, err := fh.NewJobProducer(f)
4444
require.NoError(t, err)
4545

46-
j.PrepareRequest = func(i int, req *fasthttp.Request) error {
46+
j.PrepareRequest = func(_ int, req *fasthttp.Request) error {
4747
req.SetRequestURI(srv.URL + "/?foo=bar")
4848

4949
return nil
@@ -56,7 +56,7 @@ func TestNewJobProducer(t *testing.T) {
5656
}
5757

5858
func BenchmarkJobProducer_Job(b *testing.B) {
59-
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
59+
srv := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
6060
require.Equal(b, "/?foo=bar", r.URL.RequestURI())
6161
}))
6262
defer srv.Close()
@@ -82,7 +82,7 @@ func BenchmarkJobProducer_Job(b *testing.B) {
8282
j, err := fh.NewJobProducer(f)
8383
require.NoError(b, err)
8484

85-
j.PrepareRequest = func(i int, req *fasthttp.Request) error {
85+
j.PrepareRequest = func(_ int, req *fasthttp.Request) error {
8686
req.SetRequestURI(srv.URL + "/?foo=bar")
8787

8888
return nil

go.mod

+25-22
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
module github.com/vearutop/plt
22

3-
go 1.21
3+
go 1.22.0
4+
5+
toolchain go1.23.0
46

57
require (
6-
github.com/alecthomas/kingpin v2.2.6+incompatible
7-
github.com/aws/aws-sdk-go v1.50.21
8-
github.com/bool64/dev v0.2.33
8+
github.com/alecthomas/kingpin/v2 v2.4.0
9+
github.com/aws/aws-sdk-go v1.55.5
10+
github.com/bool64/dev v0.2.36
911
github.com/gizak/termui/v3 v3.1.0
1012
github.com/nsf/termbox-go v1.1.1
11-
github.com/quic-go/quic-go v0.41.0
12-
github.com/stretchr/testify v1.8.4
13-
github.com/valyala/fasthttp v1.52.0
13+
github.com/quic-go/quic-go v0.47.0
14+
github.com/stretchr/testify v1.9.0
15+
github.com/valyala/fasthttp v1.55.0
1416
github.com/vearutop/dynhist-go v1.2.2
15-
golang.org/x/net v0.21.0
16-
golang.org/x/time v0.5.0
17+
golang.org/x/net v0.29.0
18+
golang.org/x/time v0.6.0
1719
)
1820

1921
require (
20-
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
21-
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
22+
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect
2223
github.com/andybalholm/brotli v1.1.0 // indirect
2324
github.com/davecgh/go-spew v1.1.1 // indirect
24-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
25-
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
25+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
26+
github.com/google/pprof v0.0.0-20240903155634-a8630aee4ab9 // indirect
2627
github.com/jmespath/go-jmespath v0.4.0 // indirect
27-
github.com/klauspost/compress v1.17.6 // indirect
28+
github.com/klauspost/compress v1.17.9 // indirect
2829
github.com/kr/text v0.2.0 // indirect
2930
github.com/mattn/go-runewidth v0.0.13 // indirect
3031
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
31-
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
32+
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
3233
github.com/pmezard/go-difflib v1.0.0 // indirect
33-
github.com/quic-go/qpack v0.4.0 // indirect
34+
github.com/quic-go/qpack v0.5.1 // indirect
3435
github.com/rivo/uniseg v0.2.0 // indirect
3536
github.com/valyala/bytebufferpool v1.0.0 // indirect
37+
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
3638
go.uber.org/mock v0.4.0 // indirect
37-
golang.org/x/crypto v0.19.0 // indirect
38-
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
39-
golang.org/x/mod v0.15.0 // indirect
40-
golang.org/x/sys v0.17.0 // indirect
41-
golang.org/x/text v0.14.0 // indirect
42-
golang.org/x/tools v0.18.0 // indirect
39+
golang.org/x/crypto v0.27.0 // indirect
40+
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
41+
golang.org/x/mod v0.21.0 // indirect
42+
golang.org/x/sync v0.8.0 // indirect
43+
golang.org/x/sys v0.25.0 // indirect
44+
golang.org/x/text v0.18.0 // indirect
45+
golang.org/x/tools v0.25.0 // indirect
4346
gopkg.in/yaml.v2 v2.4.0 // indirect
4447
gopkg.in/yaml.v3 v3.0.1 // indirect
4548
)

0 commit comments

Comments
 (0)