rm-gocheck: fix compile errors from converting check.CommentInterface to string

while :; do \
	out=$(go test -c ./integration-cli 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./integration-cli/daemon 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./pkg/discovery 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./pkg/discovery/file 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./pkg/discovery/kv 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./pkg/discovery/memory 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done \
&& \
while :; do \
	out=$(go test -c ./pkg/discovery/nodes 2>&1 | grep 'cannot use nil as type string in return argument') || break
	echo "$out" | while read line; do
		file=$(echo "$line" | cut -d: -f1)
		n=$(echo "$line" | cut -d: -f2)
		sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
	done
done

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass
2019-09-09 21:09:27 +00:00
parent 7813dfe9d7
commit 64de5e8228
11 changed files with 51 additions and 51 deletions

View File

@@ -92,7 +92,7 @@ func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, string) {
out, err := d.Cmd("ps", "-q")
assert.NilError(c, err)
if len(strings.TrimSpace(out)) == 0 {
return 0, nil
return 0, ""
}
return len(strings.Split(strings.TrimSpace(out), "\n")), fmt.Sprintf("output: %q", string(out))
}

View File

@@ -26,7 +26,7 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState,
}
}
}
return count, nil
return count, ""
}
}
@@ -43,7 +43,7 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T
}
}
}
return count, nil
return count, ""
}
}
@@ -57,9 +57,9 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (inter
return func(c *testing.T) (interface{}, string) {
service := d.GetService(c, service)
if service.UpdateStatus == nil {
return "", nil
return "", ""
}
return service.UpdateStatus.State, nil
return service.UpdateStatus.State, ""
}
}
@@ -93,7 +93,7 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, string) {
return func(c *testing.T) (interface{}, string) {
tasks := d.GetServiceTasks(c, service)
return len(tasks), nil
return len(tasks), ""
}
}
@@ -118,7 +118,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, string) {
result[network.Target]++
}
}
return result, nil
return result, ""
}
// CheckRunningTaskImages returns the times each image is running as a task.
@@ -142,7 +142,7 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, string) {
result[task.Spec.ContainerSpec.Image]++
}
}
return result, nil
return result, ""
}
// CheckNodeReadyCount returns the number of ready node on the swarm
@@ -154,20 +154,20 @@ func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, string) {
readyCount++
}
}
return readyCount, nil
return readyCount, ""
}
// CheckLocalNodeState returns the current swarm node state
func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, string) {
info := d.SwarmInfo(c)
return info.LocalNodeState, nil
return info.LocalNodeState, ""
}
// CheckControlAvailable returns the current swarm control available
func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, string) {
info := d.SwarmInfo(c)
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
return info.ControlAvailable, nil
return info.ControlAvailable, ""
}
// CheckLeader returns whether there is a leader on the swarm or not
@@ -184,7 +184,7 @@ func (d *Daemon) CheckLeader(c *testing.T) (interface{}, string) {
for _, node := range ls {
if node.ManagerStatus != nil && node.ManagerStatus.Leader {
return nil, nil
return nil, ""
}
}
return fmt.Errorf("no leader"), "could not find leader"