build: run gofmt on all go source files

Go 1.19 will forecefully format all your doc strings. To get this
out of the way, here is one big commit with all the changes gofmt
wants to make.
This commit is contained in:
Seth Hoenig
2022-08-16 09:06:30 -05:00
parent aebd61f5c5
commit 0c62f445c3
65 changed files with 349 additions and 352 deletions

View File

@@ -22,7 +22,6 @@ import (
// basedir is used with file functions and allows a user to reference a file
// using local path. Usually basedir is the directory in which the config file
// is located
//
func Functions(basedir string, allowFS bool) map[string]function.Function {
funcs := map[string]function.Function{
"abs": stdlib.AbsoluteFunc,

View File

@@ -341,9 +341,10 @@ func decodeTask(body hcl.Body, ctx *hcl.EvalContext, val interface{}) hcl.Diagno
//
// ```hcl
// # block assignment
// env {
// ENV = "production"
// }
//
// env {
// ENV = "production"
// }
//
// # as attribute
// env = { ENV: "production" }
@@ -357,7 +358,6 @@ func decodeTask(body hcl.Body, ctx *hcl.EvalContext, val interface{}) hcl.Diagno
// found map, the remaining body and diagnostics. If the named field is found
// with block syntax, it returns a nil map, and caller falls back to reading
// with block syntax.
//
func decodeAsAttribute(body hcl.Body, ctx *hcl.EvalContext, name string) (map[string]string, hcl.Body, hcl.Diagnostics) {
b, remain, diags := body.PartialContent(&hcl.BodySchema{
Attributes: []hcl.AttributeSchema{

View File

@@ -14,17 +14,21 @@ import (
// More concretely, it changes the following:
//
// ```
// config {
// meta { ... }
// }
//
// config {
// meta { ... }
// }
//
// ```
//
// to
//
// ```
// config {
// meta = { ... } # <- attribute now
// }
//
// config {
// meta = { ... } # <- attribute now
// }
//
// ```
func BlocksAsAttrs(body hcl.Body) hcl.Body {
if hclb, ok := body.(*hcls.Body); ok {

View File

@@ -1033,7 +1033,7 @@ func TestParseServiceCheck(t *testing.T) {
func TestWaitConfig(t *testing.T) {
ci.Parallel(t)
hclBytes, err := os.ReadFile("test-fixtures/template-wait-config.hcl")
require.NoError(t, err)

View File

@@ -78,7 +78,6 @@ func (v *Variable) GoString() string {
// validateValue ensures that all of the configured custom validations for a
// variable value are passing.
//
func (v *Variable) validateValue(val VariableAssignment) (diags hcl.Diagnostics) {
if len(v.Validations) == 0 {
return nil