aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/binary
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2019-03-09 11:36:37 +0700
committerIan Lance Taylor <iant@golang.org>2019-05-06 22:19:22 +0000
commited7f323c8f4f6bc61a75146bf34f5b8f73063a17 (patch)
tree79a5c2f12147252f05d59e4a69c93309e54a4b77 /src/encoding/binary
parent04845fe78aeba33106c6f8a40d05e608ca687214 (diff)
downloadgo-ed7f323c8f4f6bc61a75146bf34f5b8f73063a17.tar.gz
go-ed7f323c8f4f6bc61a75146bf34f5b8f73063a17.zip
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 <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding/binary')
-rw-r--r--src/encoding/binary/example_test.go30
1 files changed, 15 insertions, 15 deletions
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)