Documentation
¶
Overview ¶
Package parse is used to convert strings when the target type is unknown at compile-time.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConversionError ¶
type ConversionError struct {
// contains filtered or unexported fields
}
Example ¶
package main
import (
"fmt"
"reflect"
"git.sr.ht/~rj/flags/internal/parse"
)
func main() {
var i int
err := parse.AssignValue(reflect.ValueOf(&i), "123.4")
if err != nil {
fmt.Printf("error: %s\n", err)
}
}
Output: error: could not convert '123.4': strconv.ParseInt: parsing "123.4": invalid syntax
func (*ConversionError) Error ¶
func (e *ConversionError) Error() string
func (*ConversionError) Unwrap ¶
func (e *ConversionError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.