mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
fix stringsCompare and stringConcatSimplify from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@ -146,8 +146,6 @@ linters:
|
||||
- regexpSimplify
|
||||
- singleCaseSwitch
|
||||
- sloppyReassign
|
||||
- stringsCompare
|
||||
- stringConcatSimplify
|
||||
- stringXbytes
|
||||
- typeAssertChain
|
||||
- typeDefFirst
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user