package
0.5.1
Repository: https://github.com/warthog618/config.git
Documentation: pkg.go.dev

# README

hcl

GoDoc

The hcl package provides a config Decoder that unmarshals values from HCL formatted sources.

Example usage:

import (
    "fmt"

    "github.com/warthog618/config"
    "github.com/warthog618/config/blob"
    "github.com/warthog618/config/blob/decoder/hcl"
    "github.com/warthog618/config/blob/loader/file"
)

func main() {
    c := config.New(blob.New(file.New("config.hcl"), hcl.NewDecoder(),blob.MustLoad()))
    s := c.MustGet("nested[0].string").String()
    fmt.Println("s:", s)
    // ....
}

Note that the HCL parser always converts objects into arrays of objects, even if there is only one instance of the object, hence the need for the indexing of nested, nested[0], in the example above. There is no way to define a single nested object in HCL.

# Functions

NewDecoder returns a HCL decoder.

# Structs

Decoder provides the Decoder API required by config.Source.