Skip to content

Commit

Permalink
Merge pull request #12 from krakend/deepsource_suggested_improvements
Browse files Browse the repository at this point in the history
Deepsource suggested improvements
  • Loading branch information
kpacha authored Sep 18, 2024
2 parents 2051d65 + 5379521 commit 074846c
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 118 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.23

- name: Test
run: go test -v ./...
4 changes: 2 additions & 2 deletions detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestNew_rejectEmptyHeader(t *testing.T) {
return
}

req, _ := http.NewRequest("GET", "http://example.com", http.NoBody)
req, _ := http.NewRequest("GET", "http://example.com", http.NoBody) // skipcq: GO-S1028
req.Header.Add("User-Agent", "")
if !d(req) {
t.Error("req with empty User-Agent has not been detected as a bot")
Expand Down Expand Up @@ -74,7 +74,7 @@ func testDetection(f DetectorFunc) error {
"c",
"Pingdom.com_bot_version_1.1",
} {
req, _ := http.NewRequest("GET", "http://example.com", http.NoBody)
req, _ := http.NewRequest("GET", "http://example.com", http.NoBody) // skipcq: GO-S1028
req.Header.Add("User-Agent", ua)
if f(req) {
return fmt.Errorf("the req #%d has been detected as a bot: %s", i, ua)
Expand Down
40 changes: 25 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
module github.com/krakendio/krakend-botdetector/v2

go 1.17
go 1.19

require (
github.com/gin-gonic/gin v1.7.7
github.com/gin-gonic/gin v1.9.1
github.com/hashicorp/golang-lru v0.5.1
github.com/luraproject/lura/v2 v2.0.5
github.com/luraproject/lura/v2 v2.7.0
)

require (
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/krakendio/flatmap v1.1.1 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 074846c

Please sign in to comment.