Replace !os.IsNotExist with == nil

!os.IsNotExist would also be true for other errors which don't mean the
file exists.
This commit is contained in:
Filippo Valsorda
2018-08-12 21:42:42 -04:00
parent 561c99875b
commit 5fc72d92bc
2 changed files with 7 additions and 7 deletions

View File

@@ -25,12 +25,12 @@ var (
func init() {
_, err := os.Stat("/etc/pki/ca-trust/source/anchors/")
if !os.IsNotExist(err) {
if err == nil {
SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem"
SystemTrustCommand = []string{"update-ca-trust", "extract"}
} else {
_, err = os.Stat("/usr/local/share/ca-certificates/")
if !os.IsNotExist(err) {
if err == nil {
SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt"
SystemTrustCommand = []string{"update-ca-certificates"}
}