This is an automated email from the ASF dual-hosted git repository.
kvn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new b7fa57e fix: fix lint errors (#207)
b7fa57e is described below
commit b7fa57efe8fe0beab807329b9675289f878e5997
Author: rootlh <[email protected]>
AuthorDate: Mon Jan 25 16:42:26 2021 +0800
fix: fix lint errors (#207)
---
cmd/ingress/ingress_test.go | 2 +-
pkg/api/router/router.go | 1 -
pkg/apisix/cluster.go | 6 +++---
pkg/ingress/apisix/tls_test.go | 3 +--
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/cmd/ingress/ingress_test.go b/cmd/ingress/ingress_test.go
index 6d6d78a..bd46d2c 100644
--- a/cmd/ingress/ingress_test.go
+++ b/cmd/ingress/ingress_test.go
@@ -99,7 +99,7 @@ func TestSignalHandler(t *testing.T) {
assert.Nil(t, syscall.Kill(os.Getpid(), syscall.SIGINT))
<-waitCh
- msg := string(fws.buf.Bytes())
+ msg := fws.buf.String()
assert.Contains(t, msg, fmt.Sprintf("signal %d (%s) received",
syscall.SIGINT, syscall.SIGINT.String()))
assert.Contains(t, msg, "apisix ingress controller exited")
}
diff --git a/pkg/api/router/router.go b/pkg/api/router/router.go
index 4a5b892..57e82d2 100644
--- a/pkg/api/router/router.go
+++ b/pkg/api/router/router.go
@@ -32,7 +32,6 @@ func mountHealthz(r *gin.Engine) {
func healthz(c *gin.Context) {
c.AbortWithStatusJSON(http.StatusOK, healthzResponse{Status: "ok"})
- return
}
func mountMetrics(r *gin.Engine) {
diff --git a/pkg/apisix/cluster.go b/pkg/apisix/cluster.go
index b23e34f..d73a193 100644
--- a/pkg/apisix/cluster.go
+++ b/pkg/apisix/cluster.go
@@ -108,12 +108,12 @@ func (c *cluster) syncCache() {
defer func() {
if c.cacheSyncErr == nil {
log.Infow("cache synced",
- zap.String("cost_time",
time.Now().Sub(now).String()),
+ zap.String("cost_time",
time.Since(now).String()),
zap.String("cluster", c.name),
)
} else {
log.Errorw("failed to sync cache",
- zap.String("cost_time",
time.Now().Sub(now).String()),
+ zap.String("cost_time",
time.Since(now).String()),
zap.String("cluster", c.name),
)
}
@@ -219,7 +219,7 @@ func (c *cluster) HasSynced(ctx context.Context) error {
log.Errorf("failed to wait cluster to ready: %s", ctx.Err())
return ctx.Err()
case <-c.cacheSynced:
- log.Warnf("cluster %s now is ready, cost time %s", c.name,
time.Now().Sub(now).String())
+ log.Warnf("cluster %s now is ready, cost time %s", c.name,
time.Since(now).String())
return nil
}
}
diff --git a/pkg/ingress/apisix/tls_test.go b/pkg/ingress/apisix/tls_test.go
index 49a0259..23adc79 100644
--- a/pkg/ingress/apisix/tls_test.go
+++ b/pkg/ingress/apisix/tls_test.go
@@ -16,7 +16,6 @@ package apisix
import (
"encoding/json"
- "fmt"
"testing"
"github.com/stretchr/testify/assert"
@@ -151,7 +150,7 @@ func (sc *SecretClientMock) FindByName(namespace, name
string) (*v1.Secret, erro
`
secret := &v1.Secret{}
if err := json.Unmarshal([]byte(secretStr), secret); err != nil {
- fmt.Errorf(err.Error())
+ return nil, err
}
return secret, nil
}