refactor: move from io/ioutil to io and os package (#2236)
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -98,7 +97,7 @@ func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
|
||||
}()
|
||||
|
||||
// parse request
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
e := "error reading request body"
|
||||
builder.logger.Error(e, zap.Error(err))
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
|
||||
builder "github.com/fission/fission/pkg/builder"
|
||||
"github.com/fission/fission/pkg/builder"
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
otelUtils "github.com/fission/fission/pkg/utils/otel"
|
||||
"github.com/fission/fission/pkg/utils/tracing"
|
||||
@@ -91,7 +91,7 @@ func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
rBody, err := ioutil.ReadAll(resp.Body)
|
||||
rBody, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
logger.Error("error reading resp body", zap.Error(err))
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user