Skip to content

Commit

Permalink
Update deps and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop committed Sep 10, 2024
1 parent 4ab54ab commit e36184a
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
GO111MODULE: "on"
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
GO_VERSION: 1.22.x
GO_VERSION: 1.23.x
jobs:
bench:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
uses: golangci/golangci-lint-action@v6.1.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.55.2
version: v1.61.0

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: true

env:
GO_VERSION: 1.22.x
GO_VERSION: 1.23.x
jobs:
gorelease:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- created
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO_VERSION: 1.22.x
GO_VERSION: 1.23.x
jobs:
build:
name: Upload Release Assets
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test:
strategy:
matrix:
go-version: [ 1.19.x, 1.20.x, 1.21.x, 1.22.x ]
go-version: [ 1.22.x, 1.23.x ]
runs-on: ubuntu-latest
steps:
- name: Install Go stable
Expand Down
27 changes: 13 additions & 14 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,60 +20,59 @@ linters-settings:
linters:
enable-all: true
disable:
- err113
- noctx
- errorlint
- cyclop
- goerr113
- gomnd
- gocyclo
- gochecknoglobals
- funlen
- gocognit
- lll
- maligned
- gochecknoglobals
- gomnd
- wrapcheck
- paralleltest
- forbidigo
- exhaustivestruct
- interfacer # deprecated
- forcetypeassert
- scopelint # deprecated
- ifshort # too many false positives
- golint # deprecated
- varnamelen
- tagliatelle
- errname
- ireturn
- exhaustruct
- nonamedreturns
- nosnakecase
- structcheck
- varcheck
- deadcode
- testableexamples
- dupword
- depguard
- tagalign
- execinquery
- mnd
- testifylint
- intrange

issues:
exclude-use-default: false
exclude-rules:
- linters:
- gomnd
- mnd
- goconst
- goerr113
- noctx
- funlen
- dupl
- structcheck
- unused
- unparam
- nosnakecase
path: "_test.go"
- linters:
- errcheck # Error checking omitted for brevity.
- gosec
path: "example_"
- linters:
- errcheck
text: "Error return value of `fmt.Fprint"
- linters:
- revive
text: "unused-parameter: parameter"


2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#GOLANGCI_LINT_VERSION := "v1.55.2" # Optional configuration to pinpoint golangci-lint version.
#GOLANGCI_LINT_VERSION := "v1.61.0" # Optional configuration to pinpoint golangci-lint version.

# The head of Makefile determines location of dev-go to include standard targets.
GO ?= go
Expand Down
2 changes: 1 addition & 1 deletion _examples/cplt/cplt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"strconv"

"github.com/alecthomas/kingpin"
"github.com/alecthomas/kingpin/v2"
"github.com/vearutop/plt/curl"
"github.com/vearutop/plt/loadgen"
"github.com/vearutop/plt/nethttp"
Expand Down
27 changes: 24 additions & 3 deletions curl/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import (
"encoding/base64"
"errors"
"fmt"
"log"
"net/http"
"regexp"
"strings"

"github.com/alecthomas/kingpin"
"github.com/alecthomas/kingpin/v2"
"github.com/vearutop/plt/fasthttp"
"github.com/vearutop/plt/loadgen"
"github.com/vearutop/plt/nethttp"
)

