Skip to content

Commit 4b38ef3

Browse files
committed
chore: upgrade go toolchain to 1.18
Signed-off-by: Young Xu <xuthus5@gmail.com>
1 parent cada562 commit 4b38ef3

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

env/config/json/json_config.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,19 @@ package json
2020
import (
2121
"encoding/json"
2222
"errors"
23-
"io/ioutil"
2423
"os"
2524

2625
"github.com/apolloconfig/agollo/v4/component/log"
2726
"github.com/apolloconfig/agollo/v4/utils"
2827
)
2928

30-
//ConfigFile json文件读写
29+
// ConfigFile json文件读写
3130
type ConfigFile struct {
3231
}
3332

34-
//Load json文件读
33+
// Load json文件读
3534
func (t *ConfigFile) Load(fileName string, unmarshal func([]byte) (interface{}, error)) (interface{}, error) {
36-
fs, err := ioutil.ReadFile(fileName)
35+
fs, err := os.ReadFile(fileName)
3736
if err != nil {
3837
return nil, errors.New("Fail to read config file:" + err.Error())
3938
}
@@ -47,7 +46,7 @@ func (t *ConfigFile) Load(fileName string, unmarshal func([]byte) (interface{},
4746
return config, nil
4847
}
4948

50-
//Write json文件写
49+
// Write json文件写
5150
func (t *ConfigFile) Write(content interface{}, configPath string) error {
5251
if content == nil {
5352
log.Error("content is null can not write backup file")

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module github.com/apolloconfig/agollo/v4
22

3+
go 1.20
4+
35
require (
46
github.com/agiledragon/gomonkey/v2 v2.13.0
57
github.com/spf13/viper v1.8.1
@@ -17,10 +19,8 @@ require (
1719
github.com/spf13/jwalterweatherman v1.1.0 // indirect
1820
github.com/spf13/pflag v1.0.5 // indirect
1921
github.com/subosito/gotenv v1.2.0 // indirect
20-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
21-
golang.org/x/text v0.3.5 // indirect
22+
golang.org/x/sys v0.1.0 // indirect
23+
golang.org/x/text v0.3.8 // indirect
2224
gopkg.in/ini.v1 v1.62.0 // indirect
2325
gopkg.in/yaml.v2 v2.4.0 // indirect
2426
)
25-
26-
go 1.20

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,19 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w
391391
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
392392
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
393393
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
394-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
395394
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
395+
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
396+
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
396397
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
397398
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
398399
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
399400
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
400401
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
401402
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
402403
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
403-
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
404404
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
405+
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
406+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
405407
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
406408
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
407409
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

protocol/http/request.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121
"crypto/tls"
2222
"errors"
2323
"fmt"
24-
"io/ioutil"
24+
"io"
2525
"net"
2626
"net/http"
27-
url2 "net/url"
27+
"net/url"
2828
"strings"
2929
"sync"
3030
"time"
@@ -97,13 +97,13 @@ func Request(requestURL string, connectionConfig *env.ConnectConfig, callBack *C
9797
client.Timeout = connectTimeout
9898
}
9999
var err error
100-
url, err := url2.Parse(requestURL)
100+
u, err := url.Parse(requestURL)
101101
if err != nil {
102102
log.Errorf("request Apollo Server url: %q is invalid: %v", requestURL, err)
103103
return nil, err
104104
}
105105
var insecureSkipVerify bool
106-
if strings.HasPrefix(url.Scheme, "https") {
106+
if strings.HasPrefix(u.Scheme, "https") {
107107
insecureSkipVerify = true
108108
}
109109
client.Transport = getDefaultTransport(insecureSkipVerify)
@@ -157,7 +157,7 @@ func Request(requestURL string, connectionConfig *env.ConnectConfig, callBack *C
157157
switch res.StatusCode {
158158
case http.StatusOK:
159159
var responseBody []byte
160-
responseBody, err = ioutil.ReadAll(res.Body)
160+
responseBody, err = io.ReadAll(res.Body)
161161
if err != nil {
162162
log.Errorf("Connect Apollo Server Fail, url: %s , error: %v", requestURL, err)
163163
// if error then sleep

0 commit comments

Comments
 (0)