Permalink
Browse files

Linter cleanup GoMetaLinter:gas (#866)

The [Go AST Scanner](https://github.com/GoASTScanner/gas)
[recently](alecthomas/gometalinter@3e602d9)
was fixed. This PR makes the needed corrections in this repo.
  • Loading branch information...
gdbelvin committed Nov 27, 2017
1 parent 1820740 commit 8df18edff01d529cd3e2d265cc229abc7ae43643
View
@@ -29,7 +29,7 @@ install:
script:
- export TRILLIAN_SQL_DRIVER=mysql
- make
- gometalinter --config=metalinter.json ./...
- gometalinter --config=gometalinter.json ./...
- ./coverage.sh
after_success:
View
@@ -39,7 +39,7 @@ coverage: main
TRILLIAN_SQL_DRIVER=mysql go test ./... -cover
check:
gometalinter --config=metalinter.json ./...
gometalinter --config=gometalinter.json ./...
presubmit: test check
@@ -179,7 +179,7 @@ func transportCreds(ktURL string) (credentials.TransportCredentials, error) {
switch {
case insecure: // Impatient insecure.
return credentials.NewTLS(&tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, // nolint: gas
}), nil
case ktCert != "": // Custom CA Cert.
@@ -136,18 +136,25 @@ func main() {
}
func dial(url string, insecure bool) (*grpc.ClientConn, error) {
host, _, err := net.SplitHostPort(url)
tcreds, err := transportCreds(url, insecure)
if err != nil {
return nil, err
}
var tcreds credentials.TransportCredentials
if insecure {
tcreds = credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})
} else {
tcreds = credentials.NewClientTLSFromCert(nil, host)
}
// TODO(ismail): authenticate the monitor to the kt-server:
return grpc.Dial(url, grpc.WithTransportCredentials(tcreds))
}
func transportCreds(ktURL string, insecure bool) (credentials.TransportCredentials, error) {
host, _, err := net.SplitHostPort(ktURL)
if err != nil {
return nil, err
}
if insecure {
return credentials.NewTLS(&tls.Config{
InsecureSkipVerify: true, // nolint: gas
}), nil
}
return credentials.NewClientTLSFromCert(nil, host), nil
}
@@ -167,7 +167,7 @@ func transportCreds(ktURL string, insecure bool, ktTLSCertPEM []byte) (credentia
case insecure: // Impatient insecure.
Vlog.Printf("Warning: Skipping verification of KT Server's TLS certificate.")
return credentials.NewTLS(&tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, // nolint: gas
}), nil
case len(ktTLSCertPEM) != 0: // Custom CA Cert.
@@ -10,5 +10,6 @@
"Skip": ["core/proto", "impl/proto"],
"Deadline": "4m",
"Cyclo": 18,
"Aggregate": true
"Aggregate": true,
"Exclude": ["Errors unhandled.,LOW,HIGH \\(gas\\)"]
}
View
@@ -67,7 +67,7 @@ func NewDB(t testing.TB) *sql.DB {
// Listen opens a random local port and listens on it.
func Listen(t testing.TB) (string, net.Listener) {
lis, err := net.Listen("tcp", ":0")
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
t.Fatalf("Failed to listen: %v", err)
}
@@ -100,7 +100,7 @@ func vrfKeyGen(ctx context.Context, spec *keyspb.Specification) (proto.Message,
// NewEnv sets up common resources for tests.
func NewEnv(t *testing.T) *Env {
ctx := context.Background()
domainID := fmt.Sprintf("domain %d", rand.Int())
domainID := fmt.Sprintf("domain %d", rand.Int()) // nolint: gas
sqldb := NewDB(t)
// We can only run the integration tests if there is a MySQL instance available.

0 comments on commit 8df18ed

Please sign in to comment.