fix linting errors

This commit is contained in:
Herman Schaaf
2019-07-28 21:26:00 +01:00
parent 557c8221d1
commit 74d9b259e3
8 changed files with 10 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ import (
"github.com/siddontang/ledisdb/ledis"
)
// Database represents the main functions that should be made available by a GRC database
// implementation
type Database interface {
GetRepo(string) (string, error)
SetRepo(repo string, value string) error

View File

@@ -10,6 +10,7 @@ import (
"github.com/gojp/goreportcard/database"
)
// BadgeHandler handles fetching badge images
type BadgeHandler struct {
DB database.Database
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/gojp/goreportcard/download"
)
// CheckHandler handles requests for checking repos
type CheckHandler struct {
DB database.Database
}

View File

@@ -25,6 +25,7 @@ func formatScore(x float64) string {
return fmt.Sprintf("%.2f", x)
}
// HighScoresHandler handles the stats page
type HighScoresHandler struct {
DB database.Database
}

View File

@@ -8,11 +8,12 @@ import (
"github.com/gojp/goreportcard/database"
)
// HomeHandler handles the homepage
type HomeHandler struct {
DB database.Database
}
// HomeHandler handles the homepage
// Handle handles the homepage
func (h *HomeHandler) Handle(w http.ResponseWriter, r *http.Request) {
if r.URL.Path[1:] == "" {

View File

@@ -14,6 +14,7 @@ import (
var domain = flag.String("domain", "goreportcard.com", "Domain used for your goreportcard installation")
var googleAnalyticsKey = flag.String("google_analytics_key", "UA-58936835-1", "Google Analytics Account Id")
// ReportHandler handles the report page
type ReportHandler struct {
DB database.Database
}

View File

@@ -13,7 +13,7 @@ import (
// Write file to temp and atomically move when everything else succeeds.
func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error {
dir, name := path.Dir(filename), path.Base(filename)
dir, name := path.Dir(filename), path.Base(filename)
f, err := ioutil.TempFile(dir, name)
if err != nil {
return err

View File

@@ -78,7 +78,7 @@ func (ms *memStorage) GetMeta() (FileDesc, error) {
func (ms *memStorage) List(ft FileType) ([]FileDesc, error) {
ms.mu.Lock()
var fds []FileDesc
for x, _ := range ms.files {
for x := range ms.files {
fd := unpackFile(x)
if fd.Type&ft != 0 {
fds = append(fds, fd)