Browse Source

golint: use var block, and simply use a variable declaration to create a byteslice with a length of 0

Willem van Bergen 10 years ago
parent
commit
cabc1b4ffc
1 changed files with 5 additions and 3 deletions
  1. 5 3
      snappy.go

+ 5 - 3
snappy.go

@@ -16,9 +16,11 @@ func snappyEncode(src []byte) ([]byte, error) {
 // SnappyDecode decodes snappy data
 func snappyDecode(src []byte) ([]byte, error) {
 	if bytes.Equal(src[:8], snappyMagic) {
-		pos := uint32(16)
-		max := uint32(len(src))
-		dst := make([]byte, 0)
+		var (
+			pos = uint32(16)
+			max = uint32(len(src))
+			dst []byte
+		)
 		for pos < max {
 			size := binary.BigEndian.Uint32(src[pos : pos+4])
 			pos = pos + 4