Skip to content

Commit 6e70a01

Browse files
committed
stylecheck: ST1016: methods on the same type should have the same receiver name
1 parent 90a192f commit 6e70a01

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libvirt/uri/ssh.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const (
2222
defaultSSHAuthMethods = "agent,privkey"
2323
)
2424

25-
func (curi *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
26-
q := curi.Query()
25+
func (u *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
26+
q := u.Query()
2727

2828
authMethods := q.Get("sshauth")
2929
if authMethods == "" {
@@ -65,7 +65,7 @@ func (curi *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
6565
}
6666
result = append(result, ssh.PublicKeys(signer))
6767
case "ssh-password":
68-
if sshPassword, ok := curi.User.Password(); ok {
68+
if sshPassword, ok := u.User.Password(); ok {
6969
result = append(result, ssh.Password(sshPassword))
7070
} else {
7171
log.Printf("[ERROR] Missing password in userinfo of URI authority section")
@@ -79,12 +79,12 @@ func (curi *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
7979
return result
8080
}
8181

82-
func (curi *ConnectionURI) dialSSH() (net.Conn, error) {
83-
authMethods := curi.parseAuthMethods()
82+
func (u *ConnectionURI) dialSSH() (net.Conn, error) {
83+
authMethods := u.parseAuthMethods()
8484
if len(authMethods) < 1 {
8585
return nil, fmt.Errorf("Could not configure SSH authentication methods")
8686
}
87-
q := curi.Query()
87+
q := u.Query()
8888

8989
knownHostsPath := q.Get("knownhosts")
9090
knownHostsVerify := q.Get("known_hosts_verify")
@@ -107,7 +107,7 @@ func (curi *ConnectionURI) dialSSH() (net.Conn, error) {
107107
hostKeyCallback = cb
108108
}
109109

110-
username := curi.User.Username()
110+
username := u.User.Username()
111111
if username == "" {
112112
u, err := user.Current()
113113
if err != nil {
@@ -123,12 +123,12 @@ func (curi *ConnectionURI) dialSSH() (net.Conn, error) {
123123
Timeout: 2 * time.Second,
124124
}
125125

126-
port := curi.Port()
126+
port := u.Port()
127127
if port == "" {
128128
port = defaultSSHPort
129129
}
130130

131-
sshClient, err := ssh.Dial("tcp", fmt.Sprintf("%s:%s", curi.Hostname(), port), &cfg)
131+
sshClient, err := ssh.Dial("tcp", fmt.Sprintf("%s:%s", u.Hostname(), port), &cfg)
132132
if err != nil {
133133
return nil, err
134134
}

0 commit comments

Comments
 (0)