Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix field marshaller #73

Merged
merged 2 commits into from
Mar 12, 2020
Merged

Fix field marshaller #73

merged 2 commits into from
Mar 12, 2020

Conversation

instabledesign
Copy link
Member

No description provided.

@codeclimate
Copy link

codeclimate bot commented Mar 12, 2020

Code Climate has analyzed commit 3f3c273 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 98.5% (0.0% change).

View more on Code Climate.

Copy link
Member

@rmasclef rmasclef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what the problem was ?

When reading the code, I understand that if we pass an object as value ... the json.Marshall won't work ?

@instabledesign
Copy link
Member Author

it will fix the json.Marshall(errors.New("my_error")) // will return empty string

@instabledesign instabledesign merged commit b4f500c into master Mar 12, 2020
@instabledesign instabledesign deleted the fix-marshaller branch March 12, 2020 21:30
@rmasclef
Copy link
Member

so there was no issue with other objects ?

case BoolType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, UintptrType, Float32Type, Float64Type:
return []byte(f.String()), nil
case SkipType, Complex64Type, Complex128Type, StringType, BinaryType, ByteStringType, ErrorType, TimeType, DurationType, StringerType:
return strconv.AppendQuote([]byte{}, f.String()), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Quote instead ;-)

@instabledesign
Copy link
Member Author

@rmasclef

so there was no issue with other objects ?

Which object have you in mind?

@rmasclef
Copy link
Member

well any type of object actually 👍

what makes an Error object not directly JSON marshallable whereas other objects are ?

@nsitbon
Copy link
Contributor

nsitbon commented Mar 13, 2020

I don't really understand the problem and the solution neither... @rmasclef pay attention to the return type of errors.New : it's not an object but an interface maybe it's hint for the proposed solution (even though I don't understand it too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants