Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/corn-config/corn-go
Libcorn native Go implementation
https://github.com/corn-config/corn-go
config configuration-files corn language parser
Last synced: 19 days ago
JSON representation
Libcorn native Go implementation
- Host: GitHub
- URL: https://github.com/corn-config/corn-go
- Owner: corn-config
- Created: 2024-05-02T21:28:40.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-05-10T16:48:32.000Z (9 months ago)
- Last Synced: 2024-05-10T18:52:32.248Z (9 months ago)
- Topics: config, configuration-files, corn, language, parser
- Language: Go
- Homepage: https://cornlang.dev
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Corn Go
Go implementation of [libcorn](https://github.com/corn-config/corn).
This is a full-spec implementation, which passes the reference test suite, so should work as expected.
That said, it has not currently been road-tested, and the code is rough around the edges, so I would not regard it production-ready.## Usage
Add the dependency:
```sh
go get github.com/corn-config/corn-go
``````go
package mainimport (
"fmt"
"github.com/corn-config/corn-go"
)func main() {
input := "let { $foo = 42} in { num = $foo }"
eval, err := corn.Evaluate(input)if err != nil {
// handle
}fmt.Println(eval.Value.Get("num")) // -> 42
}
```Support for deserializing into structs is currently missing.
Only `Evaluate` method is exposed currently, which will return an unstructured map.