Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require go1.18 #42

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

Expand Down
7 changes: 2 additions & 5 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand All @@ -41,10 +40,8 @@ const (
setOutputCmd = "set-output"
saveStateCmd = "save-state"

addPathCmd = "add-path" // used when issuing the regular command
pathCmd = "path" // used when issuing the file command
pathCmd = "path" // used when issuing the file command

setEnvCmd = "set-env" // used when issuing the regular command
envCmd = "env" // used when issuing the file command
envCmdMsgFmt = "%s<<%s" + EOF + "%s" + EOF + "%s" // ${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}
envCmdDelimiter = "_GitHubActionsFileCommandDelimeter_"
Expand Down Expand Up @@ -391,7 +388,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)
}
Expand Down
14 changes: 7 additions & 7 deletions actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

module github.com/sethvargo/go-githubactions

go 1.13
go 1.18