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

Inline table GetPosition #412

Closed
mkmik opened this issue May 20, 2020 · 2 comments
Closed

Inline table GetPosition #412

mkmik opened this issue May 20, 2020 · 2 comments
Labels
bug Issues describing a bug in go-toml.

Comments

@mkmik
Copy link

mkmik commented May 20, 2020

Describe the bug
GetPosition (and GetPositionPath) return a position with column 0 if the tree element is inside an inline table:

To Reproduce

	config, _ = toml.Load(`    a.b.c = {  d = "e" }`)
	fmt.Println(config.GetPosition("a.b.c.d"))

It prints (1, 0).

Full example: https://play.golang.org/p/sOj2fK-WjLb

Expected behavior
The column number of the beginning of the addressed expression.
I don't honestly don't know if that should be the start of a.b.c =... or the start of the inner "d = .." .
But 0 seems wrong.

Versions

  • go-toml: v1.8.0
  • go: 1.14.3
  • operating system: macOS
@pelletier pelletier added the bug Issues describing a bug in go-toml. label May 22, 2020
@pelletier
Copy link
Owner

Good catch! GetPosition is supposed to return the position in the input of the given key, so for your example I would expect it to return (1, 16).

@pelletier
Copy link
Owner

Closing this issue, as go-toml v2.0.0 has been released, and it seems like this issue is not in scope for v2. As go-toml v1 will not be receiving any updates, please look into upgrading to the new version. If you believe this is a mistake please reach out!

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

No branches or pull requests

2 participants