From 6305f86a3a847df7fe0986891670009db189b53e Mon Sep 17 00:00:00 2001 From: Jguer Date: Mon, 4 Dec 2017 15:24:20 +0900 Subject: [PATCH] Minor polishing using gometalinter. --- .gitignore | 1 + Makefile | 1 - clean.go | 1 - cmd.go | 16 ++++++++-------- config.go | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b4e650a1..c48f3f86 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ _cgo_export.* *.test *.prof yay +*.tar.gz diff --git a/Makefile b/Makefile index 961ba129..9e53ae3e 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ build: go build -v -o ${OUTPUT}/${PKGNAME} ${LDFLAGS} release: GOARCH=${ARCH64} go build -v -o ${OUTPUT}/${PKGNAME} ${LDFLAGS} - cp ./LICENSE ${OUTPUT} cp ./yay.8 ${OUTPUT} cp ./zsh-completion ${OUTPUT} cp ./yay.fish ${OUTPUT} diff --git a/clean.go b/clean.go index b9b8bfb7..1877fbab 100644 --- a/clean.go +++ b/clean.go @@ -29,7 +29,6 @@ func removeVCSPackage(pkgs []string) { } _ = saveVCSInfo() - return } // CleanDependencies removes all dangling dependencies in system diff --git a/cmd.go b/cmd.go index e3f9e217..1884c448 100644 --- a/cmd.go +++ b/cmd.go @@ -94,8 +94,8 @@ func init() { // Save the default config if nothing is found config.saveConfig() } else { - cfile, err := os.OpenFile(configFile, os.O_RDWR|os.O_CREATE, 0644) - if err != nil { + cfile, errf := os.OpenFile(configFile, os.O_RDWR|os.O_CREATE, 0644) + if errf != nil { fmt.Println("Error reading config:", err) } else { defer cfile.Close() @@ -378,23 +378,23 @@ func numberMenu(pkgS []string, flags []string) (err error) { } // Complete provides completion info for shells -func complete() (err error) { +func complete() error { path := completionFile + config.Shell + ".cache" if info, err := os.Stat(path); os.IsNotExist(err) || time.Since(info.ModTime()).Hours() > 48 { os.MkdirAll(filepath.Dir(completionFile), 0755) - out, err := os.Create(path) - if err != nil { - return err + out, errf := os.Create(path) + if errf != nil { + return errf } if createAURList(out) != nil { defer os.Remove(path) } - err = createRepoList(out) + erra := createRepoList(out) out.Close() - return err + return erra } in, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644) diff --git a/config.go b/config.go index a5ef658c..db182548 100644 --- a/config.go +++ b/config.go @@ -27,7 +27,6 @@ const ( // Configuration stores yay's config. type Configuration struct { BuildDir string `json:"buildDir"` - CleanAfter bool `json:"cleanAfter"` Editor string `json:"editor"` MakepkgBin string `json:"makepkgbin"` Shell string `json:"-"` @@ -40,9 +39,10 @@ type Configuration struct { TimeUpdate bool `json:"timeupdate"` NoConfirm bool `json:"noconfirm"` Devel bool `json:"devel"` + CleanAfter bool `json:"cleanAfter"` } -const version = "2.217" +const version = "2.219" // baseURL givers the AUR default address. const baseURL string = "https://aur.archlinux.org"