chore(lint): fix some condition. (#624)
This commit is contained in:
parent
0a8d801380
commit
ea71e99f2d
10
README.md
10
README.md
|
@ -1070,10 +1070,13 @@ func main() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
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("Success: %t\n", r.Success)
|
||||||
log.Printf("Count: %d\n", r.Counts)
|
log.Printf("Count: %d\n", r.Counts)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1172,10 +1175,13 @@ func main() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
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("Success: %t\n", r.Success)
|
||||||
log.Printf("Count: %d\n", r.Counts)
|
log.Printf("Count: %d\n", r.Counts)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -457,5 +457,5 @@ Retry:
|
||||||
goto Retry
|
goto Retry
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ func TestIOSNotificationStructure(t *testing.T) {
|
||||||
test := "test"
|
test := "test"
|
||||||
expectBadge := 0
|
expectBadge := 0
|
||||||
message := "Welcome notification Server"
|
message := "Welcome notification Server"
|
||||||
expiration := int64(time.Now().Unix())
|
expiration := time.Now().Unix()
|
||||||
req := &PushNotification{
|
req := &PushNotification{
|
||||||
ApnsID: test,
|
ApnsID: test,
|
||||||
Topic: test,
|
Topic: test,
|
||||||
|
|
|
@ -228,7 +228,7 @@ Retry:
|
||||||
goto Retry
|
goto Retry
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func logPush(cfg *config.ConfYaml, status, token string, req *PushNotification, err error) logx.LogPushEntry {
|
func logPush(cfg *config.ConfYaml, status, token string, req *PushNotification, err error) logx.LogPushEntry {
|
||||||
|
|
|
@ -227,5 +227,5 @@ Retry:
|
||||||
goto Retry
|
goto Retry
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,7 @@ import (
|
||||||
"golang.org/x/crypto/acme/autocert"
|
"golang.org/x/crypto/acme/autocert"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var doOnce sync.Once
|
||||||
isTerm bool
|
|
||||||
doOnce sync.Once
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
isTerm = isatty.IsTerminal(os.Stdout.Fd())
|
|
||||||
}
|
|
||||||
|
|
||||||
func abortWithError(c *gin.Context, code int, message string) {
|
func abortWithError(c *gin.Context, code int, message string) {
|
||||||
c.AbortWithStatusJSON(code, gin.H{
|
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()
|
log.Logger = zerolog.New(os.Stdout).With().Timestamp().Logger()
|
||||||
|
|
||||||
|
isTerm := isatty.IsTerminal(os.Stdout.Fd())
|
||||||
if isTerm {
|
if isTerm {
|
||||||
log.Logger = log.Output(
|
log.Logger = log.Output(
|
||||||
zerolog.ConsoleWriter{
|
zerolog.ConsoleWriter{
|
||||||
|
|
|
@ -54,12 +54,13 @@ func TestMain(m *testing.M) {
|
||||||
queue.WithWorkerCount(4),
|
queue.WithWorkerCount(4),
|
||||||
)
|
)
|
||||||
q.Start()
|
q.Start()
|
||||||
|
|
||||||
|
code := m.Run()
|
||||||
defer func() {
|
defer func() {
|
||||||
q.Shutdown()
|
q.Shutdown()
|
||||||
q.Wait()
|
q.Wait()
|
||||||
|
os.Exit(code)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
os.Exit(m.Run())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initTest() *config.ConfYaml {
|
func initTest() *config.ConfYaml {
|
||||||
|
|
|
@ -50,8 +50,11 @@ func main() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
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("Success: %t\n", r.Success)
|
||||||
log.Printf("Count: %d\n", r.Counts)
|
log.Printf("Count: %d\n", r.Counts)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue