parse

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignValue

func AssignValue(field reflect.Value, value string) error

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

type Value

type Value interface {
	String() string
	Set(string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL