change pointer receiver that implements interface MarshalJSON to struct receiver for all packages

This commit is contained in:
John Guo
2022-01-19 16:55:57 +08:00
parent d7b94428ae
commit 3bbbe1db9c
37 changed files with 54 additions and 36 deletions

View File

@ -185,7 +185,7 @@ func (err *Error) SetCode(code gcode.Code) {
// MarshalJSON implements the interface MarshalJSON for json.Marshal.
// Note that do not use pointer as its receiver here.
func (err *Error) MarshalJSON() ([]byte, error) {
func (err Error) MarshalJSON() ([]byte, error) {
return []byte(`"` + err.Error() + `"`), nil
}