Skip to content

Commit ac88ee7

Browse files
committed
ssh/agent: fix example
Since there is no ClientAgent identifier, ExampleClientAgent wasn't displayed as an example by godoc. Change-Id: Ied8df7d8412c4aa483d42315986af49ba8fdbcef Reviewed-on: https://go-review.googlesource.com/c/crypto/+/208480 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
1 parent 4f8c1d8 commit ac88ee7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ssh/agent/example_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,29 @@ import (
1313
"golang.org/x/crypto/ssh/agent"
1414
)
1515

16-
func ExampleClientAgent() {
17-
// ssh-agent has a UNIX socket under $SSH_AUTH_SOCK
16+
func ExampleNewClient() {
17+
// ssh-agent(1) provides a UNIX socket at $SSH_AUTH_SOCK.
1818
socket := os.Getenv("SSH_AUTH_SOCK")
1919
conn, err := net.Dial("unix", socket)
2020
if err != nil {
21-
log.Fatalf("net.Dial: %v", err)
21+
log.Fatalf("Failed to open SSH_AUTH_SOCK: %v", err)
2222
}
23+
2324
agentClient := agent.NewClient(conn)
2425
config := &ssh.ClientConfig{
25-
User: "username",
26+
User: "gopher",
2627
Auth: []ssh.AuthMethod{
27-
// Use a callback rather than PublicKeys
28-
// so we only consult the agent once the remote server
29-
// wants it.
28+
// Use a callback rather than PublicKeys so we only consult the
29+
// agent once the remote server wants it.
3030
ssh.PublicKeysCallback(agentClient.Signers),
3131
},
3232
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
3333
}
3434

3535
sshc, err := ssh.Dial("tcp", "localhost:22", config)
3636
if err != nil {
37-
log.Fatalf("Dial: %v", err)
37+
log.Fatal(err)
3838
}
39-
// .. use sshc
39+
// Use sshc...
4040
sshc.Close()
4141
}

0 commit comments

Comments
 (0)