go vet/golint

This commit is contained in:
Stephen McQuay 2018-03-02 23:23:21 -08:00
parent da43058d0e
commit 52a4a7ed7b
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5
2 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
// Name exists to document the keys in Available // Name exists to document the keys in Available
type Name string type Name string
// Names is a slice of names ... with sorting!
type Names []Name type Names []Name
func (n Names) Len() int { return len(n) } func (n Names) Len() int { return len(n) }
@ -18,6 +19,8 @@ func (n Names) Less(a, b int) bool { return n[a] < n[b] }
// Version exists to document the keys in Available // Version exists to document the keys in Available
type Version string type Version string
// Versions is a slice of Version ... with sorting!
type Versions []Version type Versions []Version
// TODO (sm): make this semver sort? // TODO (sm): make this semver sort?
@ -54,9 +57,10 @@ func (a Available) Update(o Available) error {
return nil return nil
} }
// SetRemote adds the information in the url to the database.
func (a Available) SetRemote(u url.URL) { func (a Available) SetRemote(u url.URL) {
for n, vers := range a { for n, vers := range a {
for v, _ := range vers { for v := range vers {
m := a[n][v] m := a[n][v]
m.Remote = u m.Remote = u
a[n][v] = m a[n][v] = m
@ -64,6 +68,7 @@ func (a Available) SetRemote(u url.URL) {
} }
} }
// Traverse returns a chan of Meta that will be sanely sorted.
func (a Available) Traverse() <-chan Meta { func (a Available) Traverse() <-chan Meta {
r := make(chan Meta) r := make(chan Meta)
go func() { go func() {

View File

@ -13,6 +13,7 @@ import (
"mcquay.me/pm/pkg" "mcquay.me/pm/pkg"
) )
// Version stores the current version, and is updated at build time.
const Version = "dev" const Version = "dev"
const usage = `pm: simple, cross-platform system package manager const usage = `pm: simple, cross-platform system package manager