1
0
Fork 0
forked from forgejo/forgejo

Update go-ini dependency and remove semicolon hack in translations (#2913)

This commit is contained in:
Lauris BH 2017-11-15 05:34:42 +02:00 committed by Lunny Xiao
parent bd23e36bec
commit a6f337046f
17 changed files with 584 additions and 429 deletions

16
vendor/gopkg.in/ini.v1/struct.go generated vendored
View file

@ -113,7 +113,7 @@ func setSliceWithProperType(key *Key, field reflect.Value, delim string, allowSh
default:
return fmt.Errorf("unsupported type '[]%s'", sliceOf)
}
if isStrict {
if err != nil && isStrict {
return err
}
@ -166,7 +166,7 @@ func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim stri
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
durationVal, err := key.Duration()
// Skip zero value
if err == nil && int(durationVal) > 0 {
if err == nil && int64(durationVal) > 0 {
field.Set(reflect.ValueOf(durationVal))
return nil
}
@ -450,6 +450,12 @@ func (s *Section) reflectFrom(val reflect.Value) error {
// Note: fieldName can never be empty here, ignore error.
sec, _ = s.f.NewSection(fieldName)
}
// Add comment from comment tag
if len(sec.Comment) == 0 {
sec.Comment = tpField.Tag.Get("comment")
}
if err = sec.reflectFrom(field); err != nil {
return fmt.Errorf("error reflecting field (%s): %v", fieldName, err)
}
@ -461,6 +467,12 @@ func (s *Section) reflectFrom(val reflect.Value) error {
if err != nil {
key, _ = s.NewKey(fieldName, "")
}
// Add comment from comment tag
if len(key.Comment) == 0 {
key.Comment = tpField.Tag.Get("comment")
}
if err = reflectWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil {
return fmt.Errorf("error reflecting field (%s): %v", fieldName, err)
}