ssh/agent: do not return nil entries from keyring.Signers()

The slice returned is constructed with both a pre-set length and
append() resulting in a slice twice as long and half-full of nil.
Setting the capacity instead of length gets the desired result.

Change-Id: I758423594e4f4c0506c53f227454f57a9dc8bdf1
Reviewed-on: https://go-review.googlesource.com/2659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Michael Marineau
2015-01-12 20:38:54 +00:00
committed by Brad Fitzpatrick
parent 632d287f9f
commit 160b2e156e
+1 -1
View File
@@ -175,7 +175,7 @@ func (r *keyring) Signers() ([]ssh.Signer, error) {
return nil, errLocked
}
s := make([]ssh.Signer, len(r.keys))
s := make([]ssh.Signer, 0, len(r.keys))
for _, k := range r.keys {
s = append(s, k.signer)
}