Skip to content

Commit 3e6a6db

Browse files
committed
make lint happy
1 parent c38461a commit 3e6a6db

File tree

7 files changed

+42
-16
lines changed

7 files changed

+42
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ jobs:
5252
uses: golangci/golangci-lint-action@v6
5353
with:
5454
version: latest
55-
args: --timeout=5m
55+
args: --timeout=5m --config=.golangci.yml

.golangci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
run:
2+
timeout: 5m
3+
modules-download-mode: readonly
4+
5+
linters:
6+
disable:
7+
- unused # 禁用unused检查,保留noCopy结构
8+
enable:
9+
- gosimple
10+
- govet
11+
- ineffassign
12+
- misspell
13+
- unconvert
14+
- unparam
15+
- staticcheck
16+
- stylecheck
17+
18+
linters-settings:
19+
gosimple:
20+
checks: [ "all" ]
21+
22+
issues:
23+
exclude-rules:
24+
# 排除noCopy相关的unused检查
25+
- path: messageSender/sendWXWorkAppMessage.go
26+
linters: [ "unused" ]
27+
text: "type `noCopy` is unused"
28+
- path: messageSender/sendWXWorkAppMessage.go
29+
linters: [ "unused" ]
30+
text: "field `noCopy` is unused"
31+
32+
output:
33+
format: colored-line-number

bilibiliInfo/GetRoomInfo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func reqHeaderSetter(header *http.Header) {
5252
header.Set("Sec-Fetch-Site", "same-site")
5353
header.Set("Sec-Gpc", "1")
5454
header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.55")
55-
return
5655
}
5756
func getAndUnmarshal(url string, v any) error {
5857
req, errRequest := http.NewRequest("GET", url, nil)

messageSender/messageStruct.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func (message *GeneralPushMessage) SendToAllTargets() {
4545
servers[i].SendMessage(message)
4646
}(i)
4747
}
48-
return
4948
}
5049

5150
type MessageServer interface {

messageSender/sendWXWorkAppMessage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,4 @@ func (app WXWorkAppTarget) SendMessage(message Message) {
193193
if log.IsLevelEnabled(log.DebugLevel) {
194194
log.Debug("发送企业微信应用消息成功 响应消息", string(content))
195195
}
196-
return
197196
}

webhookHandler/BililiveRecorderWebhookHandler.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,20 @@ func (message *BililiveRecorderMessageStruct) GetContent() string {
7676
contentBuilder.WriteString(message.EventData.RelativePath)
7777
contentBuilder.WriteString("\n- 文件打开时间:")
7878
contentBuilder.WriteString(message.EventData.FileOpenTime)
79-
fallthrough
79+
8080
case "FileClosed":
81+
contentBuilder.WriteString("\n- 录制任务:")
82+
contentBuilder.WriteString(message.EventData.SessionId)
83+
contentBuilder.WriteString("\n- 文件:")
84+
contentBuilder.WriteString(message.EventData.RelativePath)
85+
contentBuilder.WriteString("\n- 文件打开时间:")
86+
contentBuilder.WriteString(message.EventData.FileOpenTime)
8187
contentBuilder.WriteString("\n- 时长:")
8288
contentBuilder.WriteString(secondsToString(message.EventData.Duration))
8389
contentBuilder.WriteString("\n- 文件大小:")
8490
contentBuilder.WriteString(formatStorageSpace(message.EventData.FileSize))
8591
contentBuilder.WriteString("\n- 文件关闭时间:")
8692
contentBuilder.WriteString(message.EventData.FileCloseTime)
87-
break
8893

8994
case "StreamStarted":
9095
liveStatus, liveTime := bilibiliInfo.GetLiveStatusString(message.EventData.RoomId)

webhookHandler/DDTV3WebhookHandler.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func ddtv3TaskRunner(path string, content []byte) {
3737

3838
// 判断事件类型
3939
eventType := getter.GetInt("type")
40-
eventSettings, _ := ddtv3Settings[path][eventType]
40+
eventSettings := ddtv3Settings[path][eventType]
4141
switch eventType {
4242
// 0 StartLive 主播开播
4343
case 0:
@@ -75,7 +75,6 @@ func ddtv3TaskRunner(path string, content []byte) {
7575
}
7676
msg.SendToAllTargets()
7777
}
78-
break
7978

8079
// 1 StopLive 主播下播
8180
case 1:
@@ -122,7 +121,6 @@ func ddtv3TaskRunner(path string, content []byte) {
122121
}
123122
msg.SendToAllTargets()
124123
}
125-
break
126124

127125
// 2 StartRec 开始录制
128126
// 3 RecComplete 录制结束
@@ -168,7 +166,6 @@ func ddtv3TaskRunner(path string, content []byte) {
168166
}
169167
msg.SendToAllTargets()
170168
}
171-
break
172169

173170
// 10 RunShellComplete 执行Shell命令完成
174171
// 16 ShellExecutionComplete 执行Shell命令结束
@@ -212,7 +209,6 @@ func ddtv3TaskRunner(path string, content []byte) {
212209
}
213210
msg.SendToAllTargets()
214211
}
215-
break
216212

217213
// 11 DownloadEndMissionSuccess 下载任务成功结束
218214
case 11:
@@ -256,7 +252,6 @@ func ddtv3TaskRunner(path string, content []byte) {
256252
}
257253
msg.SendToAllTargets()
258254
}
259-
break
260255

261256
// 12 SpaceIsInsufficientWarn 剩余空间不足
262257
// 14 LoginWillExpireSoon 登陆即将失效
@@ -276,7 +271,6 @@ func ddtv3TaskRunner(path string, content []byte) {
276271
}
277272
msg.SendToAllTargets()
278273
}
279-
break
280274

281275
// 13 LoginFailure 登陆失效
282276
case 13:
@@ -290,7 +284,6 @@ func ddtv3TaskRunner(path string, content []byte) {
290284
}
291285
msg.SendToAllTargets()
292286
}
293-
break
294287

295288
// 15 UpdateAvailable 有可用新版本
296289
case 15:
@@ -307,7 +300,6 @@ func ddtv3TaskRunner(path string, content []byte) {
307300
}
308301
msg.SendToAllTargets()
309302
}
310-
break
311303

312304
// 19 RoomLocked 直播间被封禁
313305
case 19:
@@ -343,7 +335,6 @@ func ddtv3TaskRunner(path string, content []byte) {
343335
}
344336
msg.SendToAllTargets()
345337
}
346-
break
347338

348339
// 别的不关心,所以没写
349340
default:

0 commit comments

Comments
 (0)