MCPcopy Create free account
hub / github.com/nsf/gocode / set_value

Function set_value

config.go:82–102  ·  view source on GitHub ↗
(v reflect.Value, value string)

Source from the content-addressed store, hash-verified

80}
81
82func set_value(v reflect.Value, value string) {
83 switch t := v; t.Kind() {
84 case reflect.Bool:
85 v, ok := g_string_to_bool[value]
86 if ok {
87 t.SetBool(v)
88 }
89 case reflect.String:
90 t.SetString(value)
91 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
92 v, err := strconv.ParseInt(value, 10, 64)
93 if err == nil {
94 t.SetInt(v)
95 }
96 case reflect.Float32, reflect.Float64:
97 v, err := strconv.ParseFloat(value, 64)
98 if err == nil {
99 t.SetFloat(v)
100 }
101 }
102}
103
104func list_value(v reflect.Value, name string, w io.Writer) {
105 switch t := v; t.Kind() {

Callers 1

set_optionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected