Adding HCL no build directive

This commit is contained in:
Mike Farah 2025-12-07 19:29:38 +11:00
parent fa42080148
commit bd3a647650
7 changed files with 19 additions and 2 deletions

View File

@ -136,6 +136,7 @@ Key methods:
- Use build tags for optional compilation - Use build tags for optional compilation
- Add comprehensive tests - Add comprehensive tests
- Handle errors gracefully - Handle errors gracefully
- Add the no build directive, like the xml encoder and decoder, that enables a minimal yq builds. e.g. `//go:build !yq_<format>`. Be sure to also updqate the build_small-yq.sh and build-tinygo-yq.sh to not include the new format.
❌ **DON'T:** ❌ **DON'T:**
- Modify `candidate_node.go` to add format-specific logic - Modify `candidate_node.go` to add format-specific logic

View File

@ -1,3 +1,5 @@
//go:build !yq_nohcl
package yqlib package yqlib
import ( import (

View File

@ -1,3 +1,5 @@
//go:build !yq_nohcl
package yqlib package yqlib
import ( import (

11
pkg/yqlib/no_hcl.go Normal file
View File

@ -0,0 +1,11 @@
//go:build yq_nohcl
package yqlib
func NewHclDecoder() Decoder {
return nil
}
func NewHclEncoder() Encoder {
return nil
}

View File

@ -268,6 +268,7 @@ tinygo
nonexistent nonexistent
hclsyntax hclsyntax
hclwrite hclwrite
nohcl
zclconf zclconf
cty cty
go-cty go-cty

View File

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
go build -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson" -ldflags "-s -w" . go build -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson yq_nohcl" -ldflags "-s -w" .

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# Currently, the `yq_nojson` feature must be enabled when using TinyGo. # Currently, the `yq_nojson` feature must be enabled when using TinyGo.
tinygo build -no-debug -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson yq_nocsv yq_nobase64 yq_nouri yq_noprops yq_nosh yq_noshell" . tinygo build -no-debug -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson yq_nocsv yq_nobase64 yq_nouri yq_noprops yq_nosh yq_noshell yq_nohcl" .