gojson icon indicating copy to clipboard operation
gojson copied to clipboard

Field named "id" is translated as "ID", not "Id"

Open ChimeraCoder opened this issue 12 years ago • 2 comments

Most of the other fields are converted in CamelCase with the first character capitalized (so it is exported).

I can't think offhand of why this is being translated like this, or decide now whether it makes sense to special-case two letter ids like this, so I'm filing this issue as a reminder for this discussion point.

ChimeraCoder avatar Dec 25 '13 02:12 ChimeraCoder

Well, there's this: https://code.google.com/p/go-wiki/wiki/CodeReviewComments#Initialisms

But, honestly, the Go folks aren't consistent here. If you grep around in the Go sources you can find examples of both ID and Id. So whichever you think looks better. :)

gholt avatar Jun 13 '14 14:06 gholt

Since the go convention says so its recommended to follow that which is for short forms like id,ip,sid etc instead of changing to CamelCase use all capital letters .One thing to notice is when converting them back to json make sure _ is not used to separate capitalized letters

sarathsp06 avatar Oct 25 '15 04:10 sarathsp06