From ed7f323c8f4f6bc61a75146bf34f5b8f73063a17 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 9 Mar 2019 11:36:37 +0700 Subject: all: simplify code using "gofmt -s -w" Most changes are removing redundant declaration of type when direct instantiating value of map or slice, e.g. []T{T{}} become []T{{}}. Small changes are removing the high order of subslice if its value is the length of slice itself, e.g. T[:len(T)] become T[:]. The following file is excluded due to incompatibility with go1.4, - src/cmd/compile/internal/gc/ssa.go Change-Id: Id3abb09401795ce1e6da591a89749cba8502fb26 Reviewed-on: https://go-review.googlesource.com/c/go/+/166437 Run-TryBot: Dave Cheney TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/encoding/binary/example_test.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/encoding/binary/example_test.go') diff --git a/src/encoding/binary/example_test.go b/src/encoding/binary/example_test.go index 6f892c2b8d..b994b897ce 100644 --- a/src/encoding/binary/example_test.go +++ b/src/encoding/binary/example_test.go @@ -132,12 +132,12 @@ func ExamplePutVarint() { func ExampleUvarint() { inputs := [][]byte{ - []byte{0x01}, - []byte{0x02}, - []byte{0x7f}, - []byte{0x80, 0x01}, - []byte{0xff, 0x01}, - []byte{0x80, 0x02}, + {0x01}, + {0x02}, + {0x7f}, + {0x80, 0x01}, + {0xff, 0x01}, + {0x80, 0x02}, } for _, b := range inputs { x, n := binary.Uvarint(b) @@ -157,15 +157,15 @@ func ExampleUvarint() { func ExampleVarint() { inputs := [][]byte{ - []byte{0x81, 0x01}, - []byte{0x7f}, - []byte{0x03}, - []byte{0x01}, - []byte{0x00}, - []byte{0x02}, - []byte{0x04}, - []byte{0x7e}, - []byte{0x80, 0x01}, + {0x81, 0x01}, + {0x7f}, + {0x03}, + {0x01}, + {0x00}, + {0x02}, + {0x04}, + {0x7e}, + {0x80, 0x01}, } for _, b := range inputs { x, n := binary.Varint(b) -- cgit v1.3