basic

command
v0.0.0-...-8586e24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2019 License: Unlicense Imports: 4 Imported by: 0

README

Basic

A simple example of decoding a hcl configuration into native go values. This examples showcases the following:

  • Defining top-level and object level attributes
  • Defining blocks with attributes
  • Specifying optional fields using the optional tag

Configuration

// version string attribute
version = "1.0.0"

// tags map attribute
tags = {
  "env" = "dev"
}

// Example of two user blocks. These will be handled as a slice of users in the `Configuration`
// struct.
user {
  username        = "floresj"
  first_name      = "John"
  last_name       = "Flores"
  cloud_providers = ["AWS"]
  enabled         = false
}

user {
  username   = "foo"
  first_name = "Foo"
  last_name  = "Bar"
  enabled    = true
}

Run it!

Run the main to see it in action.

go run main.go

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL