virtcontainers: Fix gosimple issue on client.go

For some reason our static check started to get opinionated about code
that's been there for ages.

One of the suggestions is to improve:
```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/client
client.go:431:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
	if strings.HasPrefix(sock, "mock:") {
```

And that's what this PR is about.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2021-07-09 17:18:08 +02:00
parent 89cf168c92
commit 305fb0547d

View File

@ -428,9 +428,7 @@ func HybridVSockDialer(sock string, timeout time.Duration) (net.Conn, error) {
// just for tests use.
func MockHybridVSockDialer(sock string, timeout time.Duration) (net.Conn, error) {
if strings.HasPrefix(sock, "mock:") {
sock = strings.TrimPrefix(sock, "mock:")
}
sock = strings.TrimPrefix(sock, "mock:")
dialFunc := func() (net.Conn, error) {
return net.DialTimeout("unix", sock, timeout)