package main import ( "fmt" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hclsyntax" ) func main() { // Create an HCL object using the hclsyntax package obj, diags := hclsyntax.ParseConfig([]byte(` foo = "bar" baz { qux = true } `), "test.hcl", hcl.Pos{Line: 1, Column: 1}) if diags.HasErrors() { fmt.Printf("Failed to parse HCL: %s", diags) return } // Get an Elem object representing the "baz" block bazBlock, _ := obj.Body.JustOneBlock("baz") // Get an Elem object representing the "qux" attribute inside the "baz" block quxAttr, _ := bazBlock.Body.JustOneAttribute("qux") // Print the value of the "qux" attribute fmt.Println(quxAttr.Expr().(*hclsyntax.LiteralValueExpr).Val) }In this example, we create an HCL object using the `hclsyntax.ParseConfig` function and then use the `JustOneBlock` and `JustOneAttribute` methods to extract a specific block and attribute from the object. We then use the `Expr` method of the `Elem` object to extract the value of the attribute. Finally, we print the value of the attribute to stdout. Overall, the `github.com.hashicorp.hcl.hcl` package library provides a powerful set of tools for working with HCL objects in Go code.