Miscellaneous lint cleanup

pull/10616/head
Mark Rushakoff 2016-12-20 12:59:56 -08:00
parent ca377f87d2
commit eda39410e7
5 changed files with 15 additions and 11 deletions

View File

@ -94,6 +94,12 @@ func (a *Apps) All(ctx context.Context) ([]chronograf.Layout, error) {
func (a *Apps) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) {
var err error
layout.ID, err = a.IDs.Generate()
if err != nil {
a.Logger.
WithField("component", "apps").
Error("Unable to generate ID")
return chronograf.Layout{}, err
}
file := a.Filename(a.Dir, layout)
if err = a.Create(file, layout); err != nil {
if err == chronograf.ErrLayoutInvalid {
@ -152,7 +158,7 @@ func (a *Apps) Get(ctx context.Context, ID string) (chronograf.Layout, error) {
}
func (a *Apps) Update(ctx context.Context, layout chronograf.Layout) error {
l, file, err := a.idToFile(layout.ID)
l, _, err := a.idToFile(layout.ID)
if err != nil {
return err
}
@ -160,7 +166,7 @@ func (a *Apps) Update(ctx context.Context, layout chronograf.Layout) error {
if err := a.Delete(ctx, l); err != nil {
return err
}
file = a.Filename(a.Dir, layout)
file := a.Filename(a.Dir, layout)
return a.Create(file, layout)
}

View File

@ -181,7 +181,7 @@ func Error(w http.ResponseWriter, code int, msg string, logger chronograf.Logger
Error("Error message ", msg)
w.Header().Set("Content-Type", JSONType)
w.WriteHeader(code)
w.Write(b)
_, _ = w.Write(b)
}
func invalidData(w http.ResponseWriter, err error, logger chronograf.Logger) {

View File

@ -34,7 +34,7 @@ func Redoc(swagger string) http.HandlerFunc {
rw.Header().Set("Content-Type", "text/html; charset=utf-8")
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(fmt.Sprintf(index, swagger)))
_, _ = rw.Write([]byte(fmt.Sprintf(index, swagger)))
return
})
}

View File

@ -179,15 +179,13 @@ func reportUsageStats(bi BuildInfo, logger chronograf.Logger) {
WithField("freq", "24h").
WithField("stats", "os,arch,version,cluster_id,uptime")
l.Info("Reporting usage stats")
reporter.Save(u)
_, _ = reporter.Save(u)
ticker := time.NewTicker(24 * time.Hour)
defer ticker.Stop()
for {
select {
case <-ticker.C:
l.Debug("Reporting usage stats")
go reporter.Save(u)
}
<-ticker.C
l.Debug("Reporting usage stats")
go reporter.Save(u)
}
}

View File

@ -15,6 +15,6 @@ func Spec() http.HandlerFunc {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(swagger)
_, _ = w.Write(swagger)
})
}