refactor: Remove unused import and clean up whitespace
This commit is contained in:
parent
e51702fb74
commit
3a7a21f97e
9
main.go
9
main.go
|
@ -4,7 +4,6 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -33,7 +32,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
domain := strings.TrimPrefix(parsedURL.Hostname(), "www.")
|
domain := strings.TrimPrefix(parsedURL.Hostname(), "www.")
|
||||||
|
|
||||||
// Create results file with domain and timestamp
|
// Create results file with domain and timestamp
|
||||||
filename := fmt.Sprintf("%s-%s.txt", domain, startTime.Format("2006-01-02-150405"))
|
filename := fmt.Sprintf("%s-%s.txt", domain, startTime.Format("2006-01-02-150405"))
|
||||||
f, err := os.Create(filename)
|
f, err := os.Create(filename)
|
||||||
|
@ -43,7 +42,7 @@ func main() {
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
fmt.Fprintf(f, "\nTotal pages checked: %d\n\n", checker.pagesChecked)
|
fmt.Fprintf(f, "\nTotal pages checked: %d\n\n", checker.pagesChecked)
|
||||||
|
|
||||||
if len(brokenLinks) == 0 {
|
if len(brokenLinks) == 0 {
|
||||||
fmt.Fprintf(f, "No issues found!\n")
|
fmt.Fprintf(f, "No issues found!\n")
|
||||||
fmt.Printf("Results written to %s\n", filename)
|
fmt.Printf("Results written to %s\n", filename)
|
||||||
|
@ -81,8 +80,8 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(f, "\nTotal issues: %d (%d redirects, %d broken)\n",
|
fmt.Fprintf(f, "\nTotal issues: %d (%d redirects, %d broken)\n",
|
||||||
len(brokenLinks), redirectCount, brokenCount)
|
len(brokenLinks), redirectCount, brokenCount)
|
||||||
|
|
||||||
fmt.Printf("Results written to %s\n", filename)
|
fmt.Printf("Results written to %s\n", filename)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue