1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

fix stringsCompare and stringConcatSimplify from go-critic

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-05-27 08:28:04 +02:00
parent a62de57aa1
commit b8a4f6534f
5 changed files with 4 additions and 6 deletions

View File

@ -146,8 +146,6 @@ linters:
- regexpSimplify
- singleCaseSwitch
- sloppyReassign
- stringsCompare
- stringConcatSimplify
- stringXbytes
- typeAssertChain
- typeDefFirst

View File

@ -254,7 +254,7 @@ func (c *containerConfig) labels() map[string]string {
// finally, we apply the system labels, which override all labels.
for k, v := range system {
labels[strings.Join([]string{systemLabelPrefix, k}, ".")] = v
labels[systemLabelPrefix+"."+k] = v
}
return labels

View File

@ -105,7 +105,7 @@ func (s *DockerAPISuite) TestAPIImagesImportBadSrc(c *testing.T) {
ctx := testutil.GetContext(c)
for _, te := range tt {
res, _, err := request.Post(ctx, strings.Join([]string{"/images/create?fromSrc=", te.fromSrc}, ""), request.JSON)
res, _, err := request.Post(ctx, "/images/create?fromSrc="+te.fromSrc, request.JSON)
assert.NilError(c, err)
assert.Equal(c, res.StatusCode, te.statusExp)
assert.Equal(c, res.Header.Get("Content-Type"), "application/json")

View File

@ -1679,7 +1679,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *testing.T)
if err != nil {
t.Fatal(err)
}
if strings.Compare(strings.TrimSpace(oldContainerIP), strings.TrimSpace(newContainerIP)) == 0 {
if strings.TrimSpace(oldContainerIP) == strings.TrimSpace(newContainerIP) {
t.Fatalf("new container ip should not equal to old running container ip")
}

View File

@ -193,7 +193,7 @@ func fetchTable(ip string, port int, network, tableName string, clusterPeers, ne
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
text = strings.ReplaceAll(text, "\n", "")
if strings.Compare(text, "Yes") == 0 {
if text == "Yes" {
for _, k := range orphanKeys {
r, err := http.Get(fmt.Sprintf(deleteEntry, ip, port, network, tableName, k))
if err != nil {