Drop regex for canonicalization (#102)
* Drop regex for canonicalization * Fix CI
This commit is contained in:
parent
5b1a42c2cd
commit
385e6d21d2
7 changed files with 19 additions and 19 deletions
|
|
@ -2,16 +2,19 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/constants"
|
||||
)
|
||||
|
||||
// TrimWhitespace removes whitespace from the end of each line of the input
|
||||
// string.
|
||||
func TrimWhitespace(input string) string {
|
||||
var re = regexp.MustCompile(`(?m)[ \t]*$`)
|
||||
return re.ReplaceAllString(input, "")
|
||||
func CanonicalizeAndTrim(text string) string {
|
||||
lines := strings.Split(text, "\n")
|
||||
|
||||
for i := range lines {
|
||||
lines[i] = strings.TrimRight(lines[i], " \t\r")
|
||||
}
|
||||
|
||||
return strings.Join(lines, "\r\n")
|
||||
}
|
||||
|
||||
// CreationTimeOffset stores the amount of seconds that a signature may be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue