Permalink
Browse files
Fix some issues detected by Go vet
- Loading branch information...
|
|
@@ -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 {
|
|
|
|
|
|
@@ -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)
|
|
|
|
|
|
@@ -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
|
|
|
|
|
|
@@ -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 {
|
|
|
|
|
|
|
|
|
@@ -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")
|
|
|
}
|
|
|
|
|
|
@@ -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