mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
* Add tests for get-zones * fix CAA, SSHFP, TLSA and other bugs * New format for get-zones: "djs" which is js but uses "disco commas" * Print diffs using github.com/andreyvit/diff Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
20 lines
555 B
Go
20 lines
555 B
Go
package diff
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// TrimLines applies TrimSpace to each string in the given array.
|
|
func TrimLines(input []string) []string {
|
|
result := make([]string, 0, len(input))
|
|
for _, el := range input {
|
|
result = append(result, strings.TrimSpace(el))
|
|
}
|
|
return result
|
|
}
|
|
|
|
// TrimLinesInString applies TrimSpace to each line in the given string, and returns the new trimmed string. Empty lines are not removed.
|
|
func TrimLinesInString(input string) string {
|
|
return strings.Join(TrimLines(strings.Split(strings.TrimSpace(input), "\n")), "\n")
|
|
}
|