Skip to content

Commit a5fbe99

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

File tree

5 files changed

+35
-23
lines changed

5 files changed

+35
-23
lines changed

.github/workflows/go.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,20 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
14+
- uses: actions/checkout@v4
1615
- name: Set up Go
17-
uses: actions/setup-go@v2
16+
uses: actions/setup-go@v5
1817
with:
19-
go-version: 1.12
20-
21-
- name: Build
18+
go-version-file: "go.mod"
19+
- name: Coverage
2220
run: |
2321
go test -covermode=count -coverprofile=coverage.out ./...
24-
25-
- name: Convert coverage to lcov
26-
uses: jandelgado/gcov2lcov-action@v1.0.5
27-
2822
- name: Coveralls GitHub Action
29-
uses: coverallsapp/github-action@1.1.3
23+
uses: coverallsapp/github-action@v2
3024
with:
3125
github-token: ${{ secrets.GITHUB_TOKEN }}
32-
path-to-lcov: coverage.lcov
33-
26+
file: coverage.out
27+
format: golang
3428
- name: Build
3529
run: |
3630
go build -o "$Project"

env/config/json/json_config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package json
1717
import (
1818
"encoding/json"
1919
"errors"
20-
"io/ioutil"
2120
"os"
2221

2322
"github.com/apolloconfig/agollo/v4/component/log"
@@ -30,7 +29,7 @@ type ConfigFile struct {
3029

3130
// Load json文件读
3231
func (t *ConfigFile) Load(fileName string, unmarshal func([]byte) (interface{}, error)) (interface{}, error) {
33-
fs, err := ioutil.ReadFile(fileName)
32+
fs, err := os.ReadFile(fileName)
3433
if err != nil {
3534
return nil, errors.New("Fail to read config file:" + err.Error())
3635
}

go.mod

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
module github.com/apolloconfig/agollo/v4
22

3+
go 1.18
4+
35
require (
46
github.com/agiledragon/gomonkey/v2 v2.11.0
57
github.com/spf13/viper v1.8.1
68
github.com/tevid/gohamcrest v1.1.1
79
)
810

9-
go 1.13
11+
require (
12+
github.com/fsnotify/fsnotify v1.4.9 // indirect
13+
github.com/hashicorp/hcl v1.0.0 // indirect
14+
github.com/magiconair/properties v1.8.5 // indirect
15+
github.com/mitchellh/mapstructure v1.4.1 // indirect
16+
github.com/pelletier/go-toml v1.9.3 // indirect
17+
github.com/spf13/afero v1.6.0 // indirect
18+
github.com/spf13/cast v1.3.1 // indirect
19+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
20+
github.com/spf13/pflag v1.0.5 // indirect
21+
github.com/subosito/gotenv v1.2.0 // indirect
22+
golang.org/x/sys v0.1.0 // indirect
23+
golang.org/x/text v0.3.8 // indirect
24+
gopkg.in/ini.v1 v1.62.0 // indirect
25+
gopkg.in/yaml.v2 v2.4.0 // indirect
26+
)

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
@@ -18,10 +18,10 @@ import (
1818
"crypto/tls"
1919
"errors"
2020
"fmt"
21-
"io/ioutil"
21+
"io"
2222
"net"
2323
"net/http"
24-
url2 "net/url"
24+
"net/url"
2525
"strings"
2626
"sync"
2727
"time"
@@ -93,13 +93,13 @@ func Request(requestURL string, connectionConfig *env.ConnectConfig, callBack *C
9393
client.Timeout = connectTimeout
9494
}
9595
var err error
96-
url, err := url2.Parse(requestURL)
96+
u, err := url.Parse(requestURL)
9797
if err != nil {
9898
log.Errorf("request Apollo Server url: %q is invalid: %v", requestURL, err)
9999
return nil, err
100100
}
101101
var insecureSkipVerify bool
102-
if strings.HasPrefix(url.Scheme, "https") {
102+
if strings.HasPrefix(u.Scheme, "https") {
103103
insecureSkipVerify = true
104104
}
105105
client.Transport = getDefaultTransport(insecureSkipVerify)
@@ -153,7 +153,7 @@ func Request(requestURL string, connectionConfig *env.ConnectConfig, callBack *C
153153
switch res.StatusCode {
154154
case http.StatusOK:
155155
var responseBody []byte
156-
responseBody, err = ioutil.ReadAll(res.Body)
156+
responseBody, err = io.ReadAll(res.Body)
157157
if err != nil {
158158
log.Errorf("Connect Apollo Server Fail, url: %s , error: %v", requestURL, err)
159159
// if error then sleep

0 commit comments

Comments
 (0)