package asaModels import ( "errors" "regexp" ) type ( CheckSum struct { Value string `json:"checksum"` } ) var getCheckSum = regexp.MustCompile(`(?i)cryptochecksum:\s+(.*)\s+\n`) func (c *CheckSum) Parse(s string) error { if !getCheckSum.MatchString(s) { return errors.New("Unable to find checksum value") } search := getCheckSum.FindStringSubmatch(s) if len(search) < 1 { return errors.New("Unable to find checksum value") } c.Value = search[1] return nil }