// AddCommand registers curl command into CLI app.
//
//nolint:maintidx
func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp.Flags, j loadgen.JobProducer)) {
var (
flags nethttp.Flags
Expand All @@ -25,6 +26,8 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
data []string
compressed bool
user string
output string
head bool

Check notice on line 30 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

20 statement(s) on lines 21:60 are not covered by tests.
}
captureStrings = map[string]*[]string{
"header": &capture.header,
Expand All @@ -38,11 +41,13 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
"url": &flags.URL,
"request": &flags.Method,
"user": &capture.user,
"output": &capture.output,

Check notice on line 44 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

20 statement(s) on lines 21:60 are not covered by tests.
}
captureBool = map[string]*bool{
"compressed": &capture.compressed,
"no-keepalive": &flags.NoKeepalive,
"http2": &flags.HTTP2,
"head": &capture.head,

Check notice on line 50 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

20 statement(s) on lines 21:60 are not covered by tests.
}
ignoredString = map[string]*string{}
ignoredBool = map[string]*bool{}
Expand Down Expand Up @@ -118,18 +123,21 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp

curl.Action(func(kp *kingpin.ParseContext) error {
ignoredFlags := make([]string, 0)

Check notice on line 126 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

4 statement(s) on lines 124:127 are not covered by tests.
for f, v := range ignoredString {
if v != nil && *v != "" {
ignoredFlags = append(ignoredFlags, f)
}
}

for f, v := range ignoredBool {
if v != nil && *v {
ignoredFlags = append(ignoredFlags, f)
}
}

if len(ignoredFlags) > 0 {
log.Printf("Warning, these Flags are ignored: %v\n", ignoredFlags)
return fmt.Errorf("these flags are ignored: %v", ignoredFlags)

Check notice on line 140 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

2 statement(s) on lines 139:141 are not covered by tests.
}

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

flags.HeaderMap = make(map[string]string, len(capture.header))

Check notice on line 150 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

4 statement(s) on lines 149:151 are not covered by tests.
if capture.user != "" {
if !strings.Contains(capture.user, ":") {
return errors.New("user parameter must be in form user:pass")
}

flags.HeaderMap["Authorization"] = "Basic " + base64.StdEncoding.EncodeToString([]byte(capture.user))
}

if capture.head {
flags.Method = http.MethodHead
}

Check notice on line 161 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

4 statement(s) are not covered by tests.

if flags.Body != "" {
flags.HeaderMap["Content-Type"] = "application/x-www-form-urlencoded"

Expand All @@ -159,13 +173,20 @@ func AddCommand(lf *loadgen.Flags, options ...func(lf *loadgen.Flags, f *nethttp
if len(parts) != 2 {
continue
}

flags.HeaderMap[http.CanonicalHeaderKey(parts[0])] = strings.Trim(parts[1], " ")
}

if capture.compressed {
if _, ok := flags.HeaderMap["Accept-Encoding"]; !ok {
flags.HeaderMap["Accept-Encoding"] = "gzip, deflate"
}
}

if flags.NoKeepalive && (capture.output == "/dev/null" || capture.output == "nul") {
flags.IgnoreResponseBody = true
}

Check notice on line 188 in curl/cmd.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

4 statement(s) are not covered by tests.

if !strings.HasPrefix(strings.ToLower(flags.URL), "http://") &&
!strings.HasPrefix(strings.ToLower(flags.URL), "https://") {
flags.URL = "http://" + flags.URL
Expand Down
8 changes: 4 additions & 4 deletions fasthttp/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

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

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

return nil
Expand All @@ -56,7 +56,7 @@ func TestNewJobProducer(t *testing.T) {
}

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

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

return nil
Expand Down
47 changes: 25 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
module github.com/vearutop/plt

go 1.21
go 1.22.0

toolchain go1.23.0

require (
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/aws/aws-sdk-go v1.50.21
github.com/bool64/dev v0.2.33
github.com/alecthomas/kingpin/v2 v2.4.0
github.com/aws/aws-sdk-go v1.55.5
github.com/bool64/dev v0.2.36
github.com/gizak/termui/v3 v3.1.0
github.com/nsf/termbox-go v1.1.1
github.com/quic-go/quic-go v0.41.0
github.com/stretchr/testify v1.8.4
github.com/valyala/fasthttp v1.52.0
github.com/quic-go/quic-go v0.47.0
github.com/stretchr/testify v1.9.0
github.com/valyala/fasthttp v1.55.0
github.com/vearutop/dynhist-go v1.2.2
golang.org/x/net v0.21.0
golang.org/x/time v0.5.0
golang.org/x/net v0.29.0
golang.org/x/time v0.6.0
)

require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect
github.com/andybalholm/brotli v1.1.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/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20240903155634-a8630aee4ab9 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.25.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit e36184a

Please sign in to comment.