1package git2go 2 3import ( 4 "strings" 5 "time" 6) 7 8var signatureSanitizer = strings.NewReplacer("\n", "", "<", "", ">", "") 9 10// Signature represents a commits signature. 11type Signature struct { 12 // Name of the author or the committer. 13 Name string 14 // Email of the author or the committer. 15 Email string 16 // When is the time of the commit. 17 When time.Time 18} 19 20// NewSignature creates a new sanitized signature. 21func NewSignature(name, email string, when time.Time) Signature { 22 return Signature{ 23 Name: signatureSanitizer.Replace(name), 24 Email: signatureSanitizer.Replace(email), 25 When: when.Truncate(time.Second), 26 } 27} 28