Fix Go formatting in beam and dockerscript
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
1df27fa300
commit
c5b6f20d56
11 changed files with 56 additions and 71 deletions
|
@ -2,8 +2,8 @@ package data
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Encode(obj map[string][]string) string {
|
||||
|
@ -93,10 +93,10 @@ func decodeString(msg string) (string, int, error) {
|
|||
} else {
|
||||
length = int(l)
|
||||
}
|
||||
if len(parts[1]) < length + 1 {
|
||||
return "", 0, fmt.Errorf("message '%s' is %d bytes, expected at least %d", parts[1], len(parts[1]), length + 1)
|
||||
if len(parts[1]) < length+1 {
|
||||
return "", 0, fmt.Errorf("message '%s' is %d bytes, expected at least %d", parts[1], len(parts[1]), length+1)
|
||||
}
|
||||
payload := parts[1][:length + 1]
|
||||
payload := parts[1][:length+1]
|
||||
if payload[length] != ',' {
|
||||
return "", 0, fmt.Errorf("message is not comma-terminated")
|
||||
}
|
||||
|
|
|
@ -92,10 +92,10 @@ func TestEncodeBinaryValue(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDecodeString(t *testing.T) {
|
||||
validEncodedStrings := []struct{
|
||||
input string
|
||||
validEncodedStrings := []struct {
|
||||
input string
|
||||
output string
|
||||
skip int
|
||||
skip int
|
||||
}{
|
||||
{"3:foo,", "foo", 6},
|
||||
{"5:hello,", "hello", 8},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue