Commit 00f9b768 authored by Dave Cheney's avatar Dave Cheney Committed by Adam Langley

exp/ssh: fix unmarshal test

Ensure that empty NameLists always return
a zero length []string, not nil.

In practice NameLists are only used in a few
message types and always consumed by a for
range function so the difference between nil
and []string{} is not significant.

Also, add exp/ssh to pkg/Makefile as suggested
by rsc.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5400042
parent 33075970
......@@ -392,7 +392,10 @@ func parseString(in []byte) (out, rest []byte, ok bool) {
return
}
var comma = []byte{','}
var (
comma = []byte{','}
emptyNameList = []string{}
)
func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
contents, rest, ok := parseString(in)
......@@ -400,6 +403,7 @@ func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
return
}
if len(contents) == 0 {
out = emptyNameList
return
}
parts := bytes.Split(contents, comma)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment