"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/anonymize/anonymize.go" between
traefik-v2.3.2.src.tar.gz and traefik-v2.3.3.src.tar.gz

About: Traefik is a cloud native edge router, a reverse proxy and load balancer for HTTP and TCP-based applications.

anonymize.go  (traefik-v2.3.2.src):anonymize.go  (traefik-v2.3.3.src)
skipping to change at line 83 skipping to change at line 83
return err return err
} }
} }
case reflect.Slice: case reflect.Slice:
for j := 0; j < field.Len(); j++ { for j := 0; j < field.Len(); j++ {
if err := doOnStruct(field.Index(j)); err != nil { if err := doOnStruct(field.Index(j)); err != nil {
return err return err
} }
} }
} }
return nil return nil
} }
func reset(field reflect.Value, name string) error { func reset(field reflect.Value, name string) error {
if !field.CanSet() { if !field.CanSet() {
return fmt.Errorf("cannot reset field %s", name) return fmt.Errorf("cannot reset field %s", name)
} }
switch field.Kind() { switch field.Kind() {
case reflect.Ptr: case reflect.Ptr:
skipping to change at line 110 skipping to change at line 111
case reflect.String: case reflect.String:
if field.String() != "" { if field.String() != "" {
field.Set(reflect.ValueOf(maskShort)) field.Set(reflect.ValueOf(maskShort))
} }
case reflect.Map: case reflect.Map:
if field.Len() > 0 { if field.Len() > 0 {
field.Set(reflect.MakeMap(field.Type())) field.Set(reflect.MakeMap(field.Type()))
} }
case reflect.Slice: case reflect.Slice:
if field.Len() > 0 { if field.Len() > 0 {
field.Set(reflect.MakeSlice(field.Type(), 0, 0)) switch field.Type().Elem().Kind() {
case reflect.String:
slice := reflect.MakeSlice(field.Type(), field.Le
n(), field.Len())
for j := 0; j < field.Len(); j++ {
slice.Index(j).SetString(maskShort)
}
field.Set(slice)
default:
field.Set(reflect.MakeSlice(field.Type(), 0, 0))
}
} }
case reflect.Interface: case reflect.Interface:
if !field.IsNil() { if !field.IsNil() {
return reset(field.Elem(), "") return reset(field.Elem(), "")
} }
default: default:
// Primitive type // Primitive type
field.Set(reflect.Zero(field.Type())) field.Set(reflect.Zero(field.Type()))
} }
return nil return nil
skipping to change at line 133 skipping to change at line 143
// isExported return true is a struct field is exported, else false. // isExported return true is a struct field is exported, else false.
func isExported(f reflect.StructField) bool { func isExported(f reflect.StructField) bool {
if f.PkgPath != "" && !f.Anonymous { if f.PkgPath != "" && !f.Anonymous {
return false return false
} }
return true return true
} }
func marshal(anomConfig interface{}, indent bool) ([]byte, error) { func marshal(anomConfig interface{}, indent bool) ([]byte, error) {
if indent { if indent {
return json.MarshalIndent(anomConfig, "", " ") return json.MarshalIndent(anomConfig, "", " ")
} }
return json.Marshal(anomConfig) return json.Marshal(anomConfig)
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)