aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/zclconf/go-cty-yaml/writerc.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/zclconf/go-cty-yaml/writerc.go')
-rw-r--r--vendor/github.com/zclconf/go-cty-yaml/writerc.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/zclconf/go-cty-yaml/writerc.go b/vendor/github.com/zclconf/go-cty-yaml/writerc.go
new file mode 100644
index 0000000..a2dde60
--- /dev/null
+++ b/vendor/github.com/zclconf/go-cty-yaml/writerc.go
@@ -0,0 +1,26 @@
1package yaml
2
3// Set the writer error and return false.
4func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool {
5 emitter.error = yaml_WRITER_ERROR
6 emitter.problem = problem
7 return false
8}
9
10// Flush the output buffer.
11func yaml_emitter_flush(emitter *yaml_emitter_t) bool {
12 if emitter.write_handler == nil {
13 panic("write handler not set")
14 }
15
16 // Check if the buffer is empty.
17 if emitter.buffer_pos == 0 {
18 return true
19 }
20
21 if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
22 return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error())
23 }
24 emitter.buffer_pos = 0
25 return true
26}