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

fix: golangci-lint errcheck

This commit is contained in:
Ink-33 2021-01-17 02:52:43 +08:00
parent 1001cefb6f
commit d16fd6f34d
No known key found for this signature in database
GPG Key ID: 5D8B1D036EFB0D2E
3 changed files with 11 additions and 4 deletions

View File

@ -27,7 +27,10 @@ func EncoderSilk(data []byte) ([]byte, error) {
return nil, errors.New("no silk encoder") return nil, errors.New("no silk encoder")
} }
h := md5.New() h := md5.New()
h.Write(data) _, err := h.Write(data)
if err != nil {
return nil, err
}
tempName := fmt.Sprintf("%x", h.Sum(nil)) tempName := fmt.Sprintf("%x", h.Sum(nil))
if silkPath := path.Join("data/cache", tempName+".silk"); PathExists(silkPath) { if silkPath := path.Join("data/cache", tempName+".silk"); PathExists(silkPath) {
return ioutil.ReadFile(silkPath) return ioutil.ReadFile(silkPath)

View File

@ -98,7 +98,7 @@ func init() {
} }
func main() { func main() {
var byteKey []byte var byteKey []byte
var isFastStart = false var isFastStart = false
arg := os.Args arg := os.Args
@ -487,5 +487,5 @@ func restart(Args []string) {
Stdout: os.Stdout, Stdout: os.Stdout,
} }
} }
cmd.Start() _ = cmd.Start()
} }

View File

@ -123,7 +123,11 @@ func (c *httpClient) onBotPushEvent(m coolq.MSG) {
} }
if c.secret != "" { if c.secret != "" {
mac := hmac.New(sha1.New, []byte(c.secret)) mac := hmac.New(sha1.New, []byte(c.secret))
mac.Write([]byte(m.ToJson())) _, err := mac.Write([]byte(m.ToJson()))
if err != nil {
log.Error(err)
return nil
}
h["X-Signature"] = "sha1=" + hex.EncodeToString(mac.Sum(nil)) h["X-Signature"] = "sha1=" + hex.EncodeToString(mac.Sum(nil))
} }
return h return h