Commit 23647655 authored by Nogweii's avatar Nogweii
Browse files

run go fmt

parent f3f3123a
......@@ -10,6 +10,7 @@ type Configuration struct {
}
var configuration Configuration
func readConfig() {
configuration.DomainsListPath = requireEnvVar("DOMAINS_LIST_PATH")
}
......
package main
import (
"strings"
"os"
"bufio"
"os"
"strings"
"github.com/CaliDog/certstream-go"
"github.com/gobwas/glob"
......@@ -32,7 +32,7 @@ func main() {
any_glob_match := false
for _, domain := range all_domains {
any_glob_match = any_glob_match || matchesDomains(domain)
any_glob_match = any_glob_match || matchesDomains(domain)
}
if any_glob_match {
......@@ -54,22 +54,22 @@ func main() {
func matchesDomains(domainName string) bool {
var any_match = false
for _, glob := range globs {
any_match = glob.Match(domainName) || any_match
}
for _, glob := range globs {
any_match = glob.Match(domainName) || any_match
}
return any_match
}
func readDomainsFromFile(filepath string) []glob.Glob {
file, err := os.Open(filepath)
if err != nil {
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Failed to open file ", filepath)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
text := scanner.Text()
// TODO: skip blank and commented lines
myGlob, err := glob.Compile(text)
......@@ -77,11 +77,11 @@ func readDomainsFromFile(filepath string) []glob.Glob {
log.WithFields(log.Fields{"error": err}).Fatal("Invalid glob ", text)
}
globs = append(globs, myGlob)
}
if err := scanner.Err(); err != nil {
}
if err := scanner.Err(); err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Could not scan through file")
}
}
return globs
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment