From 618d06678c44f18e0ca5e3e38f939d76bb23208d Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 22 Feb 2015 14:36:14 +0300 Subject: [PATCH] Style fixes from go vet. --- Makefile | 2 +- cmd/repo_add.go | 4 ++-- cmd/snapshot_pull.go | 2 +- cmd/task_run.go | 2 +- deb/package.go | 1 - utils/human.go | 8 ++++---- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d2bef587..bbb81482 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/cmd/repo_add.go b/cmd/repo_add.go index 760fa664..7529a105 100644 --- a/cmd/repo_add.go +++ b/cmd/repo_add.go @@ -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) diff --git a/cmd/snapshot_pull.go b/cmd/snapshot_pull.go index 59868988..db4983d0 100644 --- a/cmd/snapshot_pull.go +++ b/cmd/snapshot_pull.go @@ -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 diff --git a/cmd/task_run.go b/cmd/task_run.go index f7a62c20..0503997d 100644 --- a/cmd/task_run.go +++ b/cmd/task_run.go @@ -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) diff --git a/deb/package.go b/deb/package.go index 73a4e757..f032a222 100644 --- a/deb/package.go +++ b/deb/package.go @@ -285,7 +285,6 @@ func (p *Package) GetField(name string) string { default: return p.Extra()[name] } - return "" } // MatchesArchitecture checks whether packages matches specified architecture diff --git a/utils/human.go b/utils/human.go index 8f2eeaff..3a6f9aca 100644 --- a/utils/human.go +++ b/utils/human.go @@ -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) }