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

Expose parser API as unstable #827

Merged
merged 3 commits into from
Nov 9, 2022
Merged

Expose parser API as unstable #827

merged 3 commits into from
Nov 9, 2022

Conversation

pelletier
Copy link
Owner

This change exposes the internal parser as an unstable API.

It would allow people who don't mind trading off stability for the ability to access the AST produced by the parser.

Ref #822

@mikefarah let me know what you think!

@pelletier pelletier added the feature Issue asking for a new feature in go-toml. label Oct 30, 2022
@mikefarah
Copy link

Looks good to me! Can't comment too much till I actually try to use it of course :)

@pelletier pelletier merged commit e195b58 into v2 Nov 9, 2022
@pelletier pelletier deleted the expose-unstable branch November 9, 2022 21:12
@mikefarah
Copy link

Hey @pelletier - how do I use the unstable API?

go get returns this error if I specify unstable:

go get github.com/pelletier/go-toml/v2/unstable

go: module github.com/pelletier/go-toml/v2@upgrade found (v2.0.5), but does not contain package github.com/pelletier/go-toml/v2/unstable

and if I just go get v2, then the unstable directory isn't there..

ls vendor/github.com/pelletier/go-toml/v2         
ci.sh  CONTRIBUTING.md  decode.go  doc.go  Dockerfile  errors.go  internal  LICENSE  localtime.go  marshaler.go  parser.go  README.md  scanner.go  SECURITY.md  strict.go  toml.abnf  types.go  unmarshaler.go  utf8.go

@pelletier
Copy link
Owner Author

I think this is because the unstable code has not been tagged yet, so go get defaults to the last tagged version, which does not include /unstable. You should be able to access it by specify the commit hash:

go get github.com/pelletier/go-toml/v2/unstable@94bd3ddcd650ed7a329f9f01c0b5926b8146b56a

I'll cut the release later today to simplify this for you.

@pelletier
Copy link
Owner Author

@mikefarah https://github.com/pelletier/go-toml/releases/tag/v2.0.6 there you go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue asking for a new feature in go-toml.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants