Refine must2 and apply NewAesGcm() to all usage #5011
Merged
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.
写自己项目的时候用到了类似must2的功能 挺好的 不过看了一下ray里没有用到泛型(如果有泛型可以省略掉断言)
稍微修改了下就没问题了 结果发现项目里并没有大量使用 而是用了很多 must(err) (可能因为懒得断言) 真用must2的时候好像是因为尝试获取一个aead 直接两个if err != nil太麻烦了破防才用的 不过其实核心里有一个封装的直接从key生成aead的函数 顺手全部替换掉了