valyala / fasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
MIT License
21.91k stars 1.76k forks source link

Enable wastedassign, whitespace linters; fix issues #1665

Closed alexandear closed 1 year ago

alexandear commented 1 year ago

This PR enables wastedassign and whitespace linters. And fixes the following issues:

❯ golangci-lint run
server.go:2294: unnecessary leading newline (whitespace)
                if ctx.Request.MayContinue() {

tcpdialer.go:378: unnecessary trailing newline (whitespace)

        }
server_test.go:1922: unnecessary leading newline (whitespace)
        for i := 0; i < 25; i++ {

args.go:554:2: assigned to idx, but reassigned without using the value (wastedassign)
        idx := 0
        ^
server.go:1849:3: assigned to c, but reassigned without using the value (wastedassign)
                c = nil
                ^
server.go:2587:2: assigned to ctx, but reassigned without using the value (wastedassign)
        ctx = nil
        ^
workerpool.go:113:8: assigned to mid, but reassigned without using the value (wastedassign)
        l, r, mid := 0, n-1, 0
              ^
workerpool.go:241:3: assigned to c, but reassigned without using the value (wastedassign)
                c = nil
                ^
streaming_test.go:34:4: assigned to body, but reassigned without using the value (wastedassign)
                        body := ""
                        ^
erikdubbelboer commented 1 year ago

Thanks! I like it!