MCPcopy Create free account
hub / github.com/alecthomas/kong / Decode

Method Decode

mapper.go:776–788  ·  view source on GitHub ↗
(ctx *DecodeContext, target reflect.Value)

Source from the content-addressed store, hash-verified

774}
775
776func (p ptrMapper) Decode(ctx *DecodeContext, target reflect.Value) error {
777 elem := reflect.New(target.Type().Elem()).Elem()
778 nestedMapper := p.r.ForValue(elem)
779 if nestedMapper == nil {
780 return fmt.Errorf("cannot find mapper for %v", target.Type().Elem().String())
781 }
782 err := nestedMapper.Decode(ctx, elem)
783 if err != nil {
784 return err
785 }
786 target.Set(elem.Addr())
787 return nil
788}
789
790func counterMapper() MapperFunc {
791 return func(ctx *DecodeContext, target reflect.Value) error {

Callers

nothing calls this directly

Calls 5

ForValueMethod · 0.80
ErrorfMethod · 0.80
SetMethod · 0.80
DecodeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected