diff --git a/agents.md b/agents.md index ae28e341..c8483551 100644 --- a/agents.md +++ b/agents.md @@ -136,6 +136,7 @@ Key methods: - Use build tags for optional compilation - Add comprehensive tests - 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_`. Be sure to also updqate the build_small-yq.sh and build-tinygo-yq.sh to not include the new format. ❌ **DON'T:** - Modify `candidate_node.go` to add format-specific logic diff --git a/pkg/yqlib/decoder_hcl.go b/pkg/yqlib/decoder_hcl.go index 3576e491..116d27b6 100644 --- a/pkg/yqlib/decoder_hcl.go +++ b/pkg/yqlib/decoder_hcl.go @@ -1,3 +1,5 @@ +//go:build !yq_nohcl + package yqlib import ( diff --git a/pkg/yqlib/encoder_hcl.go b/pkg/yqlib/encoder_hcl.go index 1d621f34..870cefa2 100644 --- a/pkg/yqlib/encoder_hcl.go +++ b/pkg/yqlib/encoder_hcl.go @@ -1,3 +1,5 @@ +//go:build !yq_nohcl + package yqlib import ( diff --git a/pkg/yqlib/no_hcl.go b/pkg/yqlib/no_hcl.go new file mode 100644 index 00000000..a9ef3f9e --- /dev/null +++ b/pkg/yqlib/no_hcl.go @@ -0,0 +1,11 @@ +//go:build yq_nohcl + +package yqlib + +func NewHclDecoder() Decoder { + return nil +} + +func NewHclEncoder() Encoder { + return nil +} diff --git a/project-words.txt b/project-words.txt index 97bb6a49..577ab603 100644 --- a/project-words.txt +++ b/project-words.txt @@ -268,6 +268,7 @@ tinygo nonexistent hclsyntax hclwrite +nohcl zclconf cty go-cty \ No newline at end of file diff --git a/scripts/build-small-yq.sh b/scripts/build-small-yq.sh index d6845e93..c21a2111 100755 --- a/scripts/build-small-yq.sh +++ b/scripts/build-small-yq.sh @@ -1,2 +1,2 @@ #!/bin/bash -go build -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson" -ldflags "-s -w" . \ No newline at end of file +go build -tags "yq_nolua yq_noini yq_notoml yq_noxml yq_nojson yq_nohcl" -ldflags "-s -w" . \ No newline at end of file diff --git a/scripts/build-tinygo-yq.sh b/scripts/build-tinygo-yq.sh index 043a362d..620cba8a 100755 --- a/scripts/build-tinygo-yq.sh +++ b/scripts/build-tinygo-yq.sh @@ -1,4 +1,4 @@ #!/bin/bash # 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" . \ No newline at end of file +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" . \ No newline at end of file