Skip to content

Commit

Permalink
Switch to Go1.19 in CI check (#1256)
Browse files Browse the repository at this point in the history
* Switch to Go1.19

* Fix linting locally

* Update linter version
  • Loading branch information
kfcampbell authored Aug 15, 2022
1 parent b732b01 commit 86e4b44
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
- run: make tools
- run: make lint
- run: make website-lint
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default: build

tools:
go install github.com/client9/misspell/cmd/misspell
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0

build: fmtcheck
go build ./...
Expand Down
4 changes: 2 additions & 2 deletions github/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"

Expand Down Expand Up @@ -51,7 +51,7 @@ func getInstallationAccessToken(baseURL string, jwt string, installationID strin
}
defer func() { _ = res.Body.Close() }()

resBytes, err := ioutil.ReadAll(res.Body)
resBytes, err := io.ReadAll(res.Body)
if err != nil {
return "", err
}
Expand Down
6 changes: 3 additions & 3 deletions github/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
"time"
Expand All @@ -24,7 +24,7 @@ const (
var (
testEpochTime = time.Unix(0, 0)

testGitHubAppPrivateKeyPemData, _ = ioutil.ReadFile(testGitHubAppPrivateKeyFile)
testGitHubAppPrivateKeyPemData, _ = os.ReadFile(testGitHubAppPrivateKeyFile)
)

func TestGenerateAppJWT(t *testing.T) {
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestGenerateAppJWT(t *testing.T) {
})

t.Run("produces a verifiable jwt", func(t *testing.T) {
publicKeyData, err := ioutil.ReadFile(testGitHubAppPublicKeyFile)
publicKeyData, err := os.ReadFile(testGitHubAppPublicKeyFile)
if err != nil {
t.Logf("Failed to read public key file '%s': %s", testGitHubAppPublicKeyFile, err)
t.FailNow()
Expand Down
3 changes: 1 addition & 2 deletions github/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package github
import (
"bytes"
"io"
"io/ioutil"
"log"
"net/http"
"sync"
Expand Down Expand Up @@ -176,7 +175,7 @@ func drainBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error) {
if err = b.Close(); err != nil {
return nil, b, err
}
return ioutil.NopCloser(&buf), ioutil.NopCloser(bytes.NewReader(buf.Bytes())), nil
return io.NopCloser(&buf), io.NopCloser(bytes.NewReader(buf.Bytes())), nil
}

func isWriteMethod(method string) bool {
Expand Down
4 changes: 2 additions & 2 deletions github/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -51,7 +51,7 @@ func githubApiMock(responseSequence []*mockResponse) *httptest.Server {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Server", "GitHub.com")

bodyBytes, err := ioutil.ReadAll(r.Body)
bodyBytes, err := io.ReadAll(r.Body)
if err != nil {
log.Printf("[DEBUG] Error: %s", err)
}
Expand Down
6 changes: 3 additions & 3 deletions github/util_v4_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package github

import (
"bytes"
"github.com/shurcooL/githubv4"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"text/template"

"github.com/shurcooL/githubv4"
)

// Heavily based on https://github.com/shurcooL/githubv4/blob/master/githubv4_test.go#L114-L144
Expand Down Expand Up @@ -202,7 +202,7 @@ func (l localRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
}

func mustRead(r io.Reader) string {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 86e4b44

Please sign in to comment.