Go to file
Pavel Borzenkov 38f8eb7c6b Allow to use values (not pointers) with TextUnmarshaler
The patch makes sure that both values and pointer to values are checked
for custom TextUnmarshal implementation. This will allow to use go-arg
custom parsing as follows:

var args struct {
  Arg CustomType
}

instead of

var args struct {
  Arg *CustomType
}

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-16 17:09:52 +03:00
.gitignore add misc support files 2017-02-15 17:52:23 -08:00
.travis.yml add misc support files 2017-02-15 17:52:23 -08:00
LICENSE add misc support files 2017-02-15 17:52:23 -08:00
README.md add readme 2017-02-15 17:49:27 -08:00
scalar.go Allow to use values (not pointers) with TextUnmarshaler 2018-11-16 17:09:52 +03:00
scalar_test.go Allow to use values (not pointers) with TextUnmarshaler 2018-11-16 17:09:52 +03:00

README.md

GoDoc Build Status Coverage Status Report Card

Scalar parsing library

Scalar is a library for parsing strings into arbitrary scalars (integers, floats, strings, booleans, etc). It is helpful for tasks such as parsing strings passed as environment variables or command line arguments.

go get github.com/alexflint/go-scalar

The main API works as follows:

var value int
err := scalar.Parse(&value, "123")

There is also a variant that takes a reflect.Value:

var value int
err := scalar.ParseValue(reflect.ValueOf(&value), "123")