Print adds a line of code using the current indentation. Accepts printf-style format strings and arguments.
(args ...interface{})
| 29 | |
| 30 | // Print adds a line of code using the current indentation. Accepts printf-style format strings and arguments. |
| 31 | func (c *Code) Print(args ...interface{}) { |
| 32 | if len(args) > 0 { |
| 33 | for i := 0; i < c.indent; i++ { |
| 34 | c.text += indentation |
| 35 | } |
| 36 | c.text += fmt.Sprintf(args[0].(string), args[1:]...) |
| 37 | } |
| 38 | c.text += "\n" |
| 39 | } |
| 40 | |
| 41 | // PrintIf adds a line of code using the current indentation if a condition is true. Accepts printf-style format strings and arguments. |
| 42 | func (c *Code) PrintIf(condition bool, args ...interface{}) { |
no outgoing calls
no test coverage detected