@@ -271,27 +271,27 @@ func setFlags(flags *flagTracker, main interface{}, prefix string) error {
271271 // now check basic kinds
272272 switch ft .Type .Kind () {
273273 case reflect .String :
274- p := f .Addr ().Interface ().( * string )
274+ p := ( * string )( f .Addr ().UnsafePointer () )
275275 flags .string (p , flagName , shorthand , f .String (), flagHelp (ft ))
276276 case reflect .Bool :
277- p := f .Addr ().Interface ().( * bool )
277+ p := ( * bool )( f .Addr ().UnsafePointer () )
278278 flags .bool (p , flagName , shorthand , f .Bool (), flagHelp (ft ))
279279 case reflect .Int :
280- p := f .Addr ().Interface ().( * int )
280+ p := ( * int )( f .Addr ().UnsafePointer () )
281281 val := int (f .Int ())
282282 flags .int (p , flagName , shorthand , val , flagHelp (ft ))
283283 case reflect .Int64 :
284- p := f .Addr ().Interface ().( * int64 )
284+ p := ( * int64 )( f .Addr ().UnsafePointer () )
285285 flags .int64 (p , flagName , shorthand , f .Int (), flagHelp (ft ))
286286 case reflect .Float64 :
287- p := f .Addr ().Interface ().( * float64 )
287+ p := ( * float64 )( f .Addr ().UnsafePointer () )
288288 flags .float64 (p , flagName , shorthand , f .Float (), flagHelp (ft ))
289289 case reflect .Uint :
290- p := f .Addr ().Interface ().( * uint )
290+ p := ( * uint )( f .Addr ().UnsafePointer () )
291291 val := uint (f .Uint ())
292292 flags .uint (p , flagName , shorthand , val , flagHelp (ft ))
293293 case reflect .Uint64 :
294- p := f .Addr ().Interface ().( * uint64 )
294+ p := ( * uint64 )( f .Addr ().UnsafePointer () )
295295 flags .uint64 (p , flagName , shorthand , f .Uint (), flagHelp (ft ))
296296 case reflect .Slice :
297297 if ! flags .pflag {
@@ -317,43 +317,43 @@ func setFlags(flags *flagTracker, main interface{}, prefix string) error {
317317 if ! flags .pflag {
318318 return fmt .Errorf ("cannot support float32 field at '%v' with stdlib flag pkg." , flagName )
319319 }
320- p := f .Addr ().Interface ().( * float32 )
320+ p := ( * float32 )( f .Addr ().UnsafePointer () )
321321 flags .float32 (p , flagName , shorthand , * p , flagHelp (ft ))
322322 case reflect .Int16 :
323323 if ! flags .pflag {
324324 return fmt .Errorf ("cannot support int16 field at '%v' with stdlib flag pkg." , flagName )
325325 }
326- p := f .Addr ().Interface ().( * int16 )
326+ p := ( * int16 )( f .Addr ().UnsafePointer () )
327327 flags .int16 (p , flagName , shorthand , * p , flagHelp (ft ))
328328 case reflect .Int32 :
329329 if ! flags .pflag {
330330 return fmt .Errorf ("cannot support int32 field at '%v' with stdlib flag pkg." , flagName )
331331 }
332- p := f .Addr ().Interface ().( * int32 )
332+ p := ( * int32 )( f .Addr ().UnsafePointer () )
333333 flags .int32 (p , flagName , shorthand , * p , flagHelp (ft ))
334334 case reflect .Uint16 :
335335 if ! flags .pflag {
336336 return fmt .Errorf ("cannot support uint16 field at '%v' with stdlib flag pkg." , flagName )
337337 }
338- p := f .Addr ().Interface ().( * uint16 )
338+ p := ( * uint16 )( f .Addr ().UnsafePointer () )
339339 flags .uint16 (p , flagName , shorthand , * p , flagHelp (ft ))
340340 case reflect .Uint32 :
341341 if ! flags .pflag {
342342 return fmt .Errorf ("cannot support uint32 field at '%v' with stdlib flag pkg." , flagName )
343343 }
344- p := f .Addr ().Interface ().( * uint32 )
344+ p := ( * uint32 )( f .Addr ().UnsafePointer () )
345345 flags .uint32 (p , flagName , shorthand , * p , flagHelp (ft ))
346346 case reflect .Uint8 :
347347 if ! flags .pflag {
348348 return fmt .Errorf ("cannot support uint8 field at '%v' with stdlib flag pkg." , flagName )
349349 }
350- p := f .Addr ().Interface ().( * uint8 )
350+ p := ( * uint8 )( f .Addr ().UnsafePointer () )
351351 flags .uint8 (p , flagName , shorthand , * p , flagHelp (ft ))
352352 case reflect .Int8 :
353353 if ! flags .pflag {
354354 return fmt .Errorf ("cannot support int8 field at '%v' with stdlib flag pkg." , flagName )
355355 }
356- p := f .Addr ().Interface ().( * int8 )
356+ p := ( * int8 )( f .Addr ().UnsafePointer () )
357357 flags .int8 (p , flagName , shorthand , * p , flagHelp (ft ))
358358 case reflect .Struct :
359359 var newprefix string
0 commit comments