Skip to content

Commit

Permalink
Fix linting issues (#9)
Browse files Browse the repository at this point in the history
* Update linters

* Replace deprecated ioutil
  • Loading branch information
ab-cf authored Mar 26, 2024
1 parent 736be76 commit a12f497
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Check code formatting
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v4
with:
version: v1.29
version: v1.54

test:
strategy:
matrix:
go-version:
- 1.14.x
- 1.15.x
- 1.16.x
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Test
run: go test ./...
4 changes: 2 additions & 2 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
)

Expand Down Expand Up @@ -56,7 +56,7 @@ func (b *APIKeyBackend) Request(ctx context.Context, method, path string, payloa
return fmt.Errorf("unable to perform HTTP request: %w", err)
}
defer resp.Body.Close()
body, err = ioutil.ReadAll(resp.Body)
body, err = io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("unable to read from HTTP response body: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package hasty
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"strings"
Expand All @@ -24,7 +24,7 @@ type testReq struct {
func TestAPIKeyBackend(t *testing.T) {
reqs := make(chan testReq, 1)
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
reqs <- testReq{
method: r.Method,
path: r.URL.Path,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/cloudfactory/hasty-go

go 1.14
go 1.21

0 comments on commit a12f497

Please # to comment.