mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
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:
parent
89cf168c92
commit
305fb0547d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user