diff --git a/Makefile b/Makefile index cac61786..bead7c83 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ prepare: go get -u github.com/mattn/goveralls go get -u github.com/axw/gocov/gocov go get -u golang.org/x/tools/cmd/cover - go get -u github.com/golang/lint/golint + go get -u github.com/alecthomas/gometalinter + gometalinter --install dev: go get -u github.com/golang/dep/... @@ -35,10 +36,7 @@ coverage: coverage.out rm -f coverage.out check: - go vet $(ALL_PACKAGES:%=./%) - for package in $(ALL_PACKAGES); do \ - golint ./$$package; \ - done + gometalinter --vendor --vendored-linters --config=linter.json ./... install: go install -v diff --git a/api/files.go b/api/files.go index 55fdb364..29a940a2 100644 --- a/api/files.go +++ b/api/files.go @@ -2,11 +2,12 @@ package api import ( "fmt" - "github.com/gin-gonic/gin" "io" "os" "path/filepath" "strings" + + "github.com/gin-gonic/gin" ) func verifyPath(path string) bool { diff --git a/api/graph.go b/api/graph.go index 5c3b8dc6..9ae5539a 100644 --- a/api/graph.go +++ b/api/graph.go @@ -3,12 +3,13 @@ package api import ( "bytes" "fmt" - "github.com/gin-gonic/gin" - "github.com/smira/aptly/deb" "io" "mime" "os" "os/exec" + + "github.com/gin-gonic/gin" + "github.com/smira/aptly/deb" ) // GET /api/graph.:ext?layout=[vertical|horizontal(default)] diff --git a/api/publish.go b/api/publish.go index a8459a11..f0dfed35 100644 --- a/api/publish.go +++ b/api/publish.go @@ -2,10 +2,11 @@ package api import ( "fmt" + "strings" + "github.com/gin-gonic/gin" "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" - "strings" ) // SigningOptions is a shared between publish API GPG options structure diff --git a/api/repos.go b/api/repos.go index 94740e1b..0ec3aad1 100644 --- a/api/repos.go +++ b/api/repos.go @@ -2,13 +2,14 @@ package api import ( "fmt" + "os" + "path/filepath" + "github.com/gin-gonic/gin" "github.com/smira/aptly/aptly" "github.com/smira/aptly/database" "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" - "os" - "path/filepath" ) // GET /api/repos diff --git a/api/snapshot.go b/api/snapshot.go index c4f475a0..eaf5a297 100644 --- a/api/snapshot.go +++ b/api/snapshot.go @@ -2,6 +2,7 @@ package api import ( "fmt" + "github.com/gin-gonic/gin" "github.com/smira/aptly/database" "github.com/smira/aptly/deb" diff --git a/aptly/interfaces.go b/aptly/interfaces.go index f8d72096..d760faf0 100644 --- a/aptly/interfaces.go +++ b/aptly/interfaces.go @@ -3,8 +3,9 @@ package aptly import ( - "github.com/smira/aptly/utils" "io" + + "github.com/smira/aptly/utils" ) // PackagePool is asbtraction of package pool storage. diff --git a/cmd/cmd.go b/cmd/cmd.go index 823abe9c..f641174d 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -4,13 +4,14 @@ package cmd import ( "bytes" "fmt" + "os" + "text/template" + "time" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/deb" "github.com/smira/commander" "github.com/smira/flag" - "os" - "text/template" - "time" ) // ListPackagesRefList shows list of packages in PackageRefList diff --git a/cmd/config_show.go b/cmd/config_show.go index 04f28648..119fd37f 100644 --- a/cmd/config_show.go +++ b/cmd/config_show.go @@ -3,6 +3,7 @@ package cmd import ( "encoding/json" "fmt" + "github.com/smira/commander" ) diff --git a/cmd/db_cleanup.go b/cmd/db_cleanup.go index 8a5e1825..685c5615 100644 --- a/cmd/db_cleanup.go +++ b/cmd/db_cleanup.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "sort" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" "github.com/smira/commander" - "sort" - "strings" ) // aptly db cleanup @@ -153,7 +154,7 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error { context.Progress().ColoredPrintf("@{w!}Loading list of all packages...@|") allPackageRefs := context.CollectionFactory().PackageCollection().AllPackageRefs() - toDelete := allPackageRefs.Substract(existingPackageRefs) + toDelete := allPackageRefs.Subtract(existingPackageRefs) // delete packages that are no longer referenced context.Progress().ColoredPrintf("@{r!}Deleting unreferenced packages (%d)...@|", toDelete.Len()) diff --git a/cmd/graph.go b/cmd/graph.go index 45d836b0..9da66a26 100644 --- a/cmd/graph.go +++ b/cmd/graph.go @@ -3,14 +3,15 @@ package cmd import ( "bytes" "fmt" - "github.com/smira/aptly/deb" - "github.com/smira/aptly/utils" - "github.com/smira/commander" "io" "io/ioutil" "os" "os/exec" "path/filepath" + + "github.com/smira/aptly/deb" + "github.com/smira/aptly/utils" + "github.com/smira/commander" ) func aptlyGraph(cmd *commander.Command, args []string) error { diff --git a/cmd/mirror.go b/cmd/mirror.go index e4ce494a..de91eb1e 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -1,10 +1,11 @@ package cmd import ( + "strings" + "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "strings" ) func getVerifier(flags *flag.FlagSet) (utils.Verifier, error) { diff --git a/cmd/mirror_create.go b/cmd/mirror_create.go index d8fbff71..9db0970f 100644 --- a/cmd/mirror_create.go +++ b/cmd/mirror_create.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" - "strings" ) func aptlyMirrorCreate(cmd *commander.Command, args []string) error { diff --git a/cmd/mirror_drop.go b/cmd/mirror_drop.go index 9f46461a..84ccd38d 100644 --- a/cmd/mirror_drop.go +++ b/cmd/mirror_drop.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/mirror_edit.go b/cmd/mirror_edit.go index b1ff2dba..2d31d77f 100644 --- a/cmd/mirror_edit.go +++ b/cmd/mirror_edit.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" diff --git a/cmd/mirror_list.go b/cmd/mirror_list.go index e2d7f1ed..3c1a40f1 100644 --- a/cmd/mirror_list.go +++ b/cmd/mirror_list.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "sort" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "sort" ) func aptlyMirrorList(cmd *commander.Command, args []string) error { diff --git a/cmd/mirror_rename.go b/cmd/mirror_rename.go index 68d2f8e3..2a3d362c 100644 --- a/cmd/mirror_rename.go +++ b/cmd/mirror_rename.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/mirror_show.go b/cmd/mirror_show.go index 4f7a308a..af94e742 100644 --- a/cmd/mirror_show.go +++ b/cmd/mirror_show.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "strings" ) func aptlyMirrorShow(cmd *commander.Command, args []string) error { diff --git a/cmd/publish_drop.go b/cmd/publish_drop.go index 9c465828..95bc6ac7 100644 --- a/cmd/publish_drop.go +++ b/cmd/publish_drop.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/publish_list.go b/cmd/publish_list.go index 69e5b4c6..8e1fdbb5 100644 --- a/cmd/publish_list.go +++ b/cmd/publish_list.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "sort" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "sort" ) func aptlyPublishList(cmd *commander.Command, args []string) error { diff --git a/cmd/publish_show.go b/cmd/publish_show.go index cf8310f1..fbb92aa8 100644 --- a/cmd/publish_show.go +++ b/cmd/publish_show.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "strings" ) func aptlyPublishShow(cmd *commander.Command, args []string) error { diff --git a/cmd/publish_snapshot.go b/cmd/publish_snapshot.go index 32fb1a8e..1cd89377 100644 --- a/cmd/publish_snapshot.go +++ b/cmd/publish_snapshot.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "strings" ) func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error { diff --git a/cmd/publish_switch.go b/cmd/publish_switch.go index 23b3b7b5..7c544ba8 100644 --- a/cmd/publish_switch.go +++ b/cmd/publish_switch.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "strings" ) func aptlyPublishSwitch(cmd *commander.Command, args []string) error { diff --git a/cmd/publish_update.go b/cmd/publish_update.go index befb2312..7db3a3fe 100644 --- a/cmd/publish_update.go +++ b/cmd/publish_update.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" "github.com/smira/flag" diff --git a/cmd/repo_add.go b/cmd/repo_add.go index f017c65e..326cdccf 100644 --- a/cmd/repo_add.go +++ b/cmd/repo_add.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" + "os" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/deb" "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "os" ) func aptlyRepoAdd(cmd *commander.Command, args []string) error { diff --git a/cmd/repo_drop.go b/cmd/repo_drop.go index a2bd4ad5..9c492d55 100644 --- a/cmd/repo_drop.go +++ b/cmd/repo_drop.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/repo_edit.go b/cmd/repo_edit.go index 018374b4..bdd0e325 100644 --- a/cmd/repo_edit.go +++ b/cmd/repo_edit.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/AlekSi/pointer" "github.com/smira/aptly/deb" "github.com/smira/commander" diff --git a/cmd/repo_include.go b/cmd/repo_include.go index 477e99ed..4a720d8b 100644 --- a/cmd/repo_include.go +++ b/cmd/repo_include.go @@ -3,15 +3,16 @@ package cmd import ( "bytes" "fmt" + "os" + "path/filepath" + "text/template" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "os" - "path/filepath" - "text/template" ) func aptlyRepoInclude(cmd *commander.Command, args []string) error { diff --git a/cmd/repo_list.go b/cmd/repo_list.go index 6c2452b3..fece3e11 100644 --- a/cmd/repo_list.go +++ b/cmd/repo_list.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "sort" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "sort" ) func aptlyRepoList(cmd *commander.Command, args []string) error { diff --git a/cmd/repo_move.go b/cmd/repo_move.go index 4eaeb259..8a222f47 100644 --- a/cmd/repo_move.go +++ b/cmd/repo_move.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "sort" + "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" - "sort" ) func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error { diff --git a/cmd/repo_remove.go b/cmd/repo_remove.go index 65a4ebb2..92bf77dd 100644 --- a/cmd/repo_remove.go +++ b/cmd/repo_remove.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/commander" diff --git a/cmd/repo_rename.go b/cmd/repo_rename.go index 969ef99d..dbe42c68 100644 --- a/cmd/repo_rename.go +++ b/cmd/repo_rename.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/repo_show.go b/cmd/repo_show.go index 89a599db..7ca5b009 100644 --- a/cmd/repo_show.go +++ b/cmd/repo_show.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/run.go b/cmd/run.go index ec78ae5b..42f34939 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "os" + ctx "github.com/smira/aptly/context" "github.com/smira/commander" - "os" ) // Run runs single command starting from root cmd with args, optionally initializing context diff --git a/cmd/serve.go b/cmd/serve.go index 03aabdf1..9e371436 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -2,16 +2,17 @@ package cmd import ( "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/deb" - "github.com/smira/aptly/utils" - "github.com/smira/commander" - "github.com/smira/flag" "net" "net/http" "os" "sort" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/deb" + "github.com/smira/aptly/utils" + "github.com/smira/commander" + "github.com/smira/flag" ) func aptlyServe(cmd *commander.Command, args []string) error { diff --git a/cmd/snapshot_create.go b/cmd/snapshot_create.go index aa9078fc..a9dcbe87 100644 --- a/cmd/snapshot_create.go +++ b/cmd/snapshot_create.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/snapshot_diff.go b/cmd/snapshot_diff.go index 8da16448..1ced963d 100644 --- a/cmd/snapshot_diff.go +++ b/cmd/snapshot_diff.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/snapshot_drop.go b/cmd/snapshot_drop.go index 4cbee1fa..a468255e 100644 --- a/cmd/snapshot_drop.go +++ b/cmd/snapshot_drop.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/snapshot_filter.go b/cmd/snapshot_filter.go index f07904b8..f54989e0 100644 --- a/cmd/snapshot_filter.go +++ b/cmd/snapshot_filter.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" + "sort" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" - "sort" - "strings" ) func aptlySnapshotFilter(cmd *commander.Command, args []string) error { diff --git a/cmd/snapshot_list.go b/cmd/snapshot_list.go index 06ba631c..bfa4a3c6 100644 --- a/cmd/snapshot_list.go +++ b/cmd/snapshot_list.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/snapshot_merge.go b/cmd/snapshot_merge.go index 73b53a70..7ed36a68 100644 --- a/cmd/snapshot_merge.go +++ b/cmd/snapshot_merge.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "strings" ) func aptlySnapshotMerge(cmd *commander.Command, args []string) error { diff --git a/cmd/snapshot_pull.go b/cmd/snapshot_pull.go index db4983d0..5b753d1a 100644 --- a/cmd/snapshot_pull.go +++ b/cmd/snapshot_pull.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" + "sort" + "strings" + "github.com/smira/aptly/deb" "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" - "sort" - "strings" ) func aptlySnapshotPull(cmd *commander.Command, args []string) error { diff --git a/cmd/snapshot_rename.go b/cmd/snapshot_rename.go index 38c36f7e..faaf396b 100644 --- a/cmd/snapshot_rename.go +++ b/cmd/snapshot_rename.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/deb" "github.com/smira/commander" ) diff --git a/cmd/snapshot_show.go b/cmd/snapshot_show.go index a0bf5f1b..4615debd 100644 --- a/cmd/snapshot_show.go +++ b/cmd/snapshot_show.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/commander" "github.com/smira/flag" ) diff --git a/cmd/snapshot_verify.go b/cmd/snapshot_verify.go index a52443e3..91a21eab 100644 --- a/cmd/snapshot_verify.go +++ b/cmd/snapshot_verify.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "sort" + "github.com/smira/aptly/deb" "github.com/smira/commander" - "sort" ) func aptlySnapshotVerify(cmd *commander.Command, args []string) error { diff --git a/cmd/version.go b/cmd/version.go index 52c8c6d9..5385e484 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/smira/aptly/aptly" "github.com/smira/commander" ) diff --git a/console/progress.go b/console/progress.go index a10980ea..4c58b747 100644 --- a/console/progress.go +++ b/console/progress.go @@ -2,10 +2,11 @@ package console import ( "fmt" + "strings" + "github.com/cheggaaa/pb" "github.com/smira/aptly/aptly" "github.com/wsxiaoys/terminal/color" - "strings" ) const ( diff --git a/console/terminal.go b/console/terminal.go index 5f414d2a..796edc28 100644 --- a/console/terminal.go +++ b/console/terminal.go @@ -1,8 +1,9 @@ package console import ( - "golang.org/x/crypto/ssh/terminal" "syscall" + + "golang.org/x/crypto/ssh/terminal" ) // RunningOnTerminal checks whether stdout is terminal diff --git a/context/context.go b/context/context.go index 0db75aa0..70991da8 100644 --- a/context/context.go +++ b/context/context.go @@ -3,6 +3,14 @@ package context import ( "fmt" + "os" + "path/filepath" + "runtime" + "runtime/pprof" + "strings" + "sync" + "time" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/console" "github.com/smira/aptly/database" @@ -14,13 +22,6 @@ import ( "github.com/smira/aptly/utils" "github.com/smira/commander" "github.com/smira/flag" - "os" - "path/filepath" - "runtime" - "runtime/pprof" - "strings" - "sync" - "time" ) // AptlyContext is a common context shared by all commands diff --git a/deb/changes.go b/deb/changes.go index 67482e99..45027827 100644 --- a/deb/changes.go +++ b/deb/changes.go @@ -2,13 +2,14 @@ package deb import ( "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "io/ioutil" "os" "path/filepath" "sort" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) // Changes is a result of .changes file parsing diff --git a/deb/changes_test.go b/deb/changes_test.go index 8d0db627..65b21936 100644 --- a/deb/changes_test.go +++ b/deb/changes_test.go @@ -1,9 +1,10 @@ package deb import ( - . "gopkg.in/check.v1" "os" "path/filepath" + + . "gopkg.in/check.v1" ) type ChangesSuite struct { diff --git a/deb/deb_test.go b/deb/deb_test.go index 797320fc..0260044d 100644 --- a/deb/deb_test.go +++ b/deb/deb_test.go @@ -1,10 +1,11 @@ package deb import ( - "github.com/smira/aptly/utils" "path/filepath" "runtime" + "github.com/smira/aptly/utils" + . "gopkg.in/check.v1" ) diff --git a/deb/graph.go b/deb/graph.go index 088f9953..ba543bcd 100644 --- a/deb/graph.go +++ b/deb/graph.go @@ -2,8 +2,9 @@ package deb import ( "fmt" - "github.com/awalterschulze/gographviz" "strings" + + "github.com/awalterschulze/gographviz" ) // BuildGraph generates graph contents from aptly object database @@ -18,15 +19,15 @@ func BuildGraph(collectionFactory *CollectionFactory, layout string) (gographviz var labelEnd string switch layout { - case "vertical": - graph.AddAttr("aptly", "rankdir", "LR") - labelStart = "" - labelEnd = "" - case "horizontal": - fallthrough - default: - labelStart = "{" - labelEnd = "}" + case "vertical": + graph.AddAttr("aptly", "rankdir", "LR") + labelStart = "" + labelEnd = "" + case "horizontal": + fallthrough + default: + labelStart = "{" + labelEnd = "}" } existingNodes := map[string]bool{} @@ -94,7 +95,7 @@ func BuildGraph(collectionFactory *CollectionFactory, layout string) (gographviz "shape": "Mrecord", "style": "filled", "fillcolor": "cadetblue1", - "label": fmt.Sprintf("%sSnapshot %s|%s|pkgs: %d%s", labelStart, + "label": fmt.Sprintf("%sSnapshot %s|%s|pkgs: %d%s", labelStart, snapshot.Name, description, snapshot.NumPackages(), labelEnd), }) diff --git a/deb/import.go b/deb/import.go index 08bb11b8..79caffae 100644 --- a/deb/import.go +++ b/deb/import.go @@ -1,12 +1,13 @@ package deb import ( - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "os" "path/filepath" "sort" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) // CollectPackageFiles walks filesystem collecting all candidates for package files diff --git a/deb/index_files.go b/deb/index_files.go index f643adbc..0ea14897 100644 --- a/deb/index_files.go +++ b/deb/index_files.go @@ -3,11 +3,12 @@ package deb import ( "bufio" "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "os" "path/filepath" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) type indexFiles struct { diff --git a/deb/local.go b/deb/local.go index a7e6f877..70455915 100644 --- a/deb/local.go +++ b/deb/local.go @@ -3,11 +3,12 @@ package deb import ( "bytes" "fmt" + "log" + "sync" + "github.com/smira/aptly/database" "github.com/smira/go-uuid/uuid" "github.com/ugorji/go/codec" - "log" - "sync" ) // LocalRepo is a collection of packages created locally diff --git a/deb/local_test.go b/deb/local_test.go index ebcce105..dc237910 100644 --- a/deb/local_test.go +++ b/deb/local_test.go @@ -2,6 +2,7 @@ package deb import ( "errors" + "github.com/smira/aptly/database" . "gopkg.in/check.v1" diff --git a/deb/package.go b/deb/package.go index 0b98a001..c8b8ef63 100644 --- a/deb/package.go +++ b/deb/package.go @@ -3,11 +3,12 @@ package deb import ( "encoding/json" "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "path/filepath" "strconv" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) // Package is single instance of Debian package @@ -317,7 +318,7 @@ func (p *Package) GetArchitecture() string { return p.Architecture } -// GetDependencies compiles list of dependenices by flags from options +// GetDependencies compiles list of dependncies by flags from options func (p *Package) GetDependencies(options int) (dependencies []string) { deps := p.Deps() diff --git a/deb/package_collection.go b/deb/package_collection.go index 1a3a0db4..abc45452 100644 --- a/deb/package_collection.go +++ b/deb/package_collection.go @@ -3,10 +3,11 @@ package deb import ( "bytes" "fmt" + "path/filepath" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/database" "github.com/ugorji/go/codec" - "path/filepath" ) // PackageCollection does management of packages in DB diff --git a/deb/package_files.go b/deb/package_files.go index bbf6e817..ba0c9dc9 100644 --- a/deb/package_files.go +++ b/deb/package_files.go @@ -3,14 +3,15 @@ package deb import ( "encoding/binary" "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "hash/fnv" "os" "path/filepath" "sort" "strconv" "strings" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) // PackageFile is a single file entry in package diff --git a/deb/package_files_test.go b/deb/package_files_test.go index fe11193f..209ee8ce 100644 --- a/deb/package_files_test.go +++ b/deb/package_files_test.go @@ -1,11 +1,12 @@ package deb import ( - "github.com/smira/aptly/files" - "github.com/smira/aptly/utils" "os" "path/filepath" + "github.com/smira/aptly/files" + "github.com/smira/aptly/utils" + . "gopkg.in/check.v1" ) diff --git a/deb/package_test.go b/deb/package_test.go index ec522500..20befa55 100644 --- a/deb/package_test.go +++ b/deb/package_test.go @@ -2,12 +2,13 @@ package deb import ( "bytes" - "github.com/smira/aptly/files" - "github.com/smira/aptly/utils" "os" "path/filepath" "regexp" + "github.com/smira/aptly/files" + "github.com/smira/aptly/utils" + . "gopkg.in/check.v1" ) diff --git a/deb/ppa.go b/deb/ppa.go index 3d45858b..07cf0420 100644 --- a/deb/ppa.go +++ b/deb/ppa.go @@ -2,10 +2,11 @@ package deb import ( "fmt" - "github.com/smira/aptly/utils" "os/exec" "regexp" "strings" + + "github.com/smira/aptly/utils" ) var ppaRegexp = regexp.MustCompile("^ppa:([^/]+)/(.+)$") diff --git a/deb/publish.go b/deb/publish.go index fef1de8d..df043fde 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -51,7 +51,7 @@ type PublishedRepo struct { // Map of sources by each component: component name -> source UUID Sources map[string]string - // Legacy fields for compatibily with old published repositories (< 0.6) + // Legacy fields for compatibility with old published repositories (< 0.6) Component string // SourceUUID is UUID of either snapshot or local repo SourceUUID string `codec:"SnapshotUUID"` diff --git a/deb/publish_test.go b/deb/publish_test.go index d2be9a03..102af098 100644 --- a/deb/publish_test.go +++ b/deb/publish_test.go @@ -4,13 +4,14 @@ import ( "bytes" "errors" "fmt" + "io/ioutil" + "os" + "path/filepath" + "github.com/smira/aptly/aptly" "github.com/smira/aptly/database" "github.com/smira/aptly/files" "github.com/ugorji/go/codec" - "io/ioutil" - "os" - "path/filepath" . "gopkg.in/check.v1" ) diff --git a/deb/reflist.go b/deb/reflist.go index b09fb10e..4dcb66ed 100644 --- a/deb/reflist.go +++ b/deb/reflist.go @@ -110,8 +110,8 @@ func (l *PackageRefList) Strings() []string { return result } -// Substract returns all packages in l that are not in r -func (l *PackageRefList) Substract(r *PackageRefList) *PackageRefList { +// Subtract returns all packages in l that are not in r +func (l *PackageRefList) Subtract(r *PackageRefList) *PackageRefList { result := &PackageRefList{Refs: make([][]byte, 0, 128)} // pointer to left and right reflists @@ -271,7 +271,7 @@ func (l *PackageRefList) Diff(r *PackageRefList, packageCollection *PackageColle // Merge merges reflist r into current reflist. If overrideMatching, merge // replaces matching packages (by architecture/name) with reference from r. -// If ignoreConflicting is set, all packages are preserved, otherwise conflciting +// If ignoreConflicting is set, all packages are preserved, otherwise conflicting // packages are overwritten with packages from "right" snapshot. func (l *PackageRefList) Merge(r *PackageRefList, overrideMatching, ignoreConflicting bool) (result *PackageRefList) { var overriddenArch, overridenName []byte @@ -328,7 +328,7 @@ func (l *PackageRefList) Merge(r *PackageRefList, overrideMatching, ignoreConfli if overrideMatching { if bytes.Equal(archL, overriddenArch) && bytes.Equal(nameL, overridenName) { - // this package has already been overriden on the right + // this package has already been overridden on the right il++ continue } diff --git a/deb/reflist_test.go b/deb/reflist_test.go index eb0aa433..da224177 100644 --- a/deb/reflist_test.go +++ b/deb/reflist_test.go @@ -2,6 +2,7 @@ package deb import ( "errors" + "github.com/smira/aptly/database" . "gopkg.in/check.v1" @@ -156,12 +157,12 @@ func (s *PackageRefListSuite) TestSubstract(c *C) { l4 := &PackageRefList{Refs: [][]byte{r4, r5}} l5 := &PackageRefList{Refs: [][]byte{r1, r2, r3}} - c.Check(l1.Substract(empty), DeepEquals, l1) - c.Check(l1.Substract(l2), DeepEquals, l3) - c.Check(l1.Substract(l3), DeepEquals, l2) - c.Check(l1.Substract(l4), DeepEquals, l5) - c.Check(empty.Substract(l1), DeepEquals, empty) - c.Check(l2.Substract(l3), DeepEquals, l2) + c.Check(l1.Subtract(empty), DeepEquals, l1) + c.Check(l1.Subtract(l2), DeepEquals, l3) + c.Check(l1.Subtract(l3), DeepEquals, l2) + c.Check(l1.Subtract(l4), DeepEquals, l5) + c.Check(empty.Subtract(l1), DeepEquals, empty) + c.Check(l2.Subtract(l3), DeepEquals, l2) } func (s *PackageRefListSuite) TestDiff(c *C) { diff --git a/deb/remote.go b/deb/remote.go index 7dd15aca..664f9c38 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -3,12 +3,6 @@ package deb import ( "bytes" "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/database" - "github.com/smira/aptly/http" - "github.com/smira/aptly/utils" - "github.com/smira/go-uuid/uuid" - "github.com/ugorji/go/codec" "log" "net/url" "os" @@ -20,6 +14,13 @@ import ( "sync" "syscall" "time" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/database" + "github.com/smira/aptly/http" + "github.com/smira/aptly/utils" + "github.com/smira/go-uuid/uuid" + "github.com/ugorji/go/codec" ) // RemoteRepo statuses diff --git a/deb/uploaders.go b/deb/uploaders.go index 17193c10..fd8d282f 100644 --- a/deb/uploaders.go +++ b/deb/uploaders.go @@ -3,9 +3,10 @@ package deb import ( "encoding/json" "fmt" + "os" + "github.com/DisposaBoy/JsonConfigReader" "github.com/smira/aptly/utils" - "os" ) // UploadersRule is single rule of format: what packages can group or key upload diff --git a/files/package_pool.go b/files/package_pool.go index e8ceb12a..ecffce42 100644 --- a/files/package_pool.go +++ b/files/package_pool.go @@ -2,12 +2,13 @@ package files import ( "fmt" - "github.com/smira/aptly/aptly" "io" "io/ioutil" "os" "path/filepath" "sync" + + "github.com/smira/aptly/aptly" ) // PackagePool is deduplicated storage of package files on filesystem diff --git a/files/public.go b/files/public.go index 70795dac..5dc976ae 100644 --- a/files/public.go +++ b/files/public.go @@ -2,11 +2,12 @@ package files import ( "fmt" - "github.com/smira/aptly/aptly" "io" "os" "path/filepath" "syscall" + + "github.com/smira/aptly/aptly" ) // PublishedStorage abstract file system with public dirs (published repos) diff --git a/http/fake.go b/http/fake.go index d564edc2..54767470 100644 --- a/http/fake.go +++ b/http/fake.go @@ -2,11 +2,12 @@ package http import ( "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/utils" "io" "os" "path/filepath" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/utils" ) type expectedRequest struct { diff --git a/linter.json b/linter.json new file mode 100644 index 00000000..c3040f1e --- /dev/null +++ b/linter.json @@ -0,0 +1,4 @@ +{ + "DisableAll": true, + "Enable": ["vet", "golint", "gofmt", "deadcode", "goimports", "misspell"] +} diff --git a/main.go b/main.go index 47d3b690..713954f0 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,9 @@ package main import ( - "github.com/smira/aptly/cmd" "os" + + "github.com/smira/aptly/cmd" ) func main() { diff --git a/man/gen.go b/man/gen.go index 0718940e..25b1c41d 100644 --- a/man/gen.go +++ b/man/gen.go @@ -2,9 +2,6 @@ package main import ( "fmt" - "github.com/smira/aptly/cmd" - "github.com/smira/commander" - "github.com/smira/flag" "io/ioutil" "log" "os" @@ -13,6 +10,10 @@ import ( "runtime" "strings" "text/template" + + "github.com/smira/aptly/cmd" + "github.com/smira/commander" + "github.com/smira/flag" ) func allFlags(flags *flag.FlagSet) []*flag.Flag { diff --git a/query/syntax.go b/query/syntax.go index ddd1e5cb..129d8905 100644 --- a/query/syntax.go +++ b/query/syntax.go @@ -2,11 +2,12 @@ package query import ( "fmt" - "github.com/smira/aptly/deb" "regexp" "strings" "unicode" "unicode/utf8" + + "github.com/smira/aptly/deb" ) type parser struct { diff --git a/query/syntax_test.go b/query/syntax_test.go index b3d5ce41..50efaed0 100644 --- a/query/syntax_test.go +++ b/query/syntax_test.go @@ -1,9 +1,10 @@ package query import ( - "github.com/smira/aptly/deb" "regexp" + "github.com/smira/aptly/deb" + . "gopkg.in/check.v1" ) diff --git a/s3/public.go b/s3/public.go index f9c52112..f9009976 100644 --- a/s3/public.go +++ b/s3/public.go @@ -2,6 +2,10 @@ package s3 import ( "fmt" + "os" + "path/filepath" + "strings" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" @@ -11,9 +15,6 @@ import ( "github.com/smira/aptly/aptly" "github.com/smira/aptly/files" "github.com/smira/go-aws-auth" - "os" - "path/filepath" - "strings" ) // PublishedStorage abstract file system with published files (actually hosted on S3) diff --git a/swift/public_test.go b/swift/public_test.go index 6e9d8161..f2b02ed5 100644 --- a/swift/public_test.go +++ b/swift/public_test.go @@ -2,13 +2,14 @@ package swift import ( "fmt" - . "gopkg.in/check.v1" "io/ioutil" "math/rand" "os" "path/filepath" "time" + . "gopkg.in/check.v1" + "github.com/ncw/swift/swifttest" "github.com/smira/aptly/files" diff --git a/systemd/activation/files.go b/systemd/activation/files.go index c8e85fcd..2caa0ecc 100644 --- a/systemd/activation/files.go +++ b/systemd/activation/files.go @@ -26,6 +26,7 @@ const ( listenFdsStart = 3 ) +// Files returns all the fds passed from systemd func Files(unsetEnv bool) []*os.File { if unsetEnv { defer os.Unsetenv("LISTEN_PID")