Don't make missing providers-config fatal on first-run (#527)
* fix readme golang demo for v2.5.0 * Don't make missing providers-config fatal on first-run It's okay if we fall back to the default config which is in memory & will get saved out when done parsing. This is on top of the work in #526, but a slightly different issue. See: https://github.com/projectdiscovery/subfinder/pull/526 Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: Sandeep Singh <sandeep@projectdiscovery.io> Co-authored-by: zhangchengguo <zhangchengguo@360.cn>dev
parent
64dc230104
commit
9a438c5eb4
|
@ -1,6 +1,9 @@
|
|||
package runner
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/projectdiscovery/gologger"
|
||||
"github.com/projectdiscovery/subfinder/v2/pkg/passive"
|
||||
"github.com/projectdiscovery/subfinder/v2/pkg/resolve"
|
||||
|
@ -44,7 +47,9 @@ func (options *Options) loadProvidersFrom(location string) {
|
|||
}
|
||||
|
||||
options.Providers = &Providers{}
|
||||
if err := options.Providers.UnmarshalFrom(location); isFatalErr(err) {
|
||||
// We skip bailing out if file doesn't exist because we'll create it
|
||||
// at the end of options parsing from default via goflags.
|
||||
if err := options.Providers.UnmarshalFrom(location); isFatalErr(err) && !errors.Is(err, os.ErrNotExist) {
|
||||
gologger.Fatal().Msgf("Could not read providers from %s: %s\n", location, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue