Style fixes from go vet.

This commit is contained in:
Andrey Smirnov
2015-02-22 14:36:14 +03:00
parent 903d4cefba
commit 618d06678c
6 changed files with 9 additions and 10 deletions

View File

@@ -36,7 +36,7 @@ coverage: coverage.out
rm -f coverage.out
check:
$(GOM) exec go tool vet -all=true -shadow=true $(ALL_PACKAGES:%=./%)
$(GOM) exec go tool vet -all=true $(ALL_PACKAGES:%=./%)
$(GOM) exec golint $(ALL_PACKAGES:%=./%)
install:

View File

@@ -42,7 +42,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
var packageFiles, failedFiles []string
packageFiles, failedFiles, err = deb.CollectPackageFiles(args[1:], &aptly.ConsoleResultReporter{context.Progress()})
packageFiles, failedFiles, err = deb.CollectPackageFiles(args[1:], &aptly.ConsoleResultReporter{Progress: context.Progress()})
if err != nil {
return fmt.Errorf("unable to collect package files: %s", err)
}
@@ -50,7 +50,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
var processedFiles, failedFiles2 []string
processedFiles, failedFiles2, err = deb.ImportPackageFiles(list, packageFiles, forceReplace, verifier, context.PackagePool(),
context.CollectionFactory().PackageCollection(), &aptly.ConsoleResultReporter{context.Progress()})
context.CollectionFactory().PackageCollection(), &aptly.ConsoleResultReporter{Progress: context.Progress()})
failedFiles = append(failedFiles, failedFiles2...)
if err != nil {
return fmt.Errorf("unable to import package files: %s", err)

View File

@@ -91,7 +91,7 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to parse query: %s", err)
}
// Add architecture filter
queries[i] = &deb.AndQuery{queries[i], archQuery}
queries[i] = &deb.AndQuery{L: queries[i], R: archQuery}
}
// Filter with dependencies as requested

View File

@@ -23,7 +23,7 @@ func aptlyTaskRun(cmd *commander.Command, args []string) error {
return fmt.Errorf("no such file, %s\n", filename)
}
fmt.Println("Reading file...\n")
fmt.Print("Reading file...\n\n")
var file *os.File
file, err = os.Open(filename)

View File

@@ -285,7 +285,6 @@ func (p *Package) GetField(name string) string {
default:
return p.Extra()[name]
}
return ""
}
// MatchesArchitecture checks whether packages matches specified architecture

View File

@@ -8,13 +8,13 @@ import (
func HumanBytes(i int64) (result string) {
switch {
case i > (512 * 1024 * 1024 * 1024):
result = fmt.Sprintf("%#.02f TiB", float64(i)/1024/1024/1024/1024)
result = fmt.Sprintf("%.02f TiB", float64(i)/1024/1024/1024/1024)
case i > (512 * 1024 * 1024):
result = fmt.Sprintf("%#.02f GiB", float64(i)/1024/1024/1024)
result = fmt.Sprintf("%.02f GiB", float64(i)/1024/1024/1024)
case i > (512 * 1024):
result = fmt.Sprintf("%#.02f MiB", float64(i)/1024/1024)
result = fmt.Sprintf("%.02f MiB", float64(i)/1024/1024)
case i > 512:
result = fmt.Sprintf("%#.02f KiB", float64(i)/1024)
result = fmt.Sprintf("%.02f KiB", float64(i)/1024)
default:
result = fmt.Sprintf("%d B", i)
}