config/shconf/shconf.go
func (c *Config) Unmarshal(out interface{}) error {
	valueof := reflect.ValueOf(out)
	if valueof.Kind() != reflect.Ptr {
		return ErrStructPtr
	}
	valueof = valueof.Elem()
	if valueof.Kind() != reflect.Struct {
		return ErrStructPtr
	}

	typeof := valueof.Type()

	for i := 0; i < valueof.NumField(); i++ {
		fieldT := typeof.Field(i)
		fieldV := valueof.Field(i)

		if value, found := c.data[fieldT.Name]; found {
			switch fieldV.Kind() {
			case reflect.Bool:
				v, _ := strconv.ParseBool(value)
				fieldV.SetBool(v)

			case reflect.Int:
				v, _ := strconv.ParseInt(value, 10, 0)
				fieldV.SetInt(v)
			case reflect.Uint:
				v, _ := strconv.ParseUint(value, 10, 0)
				fieldV.SetUint(v)

			case reflect.Float64:
				v, _ := strconv.ParseFloat(value, 64)
				fieldV.SetFloat(v)
			/*case reflect.Float32:
				v, _ := strconv.ParseFloat(value, 32)
				fieldV.SetFloat(v)*/

			case reflect.String:
				fieldV.SetString(value)

			default:
				return TypeError(fieldV.Kind().String())
			}
		}
	}
	return nil
}
func (c *Config) Unmarshal(out interface{}) error {
	valueof := reflect.ValueOf(out)
	if valueof.Kind() != reflect.Ptr {
		return ErrStructPtr
	}
	valueof = valueof.Elem()
	if valueof.Kind() != reflect.Struct {
		return ErrStructPtr
	}

	typeof := valueof.Type()

	for i := 0; i < valueof.NumField(); i++ {
		fieldT := typeof.Field(i)
		fieldV := valueof.Field(i)

		if value, found := c.data[fieldT.Name]; found {
			switch fieldV.Kind() {
			case reflect.Bool:
				v, _ := strconv.ParseBool(value)
				fieldV.SetBool(v)

			case reflect.Int:
				v, _ := strconv.ParseInt(value, 10, 0)
				fieldV.SetInt(v)
			case reflect.Uint:
				v, _ := strconv.ParseUint(value, 10, 0)
				fieldV.SetUint(v)

			case reflect.Float64:
				v, _ := strconv.ParseFloat(value, 64)
				fieldV.SetFloat(v)
			/*case reflect.Float32:
				v, _ := strconv.ParseFloat(value, 32)
				fieldV.SetFloat(v)*/

			case reflect.String:
				fieldV.SetString(value)

			default:
				return TypeError(fieldV.Kind().String())
			}
		}
	}
	return nil
}
func ( c * Config ) Unmarshal ( out interface { } ) error { valueof := reflect . ValueOf ( out ) if valueof . Kind ( ) != reflect . Ptr { return ErrStructPtr } valueof = valueof . Elem ( ) if valueof . Kind ( ) != reflect . Struct { return ErrStructPtr } typeof := valueof . Type ( ) for i := 0 ; i < valueof . NumField ( ) ; i ++ { fieldT := typeof . Field ( i ) fieldV := valueof . Field ( i ) if value , found := c . data [ fieldT . Name ] ; found { switch fieldV . Kind ( ) { case reflect . Bool : v , _ := strconv . ParseBool ( value ) fieldV . SetBool ( v ) case reflect . Int : v , _ := strconv . ParseInt ( value , 10 , 0 ) fieldV . SetInt ( v ) case reflect . Uint : v , _ := strconv . ParseUint ( value , 10 , 0 ) fieldV . SetUint ( v ) case reflect . Float64 : v , _ := strconv . ParseFloat ( value , 64 ) fieldV . SetFloat ( v ) /*case reflect.Float32:
				v, _ := strconv.ParseFloat(value, 32)
				fieldV.SetFloat(v)*/ case reflect . String : fieldV . SetString ( value ) default : return TypeError ( fieldV . Kind ( ) . String ( ) ) } } } return nil }
// Unmarshal assigns values into the pointer to struct given by out, for the
// keys found.
//
// The valid types in the struct fields for the matched keys are: bool, int,
// uint, float64, string.
//
// The errors that Unmarshal return can be ErrStructPtr or TypeError.
Unmarshal assigns values into the pointer to struct given by out for the keys found . The valid types in the struct fields for the matched keys are : bool int uint float64 string . The errors that Unmarshal return can be ErrStructPtr or TypeError .