github.com/hashicorp/hcl/v2@v2.20.0/doc.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 // Package hcl contains the main modelling types and general utility functions 5 // for HCL. 6 // 7 // For a simple entry point into HCL, see the package in the subdirectory 8 // "hclsimple", which has an opinionated function Decode that can decode HCL 9 // configurations in either native HCL syntax or JSON syntax into a Go struct 10 // type: 11 // 12 // package main 13 // 14 // import ( 15 // "log" 16 // "github.com/hashicorp/hcl/v2/hclsimple" 17 // ) 18 // 19 // type Config struct { 20 // LogLevel string `hcl:"log_level"` 21 // } 22 // 23 // func main() { 24 // var config Config 25 // err := hclsimple.DecodeFile("config.hcl", nil, &config) 26 // if err != nil { 27 // log.Fatalf("Failed to load configuration: %s", err) 28 // } 29 // log.Printf("Configuration is %#v", config) 30 // } 31 // 32 // If your application needs more control over the evaluation of the 33 // configuration, you can use the functions in the subdirectories hclparse, 34 // gohcl, hcldec, etc. Splitting the handling of configuration into multiple 35 // phases allows for advanced patterns such as allowing expressions in one 36 // part of the configuration to refer to data defined in another part. 37 package hcl