Skip to content

Commit 087dbda

Browse files
Update services/webhook/feishu.go
**Performance Overhead** `fmt.Sprintf` is **slower** than simple string concatenation or `strconv.FormatInt` because: * It uses reflection and parsing logic internally. * It's designed for formatting many types, not just basic strings or numbers. Co-Authored-By: hiifong <[email protected]>
1 parent 5d2ed5a commit 087dbda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/webhook/feishu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (feishuConvertor) WorkflowJob(p *api.WorkflowJobPayload) (FeishuPayload, er
197197
// https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot
198198
func GenSign(secret string, timestamp int64) (string, error) {
199199
// timestamp + key do sha256, then base64 encode
200-
stringToSign := strconv.FormatInt(timestamp, 10) + "\n" + secret
200+
stringToSign := fmt.Sprintf("%d\n%s", timestamp, secret)
201201

202202
h := hmac.New(sha256.New, []byte(stringToSign))
203203
_, err := h.Write([]byte{})

0 commit comments

Comments
 (0)