chore(lint): fix some condition. (#624)

This commit is contained in:
Bo-Yi Wu
2021-08-04 09:00:04 +08:00
committed by GitHub
parent 0a8d801380
commit ea71e99f2d
8 changed files with 27 additions and 23 deletions

View File

@@ -30,14 +30,7 @@ import (
"golang.org/x/crypto/acme/autocert"
)
var (
isTerm bool
doOnce sync.Once
)
func init() {
isTerm = isatty.IsTerminal(os.Stdout.Fd())
}
var doOnce sync.Once
func abortWithError(c *gin.Context, code int, message string) {
c.AbortWithStatusJSON(code, gin.H{
@@ -179,6 +172,7 @@ func routerEngine(cfg *config.ConfYaml, q *queue.Queue) *gin.Engine {
log.Logger = zerolog.New(os.Stdout).With().Timestamp().Logger()
isTerm := isatty.IsTerminal(os.Stdout.Fd())
if isTerm {
log.Logger = log.Output(
zerolog.ConsoleWriter{

View File

@@ -54,12 +54,13 @@ func TestMain(m *testing.M) {
queue.WithWorkerCount(4),
)
q.Start()
code := m.Run()
defer func() {
q.Shutdown()
q.Wait()
os.Exit(code)
}()
os.Exit(m.Run())
}
func initTest() *config.ConfYaml {