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

[triggers/cmd] clean up ioutil for new go version #1497

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 1 addition & 2 deletions cmd/binding-eval/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -138,7 +137,7 @@ func readHTTP(path string) (*http.Request, []byte, error) {
return nil, nil, fmt.Errorf("error reading request: %w", err)
}
defer req.Body.Close()
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
if err != nil {
return nil, nil, fmt.Errorf("error reading HTTP body: %w", err)
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/cel-eval/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -118,7 +117,7 @@ func readExpression(path string) (string, error) {
}
defer f.Close()

data, err := ioutil.ReadAll(f)
data, err := io.ReadAll(f)
if err != nil {
return "", fmt.Errorf("error reading from file: %w", err)
}
Expand All @@ -138,7 +137,7 @@ func readHTTP(path string) (*http.Request, []byte, error) {
return nil, nil, fmt.Errorf("error reading request: %w", err)
}
defer req.Body.Close()
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
if err != nil {
return nil, nil, fmt.Errorf("error reading HTTP body: %w", err)
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/triggerrun/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -179,13 +178,13 @@ func readHTTP(path string) (*http.Request, []byte, error) {
return nil, nil, fmt.Errorf("error reading HTTP file: %w", err)
}

body, err := ioutil.ReadAll(request.Body)
body, err := io.ReadAll(request.Body)
defer request.Body.Close()
if err != nil {
return nil, nil, fmt.Errorf("error reading HTTP body: %w", err)
}

request.Body = ioutil.NopCloser(bytes.NewReader(body))
request.Body = io.NopCloser(bytes.NewReader(body))

return request, body, err
}
Expand Down