fix(lint): warning from golangci-lint tool
https://github.com/appleboy/gorush/issues/704 Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -33,6 +33,7 @@ type LogPushEntry struct {
|
||||
|
||||
var isTerm bool
|
||||
|
||||
//nolint
|
||||
func init() {
|
||||
isTerm = isatty.IsTerminal(os.Stdout.Fd())
|
||||
}
|
||||
|
||||
@@ -11,13 +11,15 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var invalidLevel = "invalid"
|
||||
|
||||
func TestSetLogLevel(t *testing.T) {
|
||||
log := logrus.New()
|
||||
|
||||
err := SetLogLevel(log, "debug")
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = SetLogLevel(log, "invalid")
|
||||
err = SetLogLevel(log, invalidLevel)
|
||||
assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error())
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@ func TestInitDefaultLog(t *testing.T) {
|
||||
cfg.Log.ErrorLog,
|
||||
))
|
||||
|
||||
cfg.Log.AccessLevel = "invalid"
|
||||
cfg.Log.AccessLevel = invalidLevel
|
||||
|
||||
assert.NotNil(t, InitLog(
|
||||
cfg.Log.AccessLevel,
|
||||
@@ -71,7 +73,7 @@ func TestInitDefaultLog(t *testing.T) {
|
||||
func TestAccessLevel(t *testing.T) {
|
||||
cfg, _ := config.LoadConf()
|
||||
|
||||
cfg.Log.AccessLevel = "invalid"
|
||||
cfg.Log.AccessLevel = invalidLevel
|
||||
|
||||
assert.NotNil(t, InitLog(
|
||||
cfg.Log.AccessLevel,
|
||||
@@ -84,7 +86,7 @@ func TestAccessLevel(t *testing.T) {
|
||||
func TestErrorLevel(t *testing.T) {
|
||||
cfg, _ := config.LoadConf()
|
||||
|
||||
cfg.Log.ErrorLevel = "invalid"
|
||||
cfg.Log.ErrorLevel = invalidLevel
|
||||
|
||||
assert.NotNil(t, InitLog(
|
||||
cfg.Log.AccessLevel,
|
||||
|
||||
Reference in New Issue
Block a user