use ioutil.ReadFile to release dependency of Go 1.16 (#217)

Signed-off-by: Sandy Xu <sandy@juicedata.io>
This commit is contained in:
Sandy Xu 2021-07-09 13:25:06 +08:00 committed by GitHub
parent a1adc5b85b
commit aadf3cf627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 11 deletions

View File

@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.15
- name: Test
run: go test ./...
@ -28,7 +28,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.15
- name: Test with race
run: go test -race ./...
@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.15
- name: Lint
uses: golangci/golangci-lint-action@v2

View File

@ -35,7 +35,7 @@ package config
import (
"crypto/tls"
"crypto/x509"
"os"
"io/ioutil"
"github.com/pingcap/errors"
)
@ -64,7 +64,7 @@ func (s *Security) ToTLSConfig() (tlsConfig *tls.Config, err error) {
certPool := x509.NewCertPool()
// Create a certificate pool from the certificate authority
var ca []byte
ca, err = os.ReadFile(s.ClusterSSLCA)
ca, err = ioutil.ReadFile(s.ClusterSSLCA)
if err != nil {
err = errors.Errorf("could not read ca certificate: %s", err)
return

View File

@ -33,6 +33,7 @@
package config
import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
@ -47,8 +48,8 @@ func TestTLSConfig(t *testing.T) {
keyFile := filepath.Join(filepath.Dir(localFile), "key.pem")
perm := os.FileMode(0666)
assert.Nil(t, os.WriteFile(certFile, []byte(cert), perm))
assert.Nil(t, os.WriteFile(keyFile, []byte(key), perm))
assert.Nil(t, ioutil.WriteFile(certFile, []byte(cert), perm))
assert.Nil(t, ioutil.WriteFile(keyFile, []byte(key), perm))
security := Security{
ClusterSSLCA: certFile,

View File

@ -1,6 +1,6 @@
module gcworker
go 1.16
go 1.15
require github.com/tikv/client-go/v2 v2.0.0

View File

@ -1,6 +1,6 @@
module rawkv
go 1.16
go 1.15
require github.com/tikv/client-go/v2 v2.0.0

View File

@ -1,6 +1,6 @@
module txnkv
go 1.16
go 1.15
require github.com/tikv/client-go/v2 v2.0.0

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/tikv/client-go/v2
go 1.16
go 1.15
require (
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548