Permalink
Browse files

Fix some issues detected by Go vet

  • Loading branch information...
1 parent 3ca0fc2 commit d5fcea9616c6acc0954d117c57f607d35dd9b956 @etix committed Jun 18, 2017
Showing with 7 additions and 7 deletions.
  1. +1 −1 cli/commands.go
  2. +2 −2 http/http.go
  3. +1 −1 http/pagerenderer.go
  4. +1 −1 http/selection.go
  5. +1 −1 logs/logs_test.go
  6. +1 −1 mirrors/mirrors_test.go
View
@@ -894,7 +894,7 @@ func (c *cli) CmdShow(args ...string) error {
out, err := yaml.Marshal(mirror)
fmt.Printf("Mirror: %s\n%s\nComment:\n%s\n", id, out, mirror.Comment)
- return nil
+ return err
}
func (c *cli) CmdExport(args ...string) error {
View
@@ -53,7 +53,7 @@ type HTTP struct {
// Templates is a struct embedding instances of the precompiled templates
type Templates struct {
- sync.RWMutex
+ *sync.RWMutex
mirrorlist *template.Template
mirrorstats *template.Template
@@ -255,7 +255,7 @@ func (h *HTTP) mirrorHandler(w http.ResponseWriter, r *http.Request, ctx *Contex
CountryFields: []string{strings.ToUpper(f.CountryCode)},
ContinentCode: strings.ToUpper(f.ContinentCode)})
}
- sort.Sort(mirrors.ByRank{mlist, clientInfo})
+ sort.Sort(mirrors.ByRank{Mirrors: mlist, ClientInfo: clientInfo})
} else {
// No fallback in stock, there's nothing else we can do
http.Error(w, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
View
@@ -115,7 +115,7 @@ func (w *MirrorListRenderer) Write(ctx *Context, results *mirrors.Results) (stat
return http.StatusInternalServerError, ErrTemplatesNotFound
}
// Sort the exclude reasons by message so they appear grouped
- sort.Sort(mirrors.ByExcludeReason{results.ExcludedList})
+ sort.Sort(mirrors.ByExcludeReason{Mirrors: results.ExcludedList})
// Create a temporary output buffer to render the page
var buf bytes.Buffer
View
@@ -181,7 +181,7 @@ func (h DefaultEngine) Selection(ctx *Context, cache *mirrors.Cache, fileInfo *f
selected := len(weights)
// Sort mirrors by computed score
- sort.Sort(mirrors.ByComputedScore{mlist})
+ sort.Sort(mirrors.ByComputedScore{Mirrors: mlist})
if selected > 1 {
View
@@ -181,7 +181,7 @@ func TestOpenLogFile(t *testing.T) {
f.Close()
/* Open invalid file */
- f, newfile, err = openLogFile("")
+ f, _, err = openLogFile("")
if err == nil {
t.Fatalf("Error expected while opening invalid file")
}
View
@@ -81,7 +81,7 @@ func TestMirrors_Swap(t *testing.T) {
m.Swap(2, 4)
if !matchingMirrorOrder(m, []string{"M1", "M0", "M4", "M3", "M2"}) {
- t.Fatalf("Expected M4 at position 2 and M2 at position 4", m)
+ t.Fatal("Expected M4 at position 2 and M2 at position 4", m)
}
}

0 comments on commit d5fcea9

Please sign in to comment.