1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package interpreter import ( "bytes" ) func format(ops []unionOperation) string { buf := bytes.NewBuffer(nil) _, _ = buf.WriteString(".entrypoint\n") for i := range ops { op := &ops[i] str := op.String() isLabel := op.Kind == operationKindLabel if !isLabel { const indent = "\t" str = indent + str } _, _ = buf.WriteString(str + "\n") } return buf.String() }