Skip to content

Commit

Permalink
pin golangci-lint version to latest available, fix reported errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal authored and umputun committed May 10, 2024
1 parent cbed6ed commit 30173d5
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 72 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
env:
TZ: "America/Chicago"
version: v1.58

- name: golangci-lint on example directory
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
args: --config ../../.golangci.yml
working-directory: examples/plugin

- name: install goveralls
run: |
Expand Down
18 changes: 6 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
run:
timeout: 5m
output:
format: tab
skip-dirs:
- vendor

linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0.1
maligned:
suggest-new: true
enable:
- shadow
goconst:
min-len: 2
min-occurrences: 2
Expand All @@ -33,13 +26,12 @@ linters-settings:

linters:
enable:
- megacheck
- staticcheck
- revive
- govet
- unconvert
- megacheck
- unused
- gas
- gosec
- gocyclo
- dupl
- misspell
Expand All @@ -57,6 +49,8 @@ linters:
disable-all: true

issues:
exclude-dirs:
- vendor
exclude-rules:
- text: "at least one file in a package should have a package comment"
linters:
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 4 additions & 3 deletions examples/plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
)

func main() {

// create demo plugin on port 1234 with two methods: HeaderThing and ErrorThing
// both called via RPC from reproxy core with fully formed lib.Request
plugin := lib.Plugin{
Expand All @@ -18,16 +17,17 @@ func main() {
Methods: []string{"HeaderThing", "ErrorThing"},
}
log.Printf("start demo plugin")
// Do starts the plugin listener and register with reproxy plugin conductor
// Do start the plugin listener and register with reproxy plugin conductor
if err := plugin.Do(context.TODO(), "http://reproxy:8081", new(Handler)); err != nil {
log.Fatal(err)
}
}

// Handler is an example of middleware handler altering headers and stastus
// Handler is an example of middleware handler altering headers and status
type Handler struct{}

// HeaderThing adds key:val header to the response
// nolint:unparam // error response is required by the interface
func (h *Handler) HeaderThing(req lib.Request, res *lib.Response) (err error) {
log.Printf("req: %+v", req)
res.HeadersOut = http.Header{}
Expand All @@ -39,6 +39,7 @@ func (h *Handler) HeaderThing(req lib.Request, res *lib.Response) (err error) {
}

// ErrorThing returns status 500 on "/fail" url. This terminated processing chain on reproxy side immediately
// nolint:unparam // error response is required by the interface
func (h *Handler) ErrorThing(req lib.Request, res *lib.Response) (err error) {
log.Printf("req: %+v", req)
if req.URL == "/fail" {
Expand Down
9 changes: 3 additions & 6 deletions examples/plugin/vendor/github.com/go-pkgz/lgr/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/plugin/vendor/github.com/go-pkgz/lgr/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions examples/plugin/vendor/github.com/go-pkgz/lgr/go.mod

This file was deleted.

12 changes: 0 additions & 12 deletions examples/plugin/vendor/github.com/go-pkgz/lgr/go.sum

This file was deleted.

30 changes: 26 additions & 4 deletions examples/plugin/vendor/github.com/go-pkgz/lgr/logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions examples/plugin/vendor/github.com/go-pkgz/lgr/options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions examples/plugin/vendor/github.com/go-pkgz/repeater/go.mod

This file was deleted.

7 changes: 0 additions & 7 deletions examples/plugin/vendor/github.com/go-pkgz/repeater/go.sum

This file was deleted.

15 changes: 11 additions & 4 deletions examples/plugin/vendor/github.com/umputun/reproxy/lib/plugin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions examples/plugin/vendor/github.com/umputun/reproxy/lib/rpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions examples/plugin/vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# github.com/go-pkgz/lgr v0.10.4
# github.com/go-pkgz/lgr v0.11.1
## explicit; go 1.20
github.com/go-pkgz/lgr
# github.com/go-pkgz/repeater v1.1.3
## explicit; go 1.12
github.com/go-pkgz/repeater
github.com/go-pkgz/repeater/strategy
# github.com/umputun/reproxy v0.6.0 => ../../
## explicit
# github.com/umputun/reproxy v0.999.0 => ../../
## explicit; go 1.22
github.com/umputun/reproxy/lib
# github.com/umputun/reproxy => ../../

0 comments on commit 30173d5

Please sign in to comment.