projectdiscovery / goflags

A go flag wrapper with convenience helpers
MIT License
80 stars 18 forks source link

Remove shared global state from goflags to make it reusable #154

Open Ice3man543 opened 10 months ago

Ice3man543 commented 10 months ago

A lot of shared state is kept in the library which makes calling it multiple times from servers unusable.

We should remove global state and make library reusable.

An example causing panic when called multiple times -

var (
    optionMap           map[*StringSlice]Options
    optionDefaultValues map[*StringSlice][]string
)

func init() {
    optionMap = make(map[*StringSlice]Options)
    optionDefaultValues = make(map[*StringSlice][]string)
}