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

Encode: fix inline table first key value whitespace #837

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

cuonglm
Copy link
Contributor

@cuonglm cuonglm commented Jan 10, 2023

When encoding table inline, we should not apply ident. Otherwise, the key-value will be right align.

For example, this following data:

x := map[string][]map[string]string{
	"one": []map[string]string{
		{"0": "0"},
		{"1": "1"},
	},
}

will be encoded as:

one = [
  {  0 = '0'},
  {  1 = '1'}
]

This PR makes is to be encoded as:

one = [
  {0 = '0'},
  {1 = '1'}
]

@pelletier pelletier added the bug Issues describing a bug in go-toml. label Feb 1, 2023
@pelletier
Copy link
Owner

Looks good, thank you for the patch! Sorry it took me a while to find time to review.

@pelletier pelletier merged commit 090cccf into pelletier:v2 Feb 1, 2023
@pelletier pelletier changed the title Make inline table children indent better Fix inline table first key value whitespace Feb 1, 2023
@cuonglm cuonglm deleted the better-ident-inline-table branch February 1, 2023 11:01
@pelletier pelletier changed the title Fix inline table first key value whitespace Encode: fix inline table first key value whitespace Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants