Skip to content

Commit

Permalink
*: enable G601 for gosec (#8398)
Browse files Browse the repository at this point in the history
ref #4399

Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
rleungx and ti-chi-bot[bot] authored Jul 16, 2024
1 parent 0c7dc0b commit ca179e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ linters-settings:
excludes:
- G402
- G404
- G601
testifylint:
enable:
- bool-compare
Expand Down
4 changes: 2 additions & 2 deletions tests/server/api/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ func (suite *ruleTestSuite) checkGet(cluster *tests.TestCluster) {
code: http.StatusNotFound,
},
}
for _, testCase := range testCases {
for i, testCase := range testCases {
suite.T().Log(testCase.name)
var resp placement.Rule
url := fmt.Sprintf("%s/rule/%s/%s", urlPrefix, testCase.rule.GroupID, testCase.rule.ID)
if testCase.found {
tu.Eventually(re, func() bool {
err = tu.ReadGetJSON(re, tests.TestDialClient, url, &resp)
return compareRule(&resp, &testCase.rule)
return compareRule(&resp, &testCases[i].rule)
})
} else {
err = tu.CheckGetJSON(tests.TestDialClient, url, nil, tu.Status(re, testCase.code))
Expand Down
3 changes: 3 additions & 0 deletions tools/pd-api-bench/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,21 @@ func (c *Config) Parse(arguments []string) error {
// InitCoordinator set case config from config itself.
func (c *Config) InitCoordinator(co *cases.Coordinator) {
for name, cfg := range c.HTTP {
cfg := cfg
err := co.SetHTTPCase(name, &cfg)
if err != nil {
log.Error("create HTTP case failed", zap.Error(err))
}
}
for name, cfg := range c.GRPC {
cfg := cfg
err := co.SetGRPCCase(name, &cfg)
if err != nil {
log.Error("create gRPC case failed", zap.Error(err))
}
}
for name, cfg := range c.ETCD {
cfg := cfg
err := co.SetETCDCase(name, &cfg)
if err != nil {
log.Error("create etcd case failed", zap.Error(err))
Expand Down
3 changes: 3 additions & 0 deletions tools/pd-api-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) {
return
}
for name, cfg := range input {
cfg := cfg
co.SetHTTPCase(name, &cfg)
}
c.String(http.StatusOK, "")
Expand All @@ -272,6 +273,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) {
return
}
for name, cfg := range input {
cfg := cfg
co.SetGRPCCase(name, &cfg)
}
c.String(http.StatusOK, "")
Expand All @@ -289,6 +291,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) {
return
}
for name, cfg := range input {
cfg := cfg
co.SetETCDCase(name, &cfg)
}
c.String(http.StatusOK, "")
Expand Down

0 comments on commit ca179e6

Please sign in to comment.