Clean up lint in various packages

Changes fall into one of the following:

- gofmt -s
- receiver name is inconsistent
- omit unused 2nd value from range
- godoc comment formed incorrectly
- err assigned and not used
- if block ends with a return statement followed by else
This commit is contained in:
Cameron Moore
2017-09-25 21:25:33 -05:00
committed by Bjørn Erik Pedersen
parent d45e358a05
commit 47fdfd5196
12 changed files with 44 additions and 42 deletions

View File

@@ -150,9 +150,9 @@ func init() {
type Formats []Format
func (f Formats) Len() int { return len(f) }
func (f Formats) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
func (f Formats) Less(i, j int) bool { return f[i].Name < f[j].Name }
func (formats Formats) Len() int { return len(formats) }
func (formats Formats) Swap(i, j int) { formats[i], formats[j] = formats[j], formats[i] }
func (formats Formats) Less(i, j int) bool { return formats[i].Name < formats[j].Name }
// GetBySuffix gets a output format given as suffix, e.g. "html".
// It will return false if no format could be found, or if the suffix given
@@ -312,17 +312,17 @@ func decode(mediaTypes media.Types, input, output interface{}) error {
return decoder.Decode(input)
}
func (f Format) BaseFilename() string {
return f.BaseName + "." + f.MediaType.Suffix
func (formats Format) BaseFilename() string {
return formats.BaseName + "." + formats.MediaType.Suffix
}
func (f Format) MarshalJSON() ([]byte, error) {
func (formats Format) MarshalJSON() ([]byte, error) {
type Alias Format
return json.Marshal(&struct {
MediaType string
Alias
}{
MediaType: f.MediaType.String(),
Alias: (Alias)(f),
MediaType: formats.MediaType.String(),
Alias: (Alias)(formats),
})
}