mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
fix: golangci-lint staticcheck
This commit is contained in:
parent
1d9f719d13
commit
1001cefb6f
6
main.go
6
main.go
@ -16,6 +16,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/server"
|
||||
@ -97,6 +98,7 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
var byteKey []byte
|
||||
var isFastStart = false
|
||||
arg := os.Args
|
||||
@ -327,7 +329,7 @@ func main() {
|
||||
c := server.Console
|
||||
r := server.Restart
|
||||
go checkUpdate()
|
||||
signal.Notify(c, os.Interrupt, os.Kill)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
select {
|
||||
case <-c:
|
||||
b.Release()
|
||||
@ -458,7 +460,7 @@ func selfUpdate(imageUrl string) {
|
||||
}
|
||||
|
||||
func restart(Args []string) {
|
||||
cmd := &exec.Cmd{}
|
||||
var cmd *exec.Cmd
|
||||
if runtime.GOOS == "windows" {
|
||||
file, err := exec.LookPath(Args[0])
|
||||
if err != nil {
|
||||
|
@ -5,8 +5,6 @@ import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/gin-contrib/pprof"
|
||||
"image"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -14,8 +12,12 @@ import (
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/gin-contrib/pprof"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
@ -91,14 +93,14 @@ func (s *webServer) Run(addr string, cli *client.QQClient) *coolq.CQBot {
|
||||
log.Error(err)
|
||||
log.Infof("请检查端口是否被占用.")
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, os.Kill)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
<-c
|
||||
os.Exit(1)
|
||||
}
|
||||
} else {
|
||||
//关闭端口监听
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, os.Kill)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
<-c
|
||||
os.Exit(1)
|
||||
}
|
||||
@ -155,6 +157,10 @@ func (s *webServer) Dologin() {
|
||||
os.Exit(0)
|
||||
}
|
||||
rsp, err = cli.SubmitTicket(ticket)
|
||||
if err != nil {
|
||||
log.Warnf("错误: " + err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
continue
|
||||
case client.NeedCaptcha:
|
||||
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0644)
|
||||
|
Loading…
x
Reference in New Issue
Block a user