Susumu Yata
null+****@clear*****
Tue Jul 11 17:43:36 JST 2017
Susumu Yata 2017-07-11 17:43:36 +0900 (Tue, 11 Jul 2017) New Revision: af3a59d8cba4167b845016223a1a18afae3b2b7a https://github.com/groonga/grnci/commit/af3a59d8cba4167b845016223a1a18afae3b2b7a Message: Fix bugs in MarshalJSON. Modified files: v2/error.go Modified: v2/error.go (+5 -1) =================================================================== --- v2/error.go 2017-07-11 15:52:01 +0900 (b1c3075) +++ v2/error.go 2017-07-11 17:43:36 +0900 (78da7ee) @@ -55,9 +55,11 @@ func (ec ErrorCode) String() string { // MarshalJSON returns the JSON-encoded error code. func (ec ErrorCode) MarshalJSON() ([]byte, error) { buf := make([]byte, 0, 24) + buf = append(buf, '"') buf = strconv.AppendInt(buf, int64(ec), 10) buf = append(buf, ' ') buf = append(buf, ec.Name()...) + buf = append(buf, '"') return buf, nil } @@ -241,10 +243,12 @@ func (rc ResultCode) String() string { // MarshalJSON returns the JSON-encoded error code. func (rc ResultCode) MarshalJSON() ([]byte, error) { - buf := make([]byte, 0, 24) + buf := make([]byte, 0, 48) + buf = append(buf, '"') buf = strconv.AppendInt(buf, int64(rc), 10) buf = append(buf, ' ') buf = append(buf, rc.Name()...) + buf = append(buf, '"') return buf, nil } -------------- next part -------------- HTML����������������������������...Télécharger