Browse Source

Minor polishing using gometalinter.

Jguer 7 years ago
parent
commit
6305f86a3a
5 changed files with 11 additions and 12 deletions
  1. 1 0
      .gitignore
  2. 0 1
      Makefile
  3. 0 1
      clean.go
  4. 8 8
      cmd.go
  5. 2 2
      config.go

+ 1 - 0
.gitignore

@@ -21,3 +21,4 @@ _cgo_export.*
 *.test
 *.prof
 yay
+*.tar.gz

+ 0 - 1
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}

+ 0 - 1
clean.go

@@ -29,7 +29,6 @@ func removeVCSPackage(pkgs []string) {
 	}
 
 	_ = saveVCSInfo()
-	return
 }
 
 // CleanDependencies removes all dangling dependencies in system

+ 8 - 8
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)

+ 2 - 2
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"