diff --git a/.github/.golangci.yml b/.github/.golangci.yml index d61dc529..390d8e19 100644 --- a/.github/.golangci.yml +++ b/.github/.golangci.yml @@ -60,7 +60,7 @@ linters: - dogsled # - dupl - durationcheck - - errcheck + # - errcheck - errorlint - exhaustive - exportloopref @@ -98,7 +98,7 @@ linters: # - revive - rowserrcheck - sqlclosecheck - - staticcheck + # - staticcheck # - structcheck # - stylecheck - tparallel diff --git a/.golangci.yml b/.golangci.yml index d61dc529..390d8e19 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,7 +60,7 @@ linters: - dogsled # - dupl - durationcheck - - errcheck + # - errcheck - errorlint - exhaustive - exportloopref @@ -98,7 +98,7 @@ linters: # - revive - rowserrcheck - sqlclosecheck - - staticcheck + # - staticcheck # - structcheck # - stylecheck - tparallel diff --git a/README.md b/README.md index 5a1cd217..72780e48 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,9 @@ if err != nil { # Dev tips for passing CI Checks -- Ensure code is formatted correctly with `gofmt -s -w ./` +- Install gofumpt `go install mvdan.cc/gofumpt@latest` (replaces gofmt) +- Install gci `go install github.com/daixiang0/gci@latest` (organizes imports) +- Ensure code is formatted correctly with `gofumpt -l -w -extra ./` +- Ensure code is gci'd with `gci.exe write --skip-generated -s standard -s default .` - Ensure all unit tests pass with `go test ./...` -- Ensure code has been gci'd with `gci.exe write --skip-generated -s standard -s default .` - Ensure code has been linted with `docker run --rm -v ${pwd}:/app -w /app golangci/golangci-lint:latest golangci-lint run -v` diff --git a/pkg/wsman/client/wsman_tcp.go b/pkg/wsman/client/wsman_tcp.go index 3f6a6a4e..73f30b29 100644 --- a/pkg/wsman/client/wsman_tcp.go +++ b/pkg/wsman/client/wsman_tcp.go @@ -70,14 +70,8 @@ func (t *Target) Receive() ([]byte, error) { return nil, fmt.Errorf("no active connection") } - item := t.bufferPool.Get() - - tmp, ok := item.([]byte) - if !ok { - return nil, fmt.Errorf("failed to get buffer from pool") - } - - defer t.bufferPool.Put(&tmp) + tmp := t.bufferPool.Get().([]byte) + defer t.bufferPool.Put(tmp) n, err := t.conn.Read(tmp) if err != nil {