From 3775d69a6027df8be10a0a61c08573a40b84b26a Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Tue, 25 Jan 2022 14:44:33 +0100 Subject: [PATCH] Fix linting errors --- cmd/db_cleanup.go | 3 +++ cmd/mirror_show.go | 3 +++ cmd/snapshot_show.go | 3 +++ context/context.go | 2 +- http/download_go17.go | 1 + task/list.go | 3 ++- task/task.go | 3 ++- 7 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/db_cleanup.go b/cmd/db_cleanup.go index a8905169..66fece67 100644 --- a/cmd/db_cleanup.go +++ b/cmd/db_cleanup.go @@ -189,6 +189,9 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error { err = toDelete.ForEach(func(ref []byte) error { return collectionFactory.PackageCollection().DeleteByKey(ref, batch) }) + if err != nil { + return fmt.Errorf("unable to delete by key: %s", err) + } err = batch.Write() if err != nil { diff --git a/cmd/mirror_show.go b/cmd/mirror_show.go index 819f216d..7491b355 100644 --- a/cmd/mirror_show.go +++ b/cmd/mirror_show.go @@ -114,6 +114,9 @@ func aptlyMirrorShowJSON(cmd *commander.Command, args []string) error { if repo.RefList() != nil { var list *deb.PackageList list, err = deb.NewPackageListFromRefList(repo.RefList(), context.NewCollectionFactory().PackageCollection(), context.Progress()) + if err != nil { + return fmt.Errorf("unable to get package list: %s", err) + } list.PrepareIndex() list.ForEachIndexed(func(p *deb.Package) error { diff --git a/cmd/snapshot_show.go b/cmd/snapshot_show.go index 0682a732..98f15a9f 100644 --- a/cmd/snapshot_show.go +++ b/cmd/snapshot_show.go @@ -134,6 +134,9 @@ func aptlySnapshotShowJSON(cmd *commander.Command, args []string) error { if snapshot.RefList() != nil { var list *deb.PackageList list, err = deb.NewPackageListFromRefList(snapshot.RefList(), context.NewCollectionFactory().PackageCollection(), context.Progress()) + if err != nil { + return fmt.Errorf("unable to get package list: %s", err) + } list.PrepareIndex() list.ForEachIndexed(func(p *deb.Package) error { diff --git a/context/context.go b/context/context.go index 00ecbb86..6e4f771e 100644 --- a/context/context.go +++ b/context/context.go @@ -516,7 +516,7 @@ func (context *AptlyContext) GoContextHandleSignals() { defer context.Unlock() // Catch ^C - sigch := make(chan os.Signal) + sigch := make(chan os.Signal, 1) signal.Notify(sigch, os.Interrupt) var cancel gocontext.CancelFunc diff --git a/http/download_go17.go b/http/download_go17.go index a69a210c..5d67f1d8 100644 --- a/http/download_go17.go +++ b/http/download_go17.go @@ -1,3 +1,4 @@ +//go:build go1.7 // +build go1.7 package http diff --git a/task/list.go b/task/list.go index 95d874fd..472282b7 100644 --- a/task/list.go +++ b/task/list.go @@ -2,8 +2,9 @@ package task import ( "fmt" - "github.com/aptly-dev/aptly/aptly" "sync" + + "github.com/aptly-dev/aptly/aptly" ) // List is handling list of processes and makes sure diff --git a/task/task.go b/task/task.go index 59e6a4bb..54da0e3c 100644 --- a/task/task.go +++ b/task/task.go @@ -1,8 +1,9 @@ package task import ( - "github.com/aptly-dev/aptly/aptly" "sync/atomic" + + "github.com/aptly-dev/aptly/aptly" ) // State task is in