1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

make golangci-lint happy

This commit is contained in:
wdvxdr 2023-01-26 22:59:04 +08:00
parent 4d064e145f
commit 84e061f321
6 changed files with 9 additions and 13 deletions

View File

@ -29,7 +29,7 @@ func readLine() (str string) {
return return
} }
func readLineTimeout(t time.Duration, de string) (str string) { func readLineTimeout(t time.Duration) {
r := make(chan string) r := make(chan string)
go func() { go func() {
select { select {
@ -37,12 +37,10 @@ func readLineTimeout(t time.Duration, de string) (str string) {
case <-time.After(t): case <-time.After(t):
} }
}() }()
str = de
select { select {
case str = <-r: case <-r:
case <-time.After(t): case <-time.After(t):
} }
return
} }
func readIfTTY(de string) (str string) { func readIfTTY(de string) (str string) {
@ -210,7 +208,7 @@ func loginResponseProcessor(res *client.LoginResponse) error {
case client.UnsafeDeviceError: case client.UnsafeDeviceError:
log.Warnf("账号已开启设备锁,请前往 -> %v <- 验证后重启Bot.", res.VerifyUrl) log.Warnf("账号已开启设备锁,请前往 -> %v <- 验证后重启Bot.", res.VerifyUrl)
log.Infof("按 Enter 或等待 5s 后继续....") log.Infof("按 Enter 或等待 5s 后继续....")
readLineTimeout(time.Second*5, "") readLineTimeout(time.Second * 5)
os.Exit(0) os.Exit(0)
case client.OtherLoginError, client.UnknownLoginError, client.TooManySMSRequestError: case client.OtherLoginError, client.UnknownLoginError, client.TooManySMSRequestError:
msg := res.ErrorMessage msg := res.ErrorMessage
@ -221,7 +219,7 @@ func loginResponseProcessor(res *client.LoginResponse) error {
} }
log.Warnf("登录失败: %v", msg) log.Warnf("登录失败: %v", msg)
log.Infof("按 Enter 或等待 5s 后继续....") log.Infof("按 Enter 或等待 5s 后继续....")
readLineTimeout(time.Second*5, "") readLineTimeout(time.Second * 5)
os.Exit(0) os.Exit(0)
} }
} }

View File

@ -14,12 +14,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/segmentio/asm/base64"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client" "github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/message"
"github.com/Mrs4s/MiraiGo/utils" "github.com/Mrs4s/MiraiGo/utils"
"github.com/segmentio/asm/base64"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"

View File

@ -20,13 +20,12 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/segmentio/asm/base64" "github.com/segmentio/asm/base64"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"golang.org/x/image/webp"
"github.com/Mrs4s/go-cqhttp/db" "github.com/Mrs4s/go-cqhttp/db"
"github.com/Mrs4s/go-cqhttp/global" "github.com/Mrs4s/go-cqhttp/global"
"github.com/Mrs4s/go-cqhttp/internal/base" "github.com/Mrs4s/go-cqhttp/internal/base"
"github.com/Mrs4s/go-cqhttp/internal/mime" "github.com/Mrs4s/go-cqhttp/internal/mime"
"golang.org/x/image/webp"
) )
// CQBot CQBot结构体,存储Bot实例相关配置 // CQBot CQBot结构体,存储Bot实例相关配置

View File

@ -4,10 +4,9 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/Mrs4s/MiraiGo/topic"
"github.com/Mrs4s/MiraiGo/client" "github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/message"
"github.com/Mrs4s/MiraiGo/topic"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/Mrs4s/go-cqhttp/global" "github.com/Mrs4s/go-cqhttp/global"

View File

@ -5,6 +5,7 @@ import (
"strings" "strings"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/go-cqhttp/global" "github.com/Mrs4s/go-cqhttp/global"
) )

View File

@ -55,7 +55,7 @@ type Config struct {
RemoveReplyAt bool `yaml:"remove-reply-at"` RemoveReplyAt bool `yaml:"remove-reply-at"`
ExtraReplyData bool `yaml:"extra-reply-data"` ExtraReplyData bool `yaml:"extra-reply-data"`
SkipMimeScan bool `yaml:"skip-mime-scan"` SkipMimeScan bool `yaml:"skip-mime-scan"`
ConvertWebpImage bool `yaml:"convert-webp-image"` ConvertWebpImage bool `yaml:"convert-webp-image"`
} `yaml:"message"` } `yaml:"message"`
Output struct { Output struct {