diff --git a/.golangci.yml b/.golangci.yml index 7bbf235..ff9c34c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,7 +15,7 @@ linters: - dupl # Tool for code clone detection - goconst # Finds repeated strings that could be replaced by a constant - gocyclo # Computes and checks the cyclomatic complexity of functions - - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification + - goimports - misspell # Finds commonly misspelled English words in comments - lll # Reports long lines - unparam # Reports unused function parameters diff --git a/examples/demo-standard-http/main.go b/examples/demo-standard-http/main.go index 5ce3b5d..8dc7698 100644 --- a/examples/demo-standard-http/main.go +++ b/examples/demo-standard-http/main.go @@ -1,8 +1,9 @@ package main import ( - "github.com/alexisvisco/kcd" "net/http" + + "github.com/alexisvisco/kcd" ) func main() { diff --git a/handler_test.go b/handler_test.go index 1e73cc5..2a8c1da 100644 --- a/handler_test.go +++ b/handler_test.go @@ -1,13 +1,14 @@ package kcd_test import ( - "github.com/alexisvisco/kcd/pkg/errors" "net/http" "net/http/httptest" "strings" "testing" "time" + "github.com/alexisvisco/kcd/pkg/errors" + "github.com/gavv/httpexpect" "github.com/go-chi/chi" "github.com/stretchr/testify/assert" diff --git a/pkg/hook/bind.go b/pkg/hook/bind.go index 0205a7b..c2d0cac 100644 --- a/pkg/hook/bind.go +++ b/pkg/hook/bind.go @@ -2,7 +2,7 @@ package hook import ( "encoding/json" - "io/ioutil" + "io" "net/http" "strings" @@ -21,7 +21,7 @@ func Bind(maxBodyBytes int64) BindHook { } r.Body = http.MaxBytesReader(w, r.Body, maxBodyBytes) - bytesBody, err := ioutil.ReadAll(r.Body) + bytesBody, err := io.ReadAll(r.Body) if err != nil { return errors.Wrap(err, "unable to read body").WithKind(kcderr.InputCritical) } diff --git a/pkg/hook/validate.go b/pkg/hook/validate.go index 24f12d0..5cf6a8c 100644 --- a/pkg/hook/validate.go +++ b/pkg/hook/validate.go @@ -3,7 +3,7 @@ package hook import ( "context" - "github.com/alexisvisco/ozzo-validation/v4" + validation "github.com/alexisvisco/ozzo-validation/v4" ) // Validate is the default validation hook.