Git Product home page Git Product logo

flagoverride's People

Contributors

wangmeng99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

flagoverride's Issues

Array type causes panic

Hey there,

Thanks for the compact library. It's super useful. I've encountered a bug that I hope you can fix.

When printing default values (or running --help), the program panics. I've isolated it down to the use of Db []string. Removing this field will make the program run fine. This is tested on Mac 10.12.4 with go1.8.1.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14d4b6b]

goroutine 1 [running]:
nakama/vendor/github.com/uber-go/flagoverride.(*intSlice).String(0xc420116740, 0x1551ca0, 0xc420116740)
	vendor/github.com/uber-go/flagoverride/vars.go:210 +0x3b
flag.isZeroValue(0xc42001be00, 0xc420116598, 0x2, 0xc4201165a0)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:395 +0x102
flag.(*FlagSet).PrintDefaults.func1(0xc42001be00)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:469 +0x1b9
flag.(*FlagSet).VisitAll(0xc4200168a0, 0xc4200e3508)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:325 +0x67
flag.(*FlagSet).PrintDefaults(0xc4200168a0)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:478 +0x4f
flag.(*FlagSet).defaultUsage(0xc4200168a0)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:511 +0x8e
flag.(*FlagSet).(flag.defaultUsage)-fm()
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:973 +0x2a
flag.(*FlagSet).usage(0xc4200168a0)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:826 +0x2f
flag.(*FlagSet).parseOne(0xc4200168a0, 0x1, 0x1, 0x0)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:868 +0x200
flag.(*FlagSet).Parse(0xc4200168a0, 0xc42000c3b0, 0x1, 0x1, 0xc420019090, 0x199)
	/usr/local/Cellar/go/1.8.1/libexec/src/flag/flag.go:913 +0x60
project/vendor/github.com/uber-go/flagoverride.(*FlagMaker).ParseArgs(0xc4201163a0, 0x158ca80, 0xc420019090, 0xc42000c3b0, 0x1, 0x1, 0xc4200c16a0, 0xc42000e020, 0x182d860, 0xc4200fcb70, ...)
	vendor/github.com/uber-go/flagoverride/flags.go:273 +0x236

Config file looks like this:

type config struct {
	Name      string           `yaml:"name" json:"name"`
	Port      int              `yaml:"port" json:"port"`
        Db      []string         `yaml:"db" json:"db"`
}

Thanks.

Make cli flagset name configurable

A small feature request.

It would be great to be able to make the flagset name configurable. Currently, it is statically set to xFlags.

Moreover, it would be great if we could append additional flags to the flagset without them appearing in the config struct. For instance, things like "verbose" logging that we only ever setup during the application start and affects the log level will never be used anywhere else in the application and are not useful to have in the config struct.

Potentially exporting the fields in FlagMaker?

Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.