清掉 5 个确认没人调用的遗留函数
staticcheck 的 U1000 一直报这 5 个,逐个核对过引用(含同名方法、测试、字符串调用、反射): - runFFmpeg:runFFmpegWith 的薄包装,没有任何调用点 - isLiveOn(uid int):包级函数没人用,实际在跑的始终是 streamer.isLiveOn() 方法 - quitRecord:需要收尾的地方都直接 updateLiveInfo(..., isRecording = false) - setLiveInfo:整体覆盖 liveInfo,早已被 updateLiveInfo(原地改部分字段)取代 - isRecording(liveID):字段 info.isRecording 到处都在直接用 上一轮那个 jobActive 虽然也是 U1000,但它是「本该接上却漏接」的护栏(接回后 P0 的并发问题才解决),所以这次删之前特意确认这 5 个不是同类情况:它们都有 等价且更合适的现役替代实现。 验证:gofmt -l 空;go vet ./... 空;go build ./... 通过;go test ./... 全绿(11.3s); staticcheck -checks=all 的 U1000 归零。
This commit is contained in:
@@ -258,22 +258,6 @@ func getLiveID(uid int) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// 根据 uid 查看主播是否正在直播
|
||||
func isLiveOn(uid int) bool {
|
||||
liveRooms.RLock()
|
||||
_, ok := liveRooms.rooms[uid]
|
||||
liveRooms.RUnlock()
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
|
||||
if isLive, room, err := tryFetchLiveInfo(uid); err == nil {
|
||||
defer liveRoomPool.Put(room)
|
||||
return isLive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 获取主播直播间的标题
|
||||
func (s *streamer) getTitle() string {
|
||||
return getTitle(s.UID)
|
||||
|
||||
Reference in New Issue
Block a user