Minor polishing using gometalinter.

This commit is contained in:
Jguer 2017-12-04 15:24:20 +09:00
parent 2ca3f4d726
commit 6305f86a3a
No known key found for this signature in database
GPG Key ID: 09754DBECF21746F
5 changed files with 11 additions and 12 deletions

1
.gitignore vendored
View File

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

View File

@ -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}

View File

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

16
cmd.go
View File

@ -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)

View File

@ -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"