Skip to content

encoding/json: please document that float +inf/-inf/nan will cause json.Marshal return error  #59627

@bronze1man

Description

@bronze1man

What version of Go are you using (go version)?
go version go1.19.2 darwin/amd64

Does this issue reproduce with the latest release?
It does with go playground

What did you do?
Same as #3480

https://play.golang.org/p/K4xwS7iy4MP

What did you expect to see?
Document that float +inf/-inf/nan will cause json.Marshal return error or Not throwing serialization errors on basic numeric data types with valid state.

What did you see instead?
No document of this kind of thing and return json: unsupported value: NaN

Should golang standard library document possible/common error type of a package or a function like windows api document(https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilew) or linux man (https://linux.die.net/man/3/mmap)?
Code with standard library sometime looks like try and fix again and again without document of possible/common error type.

reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions