[NOD-782] Make sure errors.As gets parameter that implements error interface (#641)

* [NOD-782] Make sure errors.As gets parameter that implements error interface.

* [NOD-782] Pass pointer to errors.As
This commit is contained in:
Dan Aharoni 2020-02-27 12:27:38 +02:00 committed by GitHub
parent 5374d95416
commit ad04bbde83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ func loadConfig() (*ConfigFlags, []string, error) {
parser := flags.NewParser(activeConfig, flags.Default)
err = flags.NewIniParser(parser).ParseFile(preCfg.ConfigFile)
if err != nil {
if pErr := &(os.PathError{}); !errors.As(err, pErr) {
if pErr := &(os.PathError{}); !errors.As(err, &pErr) {
fmt.Fprintf(os.Stderr, "Error parsing config file: %s\n",
err)
fmt.Fprintln(os.Stderr, usageMessage)

View File

@ -311,7 +311,7 @@ func loadConfig() (*Config, []string, error) {
err := flags.NewIniParser(parser).ParseFile(preCfg.ConfigFile)
if err != nil {
if pErr := &(os.PathError{}); !errors.As(err, pErr) {
if pErr := &(os.PathError{}); !errors.As(err, &pErr) {
fmt.Fprintf(os.Stderr, "Error parsing config "+
"file: %s\n", err)
fmt.Fprintln(os.Stderr, usageMessage)