/usr/share/gocode/src/github.com/hashicorp/hil/example_test.go is in golang-github-hashicorp-hil-dev 0.0~git20160326.0.40da60f-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package hil_test
import (
"fmt"
"log"
"github.com/hashicorp/hil"
)
func Example_basic() {
input := "${6 + 2}"
tree, err := hil.Parse(input)
if err != nil {
log.Fatal(err)
}
value, valueType, err := hil.Eval(tree, &hil.EvalConfig{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Type: %s\n", valueType)
fmt.Printf("Value: %s\n", value)
// Output:
// Type: TypeString
// Value: 8
}
|