tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

targets: support comments in target json files

Open ysoldak opened this issue 2 years ago • 4 comments

New dependency

  • muzzammil.xyz/jsonc This JSONC library is most up-to-date and widely used, also does not bring any extra dependencies.

Cleanup load() function was completely dropped, since it does not serve its purpose anymore, as its outdated comment hints upon. Target inheritance is handled by resolveInherits() function instead.

Related This PR replaces #2222

ysoldak avatar Jun 27 '23 14:06 ysoldak

@deadprogram can you see what's wrong with CircleCI's "test-all" check?

ysoldak avatar Jun 27 '23 20:06 ysoldak

Obviously this breaks any other tooling that expects "normal" JSON, such as https://github.com/tinygo-org/tinygo/pull/3533 . We might want to write our own formatting tool to keep the targets files consistent.

dgryski avatar Jul 05 '23 17:07 dgryski

Good point, so I'd rather switch to YAML for target files, but community wants "JSON with comments" 🤷

Adding comments to JSON obviously breaks compatibility with tools that do not expect comments and this is something was probably overlooked during JSONC discussion.

@soypat @aykevl @deadprogram opinions?

ysoldak avatar Jul 06 '23 09:07 ysoldak

Maybe we can avoid comments for internal use? Sorry, I forget if this change was meant for UX or so we could better document internal target.json files.

soypat avatar Jul 07 '23 19:07 soypat