code: func ParseDurationFunc() mapstructure.DecodeHookFunc {
  	return func(
  		f reflect.Type,
  		t reflect.Type,
  		data interface{}) (interface{}, error) {
  		var v time.Duration
  		if t != reflect.TypeOf(v) {
  			return data, nil
  		}
  
  		switch {
  		case f.Kind() == reflect.String:
  			if dur, err := time.ParseDuration(data.(string)); err != nil {
  				return nil, err
  			} else {
  				v = dur
  			}
  			return v, nil
  		case f == reflect.SliceOf(reflect.TypeOf(uint8(0))):
  			s := Uint8ToString(data.([]uint8))
  			if dur, err := time.ParseDuration(s); err != nil {
  				return nil, err
  			} else {
  				v = dur
  			}
  			return v, nil
  		default:
  			return data, nil
  		}
  	}
  }
docs: // ParseDurationFunc is a mapstructure hook for decoding a string or
  // []uint8 into a time.Duration value.