feat: 优化指纹探测并规范化 nil context#23
Open
wuchulonly wants to merge 3 commits into
Open
Conversation
39b6ce1 to
c71a822
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更
WithContext(nil)转为context.Background(),Context()在 nil receiver 或底层 ctx 为 nil 时也返回 background。Execute入口处理 typed nil*Context通过types.Context接口传入的情况。为什么
这次不是只在
emitStats做兜底 guard。空指针来源主要有两条:WithContext(nil),SDK Context 内部保存了 nilcontext.Context。*Context时,ctx == nil为 false,类型断言后得到的runCtx仍然是 nil。现在把这两条入口都收口成“SDK Context 不向外暴露 nil
context.Context”,stats guard 只保留取消后的跳过语义。测试
go test ./...备注:
VulnResult导出结构已经在当前 master 中存在,本 PR 不再重复提交那部分。