Fixing megacheck issues reported by gometalinter

This commit is contained in:
tariqibrahim
2017-12-28 08:38:50 +05:30
committed by tariq1890
parent 9e7b523c43
commit fc16cf5477
8 changed files with 12 additions and 35 deletions

View File

@@ -26,7 +26,7 @@ func main() {
}
for _, d := range dirs {
path := "_repos/src/" + f.Name() + "/" + d.Name()
if time.Now().Sub(d.ModTime()) > 30*24*time.Hour {
if time.Since(d.ModTime()) > 30*24*time.Hour {
if *real {
log.Printf("Deleting %s (repo is old)...", path)
os.RemoveAll(path)

View File

@@ -56,12 +56,7 @@ func deleteRepo(repo string) error {
return err
}
err = mb.Put([]byte("scores"), scoreBytes)
if err != nil {
return err
}
return nil
return mb.Put([]byte("scores"), scoreBytes)
})
}
@@ -110,7 +105,7 @@ func listDuplicates() error {
func main() {
flag.Parse()
if *repo == "" && *listDupes == false {
if *repo == "" && !*listDupes {
log.Println("Usage: manage_db.go [-list-duplicates] [-remove repo]")
return
}

View File

@@ -75,12 +75,7 @@ func main() {
if err != nil {
return err
}
err = mb.Put([]byte("scores"), scoreBytes)
if err != nil {
return err
}
return nil
return mb.Put([]byte("scores"), scoreBytes)
})
if err != nil {
log.Fatal(err)

View File

@@ -10,10 +10,7 @@ import (
"github.com/gojp/goreportcard/handlers"
)
const (
repoBucket string = "repos"
metaBucket string = "meta"
)
const repoBucket = "repos"
type checksResp struct {
Repo string `json:"repo"`