Enable goconst & interfacer linters

This commit is contained in:
Andrey Smirnov
2017-05-16 00:26:41 +03:00
parent e396a2e6c3
commit 470165a419
26 changed files with 110 additions and 82 deletions
+18 -4
View File
@@ -41,6 +41,20 @@ type Package struct {
collection *PackageCollection
}
// Package types
const (
PackageTypeBinary = "deb"
PackageTypeUdeb = "udeb"
PackageTypeSource = "source"
)
// Special arhictectures
const (
ArchitectureAll = "all"
ArhictectureAny = "any"
ArchitectureSource = "source"
)
// Check interface
var (
_ json.Marshaler = &Package{}
@@ -218,12 +232,12 @@ func (p *Package) GetField(name string) string {
return p.Architecture
case "$PackageType":
if p.IsSource {
return "source"
return PackageTypeSource
}
if p.IsUdeb {
return "udeb"
return PackageTypeUdeb
}
return "deb"
return PackageTypeBinary
case "Name":
return p.Name
case "Version":
@@ -256,7 +270,7 @@ func (p *Package) GetField(name string) string {
// MatchesArchitecture checks whether packages matches specified architecture
func (p *Package) MatchesArchitecture(arch string) bool {
if p.Architecture == "all" && arch != "source" {
if p.Architecture == ArchitectureAll && arch != ArchitectureSource {
return true
}