diff options
author | Jonathan DeMasi <jon.demasi@colorado.edu> | 2019-06-05 13:15:24 -0600 |
---|---|---|
committer | Jonathan DeMasi <jon.demasi@colorado.edu> | 2019-06-05 13:15:24 -0600 |
commit | 0d07d4050753f701ad5eacff21f895ab77e624e9 (patch) | |
tree | 961dfb84022c0ddc23b65fb08ed50a41c925ee64 /main.go | |
parent | fdabe21bdb8ff72b63314f483114581ee2313c59 (diff) | |
download | gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar.gz gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar.bz2 gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar.lz gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar.xz gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.tar.zst gh_authkey_checker-0d07d4050753f701ad5eacff21f895ab77e624e9.zip |
changed some formatting via go fmt
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -1,13 +1,13 @@ package main import ( - "fmt" - "log" - "net" - "os" - "net/http" - "io/ioutil" - "time" + "fmt" + "io/ioutil" + "log" + "net" + "net/http" + "os" + "time" ) func parseArgs() string { @@ -18,11 +18,11 @@ func parseArgs() string { // We have one arg possible comma separated if len(os.Args) == 2 { - return(os.Args[1]) + return (os.Args[1]) } else { - log.Fatalln("You have provided too many arguments") - } - return("") + log.Fatalln("You have provided too many arguments") + } + return ("") } func fetchKeys(username string) string { @@ -36,40 +36,40 @@ func fetchKeys(username string) string { defer resp.Body.Close() - if resp.StatusCode == http.StatusOK { - bodyBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - log.Fatal(err) - } - bodyString := string(bodyBytes) - return(bodyString) - } - return("") + if resp.StatusCode == http.StatusOK { + bodyBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + log.Fatal(err) + } + bodyString := string(bodyBytes) + return (bodyString) + } + return ("") } // Need to fix this to not be an infinite loop func checkResolvers() { - i := 1 + i := 1 for i < 3 { _, err := net.LookupIP("github.com") if err != nil { log.Println("No DNS yet, trying again in 5s") - time.Sleep(5 * time.Second) - i += 1 + time.Sleep(5 * time.Second) + i += 1 } else { break } } - if i == 3 { - log.Fatalln("Could not reliably lookup host github.com") - } + if i == 3 { + log.Fatalln("Could not reliably lookup host github.com") + } return } func main() { - username := parseArgs() + username := parseArgs() checkResolvers() - keys := fetchKeys(username) - fmt.Print(keys) - return + keys := fetchKeys(username) + fmt.Print(keys) + return } |