func processCertDir(pool *x509.CertPool) (count int) {
	fileInfo, err := os.Stat(certDir)
	if os.IsNotExist(err) {
		logger.Tracef("cert dir %q does not exist", certDir)
		return -1
	}
	if err != nil {
		logger.Infof("unexpected error reading cert dir: %s", err)
		return -1
	}
	if !fileInfo.IsDir() {
		logger.Infof("cert dir %q is not a directory", certDir)
		return -1
	}

	matches, err := filepath.Glob(filepath.Join(certDir, "*.pem"))
	if err != nil {
		logger.Infof("globbing files failed: %s", err)
		return -1
	}

	for _, match := range matches {
		data, err := ioutil.ReadFile(match)
		if err != nil {
			logger.Infof("error reading %q: %v", match, err)
			continue
		}
		certificate, err := cert.ParseCert(string(data))
		if err != nil {
			logger.Infof("error parsing cert %q: %v", match, err)
			continue
		}
		pool.AddCert(certificate)
		count++
	}
	return count
}
// processCertDir iterates through the certDir looking for *.pem files.
// Each pem file is read in turn and added to the pool.  A count of the number
// of successful certificates processed is returned.
processCertDir iterates through the certDir looking for *.pem files.
Each pem file is read in turn and added to the pool.  A count of the number
of successful certificates processed is returned.
// processCertDir iterates through the certDir looking for * . pem files . // Each pem file is read in turn and added to the pool . A count of the number // of successful certificates processed is returned .
func processCertDir(pool *x509.CertPool) (count int) {
	fileInfo, err := os.Stat(certDir)
	if os.IsNotExist(err) {
		logger.Tracef("cert dir %q does not exist", certDir)
		return -1
	}
	if err != nil {
		logger.Infof("unexpected error reading cert dir: %s", err)
		return -1
	}
	if !fileInfo.IsDir() {
		logger.Infof("cert dir %q is not a directory", certDir)
		return -1
	}
	matches, err := filepath.Glob(filepath.Join(certDir, "*.pem"))
	if err != nil {
		logger.Infof("globbing files failed: %s", err)
		return -1
	}
	for _, match := range matches {
		data, err := ioutil.ReadFile(match)
		if err != nil {
			logger.Infof("error reading %q: %v", match, err)
			continue
		}
		certificate, err := cert.ParseCert(string(data))
		if err != nil {
			logger.Infof("error parsing cert %q: %v", match, err)
			continue
		}
		pool.AddCert(certificate)
		count++
	}
	return count
}
func processCertDir ( pool * x509 . CertPool ) ( count int ) { fileInfo , err := os . Stat ( certDir ) if os . IsNotExist ( err ) { logger . Tracef ( " " , certDir ) return - 1 } if err != nil { logger . Infof ( " " , err ) return - 1 } if ! fileInfo . IsDir ( ) { logger . Infof ( " " , certDir ) return - 1 } matches , err := filepath . Glob ( filepath . Join ( certDir , " " ) ) if err != nil { logger . Infof ( " " , err ) return - 1 } for _ , match := range matches { data , err := ioutil . ReadFile ( match ) if err != nil { logger . Infof ( " " , match , err ) continue } certificate , err := cert . ParseCert ( string ( data ) ) if err != nil { logger . Infof ( " " , match , err ) continue } pool . AddCert ( certificate ) count ++ } return count }
processCertDir iterates through the certDir looking for *.pem files.
processCertDir iterates through the certDir looking for * . pem files .