make staticcheck happy
This commit is contained in:
parent
84ba65e13e
commit
4e8b2beea1
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import this because it appears in exported API
|
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import this because it appears in exported API
|
||||||
|
|
@ -41,7 +41,7 @@ type DescriptorSource interface {
|
||||||
func DescriptorSourceFromProtoSets(fileNames ...string) (DescriptorSource, error) {
|
func DescriptorSourceFromProtoSets(fileNames ...string) (DescriptorSource, error) {
|
||||||
files := &descriptorpb.FileDescriptorSet{}
|
files := &descriptorpb.FileDescriptorSet{}
|
||||||
for _, fileName := range fileNames {
|
for _, fileName := range fileNames {
|
||||||
b, err := ioutil.ReadFile(fileName)
|
b, err := os.ReadFile(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not load protoset file %q: %v", fileName, err)
|
return nil, fmt.Errorf("could not load protoset file %q: %v", fileName, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package grpcurl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import this because it appears in exported API
|
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import this because it appears in exported API
|
||||||
|
|
@ -34,7 +34,7 @@ func TestWriteProtoset(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadProtoset(path string) (*descriptorpb.FileDescriptorSet, error) {
|
func loadProtoset(path string) (*descriptorpb.FileDescriptorSet, error) {
|
||||||
b, err := ioutil.ReadFile(path)
|
b, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
@ -545,7 +544,7 @@ func ClientTLSConfig(insecureSkipVerify bool, cacertFile, clientCertFile, client
|
||||||
} else if cacertFile != "" {
|
} else if cacertFile != "" {
|
||||||
// Create a certificate pool from the certificate authority
|
// Create a certificate pool from the certificate authority
|
||||||
certPool := x509.NewCertPool()
|
certPool := x509.NewCertPool()
|
||||||
ca, err := ioutil.ReadFile(cacertFile)
|
ca, err := os.ReadFile(cacertFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not read ca certificate: %v", err)
|
return nil, fmt.Errorf("could not read ca certificate: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -582,7 +581,7 @@ func ServerTransportCredentials(cacertFile, serverCertFile, serverKeyFile string
|
||||||
if cacertFile != "" {
|
if cacertFile != "" {
|
||||||
// Create a certificate pool from the certificate authority
|
// Create a certificate pool from the certificate authority
|
||||||
certPool := x509.NewCertPool()
|
certPool := x509.NewCertPool()
|
||||||
ca, err := ioutil.ReadFile(cacertFile)
|
ca, err := os.ReadFile(cacertFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not read ca certificate: %v", err)
|
return nil, fmt.Errorf("could not read ca certificate: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
@ -130,7 +129,7 @@ type svr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *svr) load() error {
|
func (s *svr) load() error {
|
||||||
accts, err := ioutil.ReadFile(s.datafile)
|
accts, err := os.ReadFile(s.datafile)
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +161,7 @@ func (s *svr) flush() {
|
||||||
|
|
||||||
if b, err := json.Marshal(accounts); err != nil {
|
if b, err := json.Marshal(accounts); err != nil {
|
||||||
grpclog.Errorf("failed to save data to %q", s.datafile)
|
grpclog.Errorf("failed to save data to %q", s.datafile)
|
||||||
} else if err := ioutil.WriteFile(s.datafile, b, 0666); err != nil {
|
} else if err := os.WriteFile(s.datafile, b, 0666); err != nil {
|
||||||
grpclog.Errorf("failed to save data to %q", s.datafile)
|
grpclog.Errorf("failed to save data to %q", s.datafile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue