Fix: return copylock value

This commit is contained in:
loyalsoldier 2020-07-21 18:29:15 +08:00
parent f8d018c777
commit 9339d3f433
No known key found for this signature in database
GPG Key ID: 23829BBC1ACF2C90

10
main.go
View File

@ -100,10 +100,10 @@ func parseDomain(domain string, entry *Entry) error {
return errors.New("Invalid format: " + domain)
}
func parseAttribute(attr string) (router.Domain_Attribute, error) {
func parseAttribute(attr string) (*router.Domain_Attribute, error) {
var attribute router.Domain_Attribute
if len(attr) == 0 || attr[0] != '@' {
return attribute, errors.New("invalid attribute: " + attr)
return &attribute, errors.New("invalid attribute: " + attr)
}
attr = attr[0:]
@ -115,11 +115,11 @@ func parseAttribute(attr string) (router.Domain_Attribute, error) {
attribute.Key = strings.ToLower(parts[0])
intv, err := strconv.Atoi(parts[1])
if err != nil {
return attribute, errors.New("invalid attribute: " + attr + ": " + err.Error())
return &attribute, errors.New("invalid attribute: " + attr + ": " + err.Error())
}
attribute.TypedValue = &router.Domain_Attribute_IntValue{IntValue: int64(intv)}
}
return attribute, nil
return &attribute, nil
}
func parseEntry(line string) (Entry, error) {
@ -140,7 +140,7 @@ func parseEntry(line string) (Entry, error) {
if err != nil {
return entry, err
}
entry.Attrs = append(entry.Attrs, &attr)
entry.Attrs = append(entry.Attrs, attr)
}
return entry, nil