Skip to content
Open
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: 3 additions & 3 deletions client/workflow/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package workflow
import (
"bytes"
"errors"
"io/ioutil"
"io"
"net/http"
"strconv"

Expand Down Expand Up @@ -71,8 +71,8 @@ func newRoundTripper(old http.RoundTripper, wf *Workflow) http.RoundTripper {
// HTTPResp2DtmError check for dtm error and return it
func HTTPResp2DtmError(resp *http.Response) ([]byte, error) {
code := resp.StatusCode
data, err := ioutil.ReadAll(resp.Body)
resp.Body = ioutil.NopCloser(bytes.NewBuffer(data))
data, err := io.ReadAll(resp.Body)
resp.Body = io.NopCloser(bytes.NewBuffer(data))
if code == http.StatusTooEarly {
return data, dtmcli.ErrorMessage2Error(string(data), dtmcli.ErrOngoing)
} else if code == http.StatusConflict {
Expand Down
4 changes: 2 additions & 2 deletions dtmsvr/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

import (
"encoding/json"
"io/ioutil"
"os"

"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/logger"
Expand Down Expand Up @@ -113,7 +113,7 @@ var Config = Type{}
func MustLoadConfig(confFile string) {
loadFromEnv("", &Config)
if confFile != "" {
cont, err := ioutil.ReadFile(confFile)
cont, err := os.ReadFile(confFile)
logger.FatalIfError(err)
err = yaml.Unmarshal(cont, &Config)
logger.FatalIfError(err)
Expand Down
6 changes: 3 additions & 3 deletions dtmutil/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
Expand All @@ -37,7 +37,7 @@ func GetGinApp() *gin.Engine {
dtmimp.E2P(err)
if len(rb) > 0 {
body = string(rb)
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(rb))
c.Request.Body = io.NopCloser(bytes.NewBuffer(rb))
}
}
logger.Debugf("begin %s %s body: %s", c.Request.Method, c.Request.URL, body)
Expand Down Expand Up @@ -160,7 +160,7 @@ func RunSQLScript(conf dtmcli.DBConf, script string, skipDrop bool) {
con, err := dtmimp.StandaloneDB(conf)
logger.FatalIfError(err)
defer func() { _ = con.Close() }()
content, err := ioutil.ReadFile(script)
content, err := os.ReadFile(script)
logger.FatalIfError(err)
sqls := strings.Split(string(content), ";")
for _, sql := range sqls {
Expand Down
4 changes: 2 additions & 2 deletions test/busi/base_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"database/sql"
"errors"
"fmt"
"io/ioutil"
"io"
"strings"

"github.com/dtm-labs/dtm/client/dtmcli"
Expand Down Expand Up @@ -86,7 +86,7 @@ func RunHTTP(app *gin.Engine) {
// BaseAddRoute add base route handler
func BaseAddRoute(app *gin.Engine) {
app.POST(BusiAPI+"/workflow/resume", dtmutil.WrapHandler(func(ctx *gin.Context) interface{} {
data, err := ioutil.ReadAll(ctx.Request.Body)
data, err := io.ReadAll(ctx.Request.Body)
logger.FatalIfError(err)
return workflow.ExecuteByQS(ctx.Request.URL.Query(), data)
}))
Expand Down