Skip to content

Instantly share code, notes, and snippets.

import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2/hclsimple"
)
var (
exampleHCL = `
task "first_task" {
exec "list_current_dir" {
type Config struct {
Tasks []*Task `hcl:"task,block"`
}
type Task struct {
Name string `hcl:"name,label"`
Steps []*ExecStep `hcl:"exec,block"`
}
type ExecStep struct {
Name string `hcl:"name,label"`
task "first_task" {
exec "list_current_dir" {
command = "ls ."
}
exec "list_var_dir" {
command = "ls /var"
}
}
package main
import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclsimple"
)
package main
import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2/hclsimple"
)
var (