1
0
mirror of https://github.com/json-iterator/go.git synced 2025-05-13 21:36:29 +02:00

Merge pull request #338 from dvrkps/master

Clean go vet error and ineffassign warnings.
This commit is contained in:
Tao Wen 2019-01-14 23:53:30 +08:00 committed by GitHub
commit f64ce68b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -95,7 +95,7 @@ func ExampleGet() {
// Crimson // Crimson
} }
func ExampleMapKey() { func ExampleMyKey() {
hello := MyKey("hello") hello := MyKey("hello")
output, _ := Marshal(map[*MyKey]string{&hello: "world"}) output, _ := Marshal(map[*MyKey]string{&hello: "world"})
fmt.Println(string(output)) fmt.Println(string(output))

View File

@ -77,14 +77,12 @@ func (iter *Iterator) ReadFloat32() (ret float32) {
} }
func (iter *Iterator) readPositiveFloat32() (ret float32) { func (iter *Iterator) readPositiveFloat32() (ret float32) {
value := uint64(0)
c := byte(' ')
i := iter.head i := iter.head
// first char // first char
if i == iter.tail { if i == iter.tail {
return iter.readFloat32SlowPath() return iter.readFloat32SlowPath()
} }
c = iter.buf[i] c := iter.buf[i]
i++ i++
ind := floatDigits[c] ind := floatDigits[c]
switch ind { switch ind {
@ -107,7 +105,7 @@ func (iter *Iterator) readPositiveFloat32() (ret float32) {
return return
} }
} }
value = uint64(ind) value := uint64(ind)
// chars before dot // chars before dot
non_decimal_loop: non_decimal_loop:
for ; i < iter.tail; i++ { for ; i < iter.tail; i++ {
@ -216,14 +214,12 @@ func (iter *Iterator) ReadFloat64() (ret float64) {
} }
func (iter *Iterator) readPositiveFloat64() (ret float64) { func (iter *Iterator) readPositiveFloat64() (ret float64) {
value := uint64(0)
c := byte(' ')
i := iter.head i := iter.head
// first char // first char
if i == iter.tail { if i == iter.tail {
return iter.readFloat64SlowPath() return iter.readFloat64SlowPath()
} }
c = iter.buf[i] c := iter.buf[i]
i++ i++
ind := floatDigits[c] ind := floatDigits[c]
switch ind { switch ind {
@ -246,7 +242,7 @@ func (iter *Iterator) readPositiveFloat64() (ret float64) {
return return
} }
} }
value = uint64(ind) value := uint64(ind)
// chars before dot // chars before dot
non_decimal_loop: non_decimal_loop:
for ; i < iter.tail; i++ { for ; i < iter.tail; i++ {