config, err := os.UserConfigDir()
if err != nil {
return "", errors.Wrap(err, "failed to get UserConfigDir")
}
tmplPath := filepath.Join(config, "suborbital", "templates")
if os.Stat(tmplPath); err != nil {
//
}
The err != nil check after os.Stat is using the err variable from or.UserConfigDir, and we already guaranteed that's always going to be nil by the time execution gets to os.Stat.
Here: https://github.com/suborbital/subo/blob/main/builder/template/config.go#L38
The
err != nil
check after os.Stat is using theerr
variable fromor.UserConfigDir
, and we already guaranteed that's always going to be nil by the time execution gets toos.Stat
.Should be