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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 23 deletions

View File

@ -1070,10 +1070,13 @@ func main() {
},
})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Println("could not greet: ", err)
}
if r != nil {
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
```
@ -1172,10 +1175,13 @@ func main() {
},
})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Println("could not greet: ", err)
}
if r != nil {
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
```

View File

@ -457,5 +457,5 @@ Retry:
goto Retry
}
return
return resp, nil
}

View File

@ -58,7 +58,7 @@ func TestIOSNotificationStructure(t *testing.T) {
test := "test"
expectBadge := 0
message := "Welcome notification Server"
expiration := int64(time.Now().Unix())
expiration := time.Now().Unix()
req := &PushNotification{
ApnsID: test,
Topic: test,

View File

@ -228,7 +228,7 @@ Retry:
goto Retry
}
return
return resp, nil
}
func logPush(cfg *config.ConfYaml, status, token string, req *PushNotification, err error) logx.LogPushEntry {

View File

@ -227,5 +227,5 @@ Retry:
goto Retry
}
return
return resp, nil
}

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 {

View File

@ -50,8 +50,11 @@ func main() {
},
})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Println("could not greet: ", err)
}
if r != nil {
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}