diff --git a/cmd/zclfmt/main.go b/cmd/hclfmt/main.go similarity index 95% rename from cmd/zclfmt/main.go rename to cmd/hclfmt/main.go index 6ccff3d..9e2c494 100644 --- a/cmd/zclfmt/main.go +++ b/cmd/hclfmt/main.go @@ -9,9 +9,9 @@ import ( "os" "strings" + "github.com/hashicorp/hcl2/hclparse" + "github.com/hashicorp/hcl2/hclwrite" "github.com/hashicorp/hcl2/zcl" - "github.com/hashicorp/hcl2/zclparse" - "github.com/hashicorp/hcl2/zclwrite" "golang.org/x/crypto/ssh/terminal" ) @@ -24,7 +24,7 @@ var ( showVersion = flag.Bool("version", false, "show the version number and immediately exit") ) -var parser = zclparse.NewParser() +var parser = hclparse.NewParser() var diagWr zcl.DiagnosticWriter // initialized in init var checkErrs = false var changed []string @@ -127,7 +127,7 @@ func processFile(fn string, in *os.File) error { } } - outSrc := zclwrite.Format(inSrc) + outSrc := hclwrite.Format(inSrc) if !bytes.Equal(inSrc, outSrc) { changed = append(changed, fn) diff --git a/ext/include/file_resolver.go b/ext/include/file_resolver.go index d1d73e5..ad31929 100644 --- a/ext/include/file_resolver.go +++ b/ext/include/file_resolver.go @@ -4,8 +4,8 @@ import ( "path/filepath" "strings" + "github.com/hashicorp/hcl2/hclparse" "github.com/hashicorp/hcl2/zcl" - "github.com/hashicorp/hcl2/zclparse" ) // FileResolver creates and returns a Resolver that interprets include paths @@ -23,7 +23,7 @@ import ( // If the path given in configuration ends with ".json" then the referenced // file is interpreted as JSON. Otherwise, it is interpreted as zcl native // syntax. -func FileResolver(baseDir string, parser *zclparse.Parser) Resolver { +func FileResolver(baseDir string, parser *hclparse.Parser) Resolver { return &fileResolver{ BaseDir: baseDir, Parser: parser, @@ -32,7 +32,7 @@ func FileResolver(baseDir string, parser *zclparse.Parser) Resolver { type fileResolver struct { BaseDir string - Parser *zclparse.Parser + Parser *hclparse.Parser } func (r fileResolver) ResolveBodyPath(path string, refRange zcl.Range) (zcl.Body, zcl.Diagnostics) { diff --git a/ext/include/transformer.go b/ext/include/transformer.go index 43d7b50..03664b3 100644 --- a/ext/include/transformer.go +++ b/ext/include/transformer.go @@ -2,7 +2,7 @@ package include import ( "github.com/hashicorp/hcl2/ext/transform" - "github.com/hashicorp/hcl2/gozcl" + "github.com/hashicorp/hcl2/gohcl" "github.com/hashicorp/hcl2/zcl" ) @@ -69,7 +69,7 @@ func (t *transformer) TransformBody(in zcl.Body) zcl.Body { pathExpr := incContent.Attributes["path"].Expr var path string - incDiags = gozcl.DecodeExpression(pathExpr, t.Ctx, &path) + incDiags = gohcl.DecodeExpression(pathExpr, t.Ctx, &path) diags = append(diags, incDiags...) if incDiags.HasErrors() { continue diff --git a/ext/include/transformer_test.go b/ext/include/transformer_test.go index 9fddb6b..0edcf4f 100644 --- a/ext/include/transformer_test.go +++ b/ext/include/transformer_test.go @@ -5,36 +5,36 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/gozcl" + "github.com/hashicorp/hcl2/gohcl" + "github.com/hashicorp/hcl2/hcltest" "github.com/hashicorp/hcl2/zcl" - "github.com/hashicorp/hcl2/zcltest" "github.com/zclconf/go-cty/cty" ) func TestTransformer(t *testing.T) { - caller := zcltest.MockBody(&zcl.BodyContent{ + caller := hcltest.MockBody(&zcl.BodyContent{ Blocks: zcl.Blocks{ { Type: "include", - Body: zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "path": zcltest.MockExprVariable("var_path"), + Body: hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "path": hcltest.MockExprVariable("var_path"), }), }), }, { Type: "include", - Body: zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "path": zcltest.MockExprLiteral(cty.StringVal("include2")), + Body: hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "path": hcltest.MockExprLiteral(cty.StringVal("include2")), }), }), }, { Type: "foo", - Body: zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "from": zcltest.MockExprLiteral(cty.StringVal("caller")), + Body: hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "from": hcltest.MockExprLiteral(cty.StringVal("caller")), }), }), }, @@ -42,25 +42,25 @@ func TestTransformer(t *testing.T) { }) resolver := MapResolver(map[string]zcl.Body{ - "include1": zcltest.MockBody(&zcl.BodyContent{ + "include1": hcltest.MockBody(&zcl.BodyContent{ Blocks: zcl.Blocks{ { Type: "foo", - Body: zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "from": zcltest.MockExprLiteral(cty.StringVal("include1")), + Body: hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "from": hcltest.MockExprLiteral(cty.StringVal("include1")), }), }), }, }, }), - "include2": zcltest.MockBody(&zcl.BodyContent{ + "include2": hcltest.MockBody(&zcl.BodyContent{ Blocks: zcl.Blocks{ { Type: "foo", - Body: zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "from": zcltest.MockExprLiteral(cty.StringVal("include2")), + Body: hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "from": hcltest.MockExprLiteral(cty.StringVal("include2")), }), }), }, @@ -84,7 +84,7 @@ func TestTransformer(t *testing.T) { Foos []foo `zcl:"foo,block"` } var got result - diags := gozcl.DecodeBody(merged, nil, &got) + diags := gohcl.DecodeBody(merged, nil, &got) if len(diags) != 0 { t.Errorf("unexpected diags") for _, diag := range diags { diff --git a/ext/transform/transform_test.go b/ext/transform/transform_test.go index a75dc0e..718b482 100644 --- a/ext/transform/transform_test.go +++ b/ext/transform/transform_test.go @@ -5,8 +5,8 @@ import ( "reflect" + "github.com/hashicorp/hcl2/hcltest" "github.com/hashicorp/hcl2/zcl" - "github.com/hashicorp/hcl2/zcltest" "github.com/zclconf/go-cty/cty" ) @@ -27,9 +27,9 @@ func TestDeep(t *testing.T) { return BodyWithDiagnostics(remain, diags) }) - src := zcltest.MockBody(&zcl.BodyContent{ - Attributes: zcltest.MockAttrs(map[string]zcl.Expression{ - "true": zcltest.MockExprLiteral(cty.True), + src := hcltest.MockBody(&zcl.BodyContent{ + Attributes: hcltest.MockAttrs(map[string]zcl.Expression{ + "true": hcltest.MockExprLiteral(cty.True), }), Blocks: []*zcl.Block{ { @@ -38,7 +38,7 @@ func TestDeep(t *testing.T) { }, { Type: "child", - Body: zcltest.MockBody(&zcl.BodyContent{ + Body: hcltest.MockBody(&zcl.BodyContent{ Blocks: []*zcl.Block{ { Type: "remove", @@ -70,8 +70,8 @@ func TestDeep(t *testing.T) { } } - wantAttrs := zcltest.MockAttrs(map[string]zcl.Expression{ - "true": zcltest.MockExprLiteral(cty.True), + wantAttrs := hcltest.MockAttrs(map[string]zcl.Expression{ + "true": hcltest.MockExprLiteral(cty.True), }) if !reflect.DeepEqual(rootContent.Attributes, wantAttrs) { t.Errorf("wrong root attributes\ngot: %#v\nwant: %#v", rootContent.Attributes, wantAttrs) diff --git a/ext/userfunc/decode.go b/ext/userfunc/decode.go index 15b9e53..8e477c5 100644 --- a/ext/userfunc/decode.go +++ b/ext/userfunc/decode.go @@ -1,7 +1,7 @@ package userfunc import ( - "github.com/hashicorp/hcl2/gozcl" + "github.com/hashicorp/hcl2/gohcl" "github.com/hashicorp/hcl2/zcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" @@ -72,13 +72,13 @@ func decodeUserFunctions(body zcl.Body, blockType string, contextFunc ContextFun var params []string var varParam string - paramsDiags := gozcl.DecodeExpression(paramsExpr, nil, ¶ms) + paramsDiags := gohcl.DecodeExpression(paramsExpr, nil, ¶ms) diags = append(diags, paramsDiags...) if paramsDiags.HasErrors() { continue } if varParamExpr != nil { - paramsDiags := gozcl.DecodeExpression(varParamExpr, nil, &varParam) + paramsDiags := gohcl.DecodeExpression(varParamExpr, nil, &varParam) diags = append(diags, paramsDiags...) if paramsDiags.HasErrors() { continue diff --git a/gozcl/decode.go b/gohcl/decode.go similarity index 99% rename from gozcl/decode.go rename to gohcl/decode.go index 8f54e8a..6ef741a 100644 --- a/gozcl/decode.go +++ b/gohcl/decode.go @@ -1,4 +1,4 @@ -package gozcl +package gohcl import ( "fmt" diff --git a/gozcl/decode_test.go b/gohcl/decode_test.go similarity index 99% rename from gozcl/decode_test.go rename to gohcl/decode_test.go index addb744..0372e1e 100644 --- a/gozcl/decode_test.go +++ b/gohcl/decode_test.go @@ -1,4 +1,4 @@ -package gozcl +package gohcl import ( "encoding/json" diff --git a/gozcl/doc.go b/gohcl/doc.go similarity index 99% rename from gozcl/doc.go rename to gohcl/doc.go index 33fe948..82ac545 100644 --- a/gozcl/doc.go +++ b/gohcl/doc.go @@ -46,4 +46,4 @@ // is bugs in the calling program, such as invalid struct tags, which are // surfaced via panics since there can be no useful runtime handling of such // errors and they should certainly not be returned to the user as diagnostics. -package gozcl +package gohcl diff --git a/gozcl/schema.go b/gohcl/schema.go similarity index 99% rename from gozcl/schema.go rename to gohcl/schema.go index 85d5fee..312d495 100644 --- a/gozcl/schema.go +++ b/gohcl/schema.go @@ -1,4 +1,4 @@ -package gozcl +package gohcl import ( "fmt" diff --git a/gozcl/schema_test.go b/gohcl/schema_test.go similarity index 99% rename from gozcl/schema_test.go rename to gohcl/schema_test.go index 9d884c2..548be1c 100644 --- a/gozcl/schema_test.go +++ b/gohcl/schema_test.go @@ -1,4 +1,4 @@ -package gozcl +package gohcl import ( "fmt" diff --git a/gozcl/types.go b/gohcl/types.go similarity index 96% rename from gozcl/types.go rename to gohcl/types.go index cfd37b2..b1e1e2c 100644 --- a/gozcl/types.go +++ b/gohcl/types.go @@ -1,4 +1,4 @@ -package gozcl +package gohcl import ( "reflect" diff --git a/zcldec/decode.go b/hcldec/decode.go similarity index 98% rename from zcldec/decode.go rename to hcldec/decode.go index e7cee7b..3eea489 100644 --- a/zcldec/decode.go +++ b/hcldec/decode.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "github.com/hashicorp/hcl2/zcl" diff --git a/zcldec/doc.go b/hcldec/doc.go similarity index 97% rename from zcldec/doc.go rename to hcldec/doc.go index 75d8335..8a89817 100644 --- a/zcldec/doc.go +++ b/hcldec/doc.go @@ -9,4 +9,4 @@ // package, which has a similar purpose but decodes directly into native // Go data types. zcldec instead targets the cty type system, and thus allows // a cty-driven application to remain within that type system. -package zcldec +package hcldec diff --git a/zcldec/gob.go b/hcldec/gob.go similarity index 97% rename from zcldec/gob.go rename to hcldec/gob.go index 357c119..31b2057 100644 --- a/zcldec/gob.go +++ b/hcldec/gob.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "encoding/gob" diff --git a/zcldec/public.go b/hcldec/public.go similarity index 99% rename from zcldec/public.go rename to hcldec/public.go index 7fc3cc1..f3e1ea5 100644 --- a/zcldec/public.go +++ b/hcldec/public.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "github.com/hashicorp/hcl2/zcl" diff --git a/zcldec/public_test.go b/hcldec/public_test.go similarity index 99% rename from zcldec/public_test.go rename to hcldec/public_test.go index e63f2fa..18ad46d 100644 --- a/zcldec/public_test.go +++ b/hcldec/public_test.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "fmt" diff --git a/zcldec/schema.go b/hcldec/schema.go similarity index 98% rename from zcldec/schema.go rename to hcldec/schema.go index 7f857f7..c4a1b51 100644 --- a/zcldec/schema.go +++ b/hcldec/schema.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "github.com/hashicorp/hcl2/zcl" diff --git a/zcldec/spec.go b/hcldec/spec.go similarity index 99% rename from zcldec/spec.go rename to hcldec/spec.go index 1bbf553..a910b40 100644 --- a/zcldec/spec.go +++ b/hcldec/spec.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "fmt" diff --git a/zcldec/spec_test.go b/hcldec/spec_test.go similarity index 97% rename from zcldec/spec_test.go rename to hcldec/spec_test.go index c3abed5..4982ffe 100644 --- a/zcldec/spec_test.go +++ b/hcldec/spec_test.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec // Verify that all of our spec types implement the necessary interfaces var objectSpecAsSpec Spec = ObjectSpec(nil) diff --git a/zcldec/variables.go b/hcldec/variables.go similarity index 98% rename from zcldec/variables.go rename to hcldec/variables.go index 78d114a..aed3695 100644 --- a/zcldec/variables.go +++ b/hcldec/variables.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "github.com/hashicorp/hcl2/zcl" diff --git a/zcldec/variables_test.go b/hcldec/variables_test.go similarity index 99% rename from zcldec/variables_test.go rename to hcldec/variables_test.go index 1f792d2..336b091 100644 --- a/zcldec/variables_test.go +++ b/hcldec/variables_test.go @@ -1,4 +1,4 @@ -package zcldec +package hcldec import ( "fmt" diff --git a/zcled/doc.go b/hcled/doc.go similarity index 93% rename from zcled/doc.go rename to hcled/doc.go index 9e77fd1..d5916f1 100644 --- a/zcled/doc.go +++ b/hcled/doc.go @@ -1,4 +1,4 @@ // Package zcled provides functionality intended to help an application // that embeds zcl to deliver relevant information to a text editor or IDE // for navigating around and analyzing configuration files. -package zcled +package hcled diff --git a/zcled/navigation.go b/hcled/navigation.go similarity index 97% rename from zcled/navigation.go rename to hcled/navigation.go index 6affb7d..87c0971 100644 --- a/zcled/navigation.go +++ b/hcled/navigation.go @@ -1,4 +1,4 @@ -package zcled +package hcled import ( "github.com/hashicorp/hcl2/zcl" diff --git a/zclparse/parser.go b/hclparse/parser.go similarity index 99% rename from zclparse/parser.go rename to hclparse/parser.go index b08edf3..c968cc2 100644 --- a/zclparse/parser.go +++ b/hclparse/parser.go @@ -1,4 +1,4 @@ -package zclparse +package hclparse import ( "fmt" diff --git a/zcltest/doc.go b/hcltest/doc.go similarity index 94% rename from zcltest/doc.go rename to hcltest/doc.go index f0bc927..ccb4e1c 100644 --- a/zcltest/doc.go +++ b/hcltest/doc.go @@ -3,4 +3,4 @@ // // This package is intended for use only in test code. It is optimized for // convenience of use over all other concerns. -package zcltest +package hcltest diff --git a/zcltest/mock.go b/hcltest/mock.go similarity index 99% rename from zcltest/mock.go rename to hcltest/mock.go index 22e9d52..8e1267b 100644 --- a/zcltest/mock.go +++ b/hcltest/mock.go @@ -1,4 +1,4 @@ -package zcltest +package hcltest import ( "fmt" diff --git a/zcltest/mock_test.go b/hcltest/mock_test.go similarity index 99% rename from zcltest/mock_test.go rename to hcltest/mock_test.go index adda967..fdf4620 100644 --- a/zcltest/mock_test.go +++ b/hcltest/mock_test.go @@ -1,4 +1,4 @@ -package zcltest +package hcltest import ( "testing" diff --git a/zclwrite/ast.go b/hclwrite/ast.go similarity index 99% rename from zclwrite/ast.go rename to hclwrite/ast.go index 54771ec..f4c1bb4 100644 --- a/zclwrite/ast.go +++ b/hclwrite/ast.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "bytes" diff --git a/zclwrite/ast_test.go b/hclwrite/ast_test.go similarity index 98% rename from zclwrite/ast_test.go rename to hclwrite/ast_test.go index a639b30..40459d4 100644 --- a/zclwrite/ast_test.go +++ b/hclwrite/ast_test.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "fmt" diff --git a/zclwrite/doc.go b/hclwrite/doc.go similarity index 95% rename from zclwrite/doc.go rename to hclwrite/doc.go index 3a7413e..148a8d7 100644 --- a/zclwrite/doc.go +++ b/hclwrite/doc.go @@ -4,4 +4,4 @@ // It operates at a different level of abstraction that the main zcl parser // and AST, since details such as the placement of comments and newlines // are preserved when unchanged. -package zclwrite +package hclwrite diff --git a/zclwrite/format.go b/hclwrite/format.go similarity index 99% rename from zclwrite/format.go rename to hclwrite/format.go index 5264e5e..66eb963 100644 --- a/zclwrite/format.go +++ b/hclwrite/format.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "github.com/hashicorp/hcl2/zcl/zclsyntax" diff --git a/zclwrite/format_test.go b/hclwrite/format_test.go similarity index 99% rename from zclwrite/format_test.go rename to hclwrite/format_test.go index e9438d4..c2ff9b4 100644 --- a/zclwrite/format_test.go +++ b/hclwrite/format_test.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "fmt" diff --git a/zclwrite/native_node_sorter.go b/hclwrite/native_node_sorter.go similarity index 96% rename from zclwrite/native_node_sorter.go rename to hclwrite/native_node_sorter.go index f992a56..49ce7ab 100644 --- a/zclwrite/native_node_sorter.go +++ b/hclwrite/native_node_sorter.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "github.com/hashicorp/hcl2/zcl/zclsyntax" diff --git a/zclwrite/parser.go b/hclwrite/parser.go similarity index 99% rename from zclwrite/parser.go rename to hclwrite/parser.go index 6dbdb9f..e1f2649 100644 --- a/zclwrite/parser.go +++ b/hclwrite/parser.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "sort" diff --git a/zclwrite/parser_test.go b/hclwrite/parser_test.go similarity index 99% rename from zclwrite/parser_test.go rename to hclwrite/parser_test.go index 02fc749..647a9e8 100644 --- a/zclwrite/parser_test.go +++ b/hclwrite/parser_test.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "fmt" diff --git a/zclwrite/public.go b/hclwrite/public.go similarity index 98% rename from zclwrite/public.go rename to hclwrite/public.go index f6e6d3e..75790cd 100644 --- a/zclwrite/public.go +++ b/hclwrite/public.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "bytes" diff --git a/zclwrite/round_trip_test.go b/hclwrite/round_trip_test.go similarity index 99% rename from zclwrite/round_trip_test.go rename to hclwrite/round_trip_test.go index a1cc69e..4fdca51 100644 --- a/zclwrite/round_trip_test.go +++ b/hclwrite/round_trip_test.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "bytes" diff --git a/zclwrite/tokens.go b/hclwrite/tokens.go similarity index 99% rename from zclwrite/tokens.go rename to hclwrite/tokens.go index 18b02f6..2b255d2 100644 --- a/zclwrite/tokens.go +++ b/hclwrite/tokens.go @@ -1,4 +1,4 @@ -package zclwrite +package hclwrite import ( "bytes"