IIRC you need to update go tool dist to tell it that flag depends on math/big; 
see src/cmd/dist/deps.go

But if you only need math.Big flags for one project then one thing you could do 
is implement a wrapper type of sorts that implements flag.Value. For example,

        type BigIntFlag {
                big.Int         // an embed
        }

        // big.Int already implements String(); let the embed pass it up

        func (b *BigIntFlag) Set(s string) error {
                _, ok := b.SetString(s, 10)             // or 0, 2, 8, 16
                if !ok {
                        return fmt.Errorf("%q is not a big.Int", s)
                }
                return nil
        }

And then you can just use flag.Var() and/or flag.FlagSet.Var() to add a flag 
that understands that type.

(I don't know if the above implementation is perfect.)

> On Oct 15, 2016, at 12:12 AM, Michael Jones <michael.jo...@gmail.com> wrote:
> 
> I added an experimental feature to the Flags package in my Go source tree, 
> and now when I attempt to build the sequencing of the packages is not 
> reflecting the new dependency and the build fails mid-stream with:
>  
> Users/mtj/go/src/flag/flag.go:70: can't find import: "math/big"
> go tool dist: FAILED: /Users/mtj/go/pkg/tool/darwin_amd64/compile -pack -o 
> /var/folders/6w/y_5pxjsx4h1dhpyrlgq70qt80000gn/T/go-tool-dist-196452509/flag/_go_.a
>  -p flag /Users/mtj/go/src/flag/flag.go: exit status 2
> :
>  
> What do I need to update to make this work? Advice most welcome.
>  
> Michael
>  
> P.S. Why? Added big.Int, big.Rat, and big.Float to the types that Flags 
> understands…something I need and that seems generally useful.
>  
>  
>  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> <mailto:golang-nuts+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to