From b2359d59694bd3c3c687f95a554028dee6bf694c Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 17 May 2022 15:35:02 -0400 Subject: [PATCH] Require go1.18 --- .github/workflows/unit.yml | 6 +----- actions.go | 3 +-- actions_test.go | 14 +++++++------- go.mod | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index e796c1d..78bccc4 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -39,11 +39,7 @@ jobs: - 'windows-latest' - 'macos-latest' go: - - '1.13' - - '1.14' - - '1.15' - - '1.16' - - '1.17' + - '1.18' runs-on: '${{ matrix.os }}' diff --git a/actions.go b/actions.go index fe64af0..0a5980c 100644 --- a/actions.go +++ b/actions.go @@ -23,7 +23,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "os" @@ -391,7 +390,7 @@ func (c *Action) GetIDToken(ctx context.Context, audience string) (string, error // This has moved to the io package in Go 1.16, but we still support up to Go // 1.13 for now. - body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 64*1000)) + body, err := io.ReadAll(io.LimitReader(resp.Body, 64*1000)) if err != nil { return "", fmt.Errorf("failed to read response body: %w", err) } diff --git a/actions_test.go b/actions_test.go index 37b1272..acab714 100644 --- a/actions_test.go +++ b/actions_test.go @@ -18,7 +18,7 @@ import ( "bytes" "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "os" @@ -71,7 +71,7 @@ func TestAction_IssueCommand(t *testing.T) { func TestAction_IssueFileCommand(t *testing.T) { t.Parallel() - file, err := ioutil.TempFile("", "") + file, err := os.CreateTemp("", "") if err != nil { t.Fatalf("unable to create a temp env file: %s", err) } @@ -95,7 +95,7 @@ func TestAction_IssueFileCommand(t *testing.T) { } // expect the message to be written to the env file - data, err := ioutil.ReadFile(file.Name()) + data, err := os.ReadFile(file.Name()) if err != nil { t.Errorf("unable to read temp env file: %s", err) } @@ -147,7 +147,7 @@ func TestAction_AddPath(t *testing.T) { const envGitHubPath = "GITHUB_PATH" // expect a file command to be issued when env file is set. - file, err := ioutil.TempFile("", "") + file, err := os.CreateTemp("", "") if err != nil { t.Fatalf("unable to create a temp env file: %s", err) } @@ -169,7 +169,7 @@ func TestAction_AddPath(t *testing.T) { } // expect the message to be written to the file. - data, err := ioutil.ReadAll(file) + data, err := io.ReadAll(file) if err != nil { t.Errorf("unable to read temp env file: %s", err) } @@ -234,7 +234,7 @@ func TestAction_SetEnv(t *testing.T) { // expectations for env file env commands var b bytes.Buffer - file, err := ioutil.TempFile("", "") + file, err := os.CreateTemp("", "") if err != nil { t.Fatalf("unable to create a temp env file: %s", err) } @@ -251,7 +251,7 @@ func TestAction_SetEnv(t *testing.T) { } // expect the command to be written to the file. - data, err := ioutil.ReadAll(file) + data, err := io.ReadAll(file) if err != nil { t.Errorf("unable to read temp env file: %s", err) } diff --git a/go.mod b/go.mod index 7b7e6e7..77a201f 100644 --- a/go.mod +++ b/go.mod @@ -14,4 +14,4 @@ module github.com/sethvargo/go-githubactions -go 1.13 +go 1.18