AlexStocks commented on code in PR #992:
URL: https://github.com/apache/dubbo-go-pixiu/pull/992#discussion_r4512244462


##########
admin/controller/auth/auth_test.go:
##########
@@ -47,12 +47,8 @@ func testJWT(t *testing.T) *JWT {
 }
 
 func TestParseTokenRejectsUnexpectedSigningMethod(t *testing.T) {
-       claims := CustomClaims{
-               Username: "admin",
-               StandardClaims: jwt.StandardClaims{
-                       ExpiresAt: time.Now().Add(time.Hour).Unix(),
-               },
-       }
+       claims := CustomClaims{Username: "admin"}

Review Comment:
   [P2] 与 #1062 对同一文件同一处做互斥改动,合入顺序会造成文本冲突
   
   本 PR 在 50 行等处把 `CustomClaims{StandardClaims: jwt.StandardClaims{...}}` 
改为「先构造再赋值 `ExpiresAt`」,用于消除 `jwt.StandardClaims` 的 SA1019。同一仓库 open 状态的 
#1062(head `2c65c6c2`)对 `admin/controller/auth/auth_test.go` 的同一批 hunk 
采用了另一种写法:抽出 `newTestClaims(ttl)` helper,并在各用例中替换为 `newTestClaims(time.Hour)`。
   
   证据:两个 PR 该文件的 base blob 相同(`index 62b678a3c`),改后 blob 不同(本 PR 
`431fd0db8`,`#1062` 为 `36b55773d`),且改动行区间重叠。两者无法同时干净合入,后合入的一方必须重新 rebase 解决冲突。
   
   实际影响:这是纯 lint 修复上的一次可避免冲突。若解决冲突时整块取一侧,另一侧的用例会退回显式引用 
`jwt.StandardClaims`,重新触发 SA1019 并使 `Golang Lint` 失败——两个 PR 的共同目标被互相抵消。
   
   修复方向:两种写法只保留一种。建议本 PR 只保留 `pkg/client/mq` 下的 Kafka 改动(这才是本 PR 描述的目标),把 
`admin/controller/auth/auth_test.go` 让给 #1062,或反之。仓库约定一个 PR 只解决一件事,本 PR 
顺带修改无关的鉴权测试文件也属于相同问题。
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to