AlexStocks commented on code in PR #1158: URL: https://github.com/apache/dubbo-go-samples/pull/1158#discussion_r4572970758
########## observability/integration/internal/verify/histogram.go: ########## @@ -0,0 +1,232 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package verify + +import ( + "context" + "fmt" + "io" + "math" + "net/http" + "reflect" + "time" +) + +import ( + dto "github.com/prometheus/client_model/go" Review Comment: [P1] 新增文件的 import 分组会让 CI「Format code」门禁失败 这两个新增文件里的第三方 import 分组写法会被 `imports-formatter` 改写,导致 CI 的 `Format code` 步骤以 exit 1 结束,本 PR 因此拿不到「Build And Integration」的构建与集成结果。 **证据 1(CI 实测)**:`Build And Integration`(run 43435090230 / job 131918127522)的 `Format code` 步骤为 `go fmt ./...` → `GOROOT=$(go env GOROOT) imports-formatter` → `[[ -z "$(git status -s)" ]]`;日志在 `git status` 前打印 `imports-formatter: 1.0.10`,随后输出: ```text Changes not staged for commit: modified: observability/integration/internal/verify/histogram.go modified: observability/integration/internal/verify/histogram_test.go ##[error]Process completed with exit code 1. ``` **证据 2(本机复现)**:在模块上下文内用同版本 `imports-formatter 1.0.10`(`GOROOT` 指向 go1.25.0)跑一遍,被改写的文件恰好只有这两个,改写内容是在 `dto "github.com/prometheus/client_model/go"` 之后插入一个空行 —— 即格式化器要求「带别名的 import」与「不带别名的 import」分成两个子组。同目录既有 `verify.go` / `verify_test.go` 未被改写,所以这属于本 PR 新增文件引入,而非 base 既有问题。 **修复方向**:在 histogram.go 第 31 行与 histogram_test.go 第 32 行的 `dto "..."` 之后各补一个空行: ```go import ( dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" ) ``` 提交前跑一次 `GOROOT=$(go env GOROOT) imports-formatter && git status -s` 自查即可闭环。 另:同一 job 的另一条 `lint` 失败是 `undefined: metrics.WithHistogramEnabled`(依赖 dubbo-go 的 #3791 尚未进入 samples CI 所 pin 的 main),属依赖前置,不在本线程范围内。 -- 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]
