1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-06-19 05:55:04 +08:00

style: run gofumpt

This commit is contained in:
wdvxdr 2021-12-29 14:04:51 +08:00
parent 18487d6353
commit b98f75ccab
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6
6 changed files with 10 additions and 8 deletions

View File

@ -28,6 +28,7 @@ linters:
- errcheck - errcheck
- exportloopref - exportloopref
- exhaustive - exhaustive
- bidichk
#- funlen #- funlen
#- goconst #- goconst
- gocritic - gocritic

View File

@ -542,7 +542,6 @@ func (bot *CQBot) InsertGuildChannelMessage(m *message.GuildChannelMessage) stri
// Release 释放Bot实例 // Release 释放Bot实例
func (bot *CQBot) Release() { func (bot *CQBot) Release() {
} }
func (bot *CQBot) dispatchEventMessage(m global.MSG) { func (bot *CQBot) dispatchEventMessage(m global.MSG) {

View File

@ -28,15 +28,15 @@ func TestBtree(t *testing.T) {
bt, err := Create(f) bt, err := Create(f)
assert2.NoError(t, err) assert2.NoError(t, err)
var tests = []string{ tests := []string{
"hello world", "hello world",
"123", "123",
"We are met on a great battle-field of that war.", "We are met on a great battle-field of that war.",
"Abraham Lincoln, November 19, 1863, Gettysburg, Pennsylvania", "Abraham Lincoln, November 19, 1863, Gettysburg, Pennsylvania",
} }
var sha = make([]*byte, len(tests)) sha := make([]*byte, len(tests))
for i, tt := range tests { for i, tt := range tests {
var hash = sha1.New() hash := sha1.New()
hash.Write([]byte(tt)) hash.Write([]byte(tt))
sha[i] = &hash.Sum(nil)[0] sha[i] = &hash.Sum(nil)[0]
bt.Insert(sha[i], []byte(tt)) bt.Insert(sha[i], []byte(tt))

View File

@ -45,7 +45,7 @@ func resethash(sha1 *byte) {
// reading table // reading table
func read32(r io.Reader) (int32, error) { func read32(r io.Reader) (int32, error) {
var b = make([]byte, 4) b := make([]byte, 4)
_, err := r.Read(b) _, err := r.Read(b)
if err != nil { if err != nil {
return 0, err return 0, err

View File

@ -66,7 +66,7 @@ func Init() {
} }
} }
var open = func(typ string, cache *Cache) { open := func(typ string, cache *Cache) {
file := conf[typ] file := conf[typ]
if file == "" { if file == "" {
file = fmt.Sprintf("data/%s.db", typ) file = fmt.Sprintf("data/%s.db", typ)

View File

@ -141,8 +141,10 @@ func Parse(path string) *Config {
return config return config
} }
var serverconfs []*Server var (
var mu sync.Mutex serverconfs []*Server
mu sync.Mutex
)
// AddServer 添加该服务的简介和默认配置 // AddServer 添加该服务的简介和默认配置
func AddServer(s *Server) { func AddServer(s *Server) {