isOnlyComments returns true if the string contains only comment lines and whitespace.
(s string)
| 138 | |
| 139 | // isOnlyComments returns true if the string contains only comment lines and whitespace. |
| 140 | func isOnlyComments(s string) bool { |
| 141 | for _, line := range strings.Split(s, "\n") { |
| 142 | trimmed := strings.TrimSpace(line) |
| 143 | if trimmed != "" && !strings.HasPrefix(trimmed, "--") { |
| 144 | return false |
| 145 | } |
| 146 | } |
| 147 | return true |
| 148 | } |