aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorbontequero <bontequero@gmail.com>2018-04-09 11:06:18 +0300
committerBrad Fitzpatrick <bradfitz@golang.org>2018-04-09 19:28:23 +0000
commit568d4848f672ecec3f9199452e9da1776a9fbba9 (patch)
tree35355858b4c3c4db222da8393986e028808ab66d /src/encoding
parent67cc1af133a2917e8f6ef4bd08b1251695fd2346 (diff)
downloadgo-568d4848f672ecec3f9199452e9da1776a9fbba9.tar.xz
encoding/json: remove unnecessary else conditions
Fixes golint warning about "if block ends with a return statement, so drop this else and outdent its block". Change-Id: Id17ad0bf37ba939386b177b709e9e3c067d8ba21 Reviewed-on: https://go-review.googlesource.com/105736 Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/encoding')
-rw-r--r--src/encoding/json/decode.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index d3ada54b69..9479e1a5c6 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -896,9 +896,8 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
if !ok {
if fromQuoted {
return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())
- } else {
- return errPhase
}
+ return errPhase
}
err := ut.UnmarshalText(s)
if err != nil {
@@ -952,9 +951,8 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
if !ok {
if fromQuoted {
return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())
- } else {
- return errPhase
}
+ return errPhase
}
switch v.Kind() {
default:
@@ -985,9 +983,8 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
if c != '-' && (c < '0' || c > '9') {
if fromQuoted {
return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())
- } else {
- return errPhase
}
+ return errPhase
}
s := string(item)
switch v.Kind() {
@@ -1001,9 +998,8 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
}
if fromQuoted {
return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())
- } else {
- return &UnmarshalTypeError{Value: "number", Type: v.Type(), Offset: int64(d.readIndex())}
}
+ return &UnmarshalTypeError{Value: "number", Type: v.Type(), Offset: int64(d.readIndex())}
case reflect.Interface:
n, err := d.convertNumber(s)
if err != nil {