Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philandstuff/dhall-golang
Dhall bindings for go
https://github.com/philandstuff/dhall-golang
Last synced: 24 days ago
JSON representation
Dhall bindings for go
- Host: GitHub
- URL: https://github.com/philandstuff/dhall-golang
- Owner: philandstuff
- License: mit
- Created: 2019-02-07T20:57:30.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-02-25T02:40:30.000Z (almost 2 years ago)
- Last Synced: 2024-12-10T03:40:39.065Z (about 1 month ago)
- Language: Go
- Size: 1.73 MB
- Stars: 119
- Watchers: 6
- Forks: 10
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - philandstuff/dhall-golang - Dhall bindings for go (Go)
- awesome-dhall - dhall-golang - Go language support. (Binding)
README
# dhall-golang
[![GoDoc](https://godoc.org/github.com/philandstuff/dhall-golang?status.svg)][dhall-golang godoc]
Go bindings for the [dhall configuration language][dhall].
[dhall]: https://dhall-lang.org/
## Quick start
Here's a minimal example of how you might use dhall-golang to load a
Dhall file into your own struct:```golang
package mainimport (
"fmt""github.com/philandstuff/dhall-golang/v6"
)// Config can be a fairly arbitrary Go datatype. You would put your
// application configuration in this struct.
type Config struct {
Port int
Name string
}func main() {
var config Config
err = dhall.UnmarshalFile("/path/to/config.dhall", &config)
if err != nil {
panic(err)
}
fmt.Printf("Loaded config: %#v\n", config)
}
```## Documentation
You can find more documentation in the [dhall-golang godoc][].
[dhall-golang godoc]: https://godoc.org/github.com/philandstuff/dhall-golang/v6
## Development
This is a fairly standard Go project. It uses go modules, so no
vendoring of dependencies is required.### Running the tests
git submodule update --init --recursive
go test ./...
go test -short ./... # skips long-running tests
### Making changes to the PEG grammar
Dhall-golang uses [pigeon][] to generate the parser source file
`parser/internal/dhall.go` from the PEG grammar at
`parser/internal/dhall.peg`. If you change the PEG grammar, you need
to first install the pigeon binary if you don't already have it:# either outside a module directory, or with GO111MODULE=off
go get github.com/mna/pigeonThen, to regenerate the parser:
go generate ./parser
[pigeon]: https://godoc.org/github.com/mna/pigeon
## Support
Issues and pull requests are welcome on this repository. If you have
a question, you can ask it on the [Dhall discourse][].[Dhall discourse]: https://discourse.dhall-lang.org/