mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 09:07:21 +01:00
Use megacheck to lint project
Signed-off-by: Jguer <me@jguer.space>
This commit is contained in:
parent
66362aa981
commit
d319576303
@ -21,11 +21,7 @@ func shouldUseGit(path string) bool {
|
||||
}
|
||||
|
||||
_, err = os.Stat(filepath.Join(path, ".git"))
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return os.IsExist(err)
|
||||
}
|
||||
|
||||
func downloadFile(path string, url string) (err error) {
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -36,10 +37,6 @@ func newPkg(basename string) *rpc.Pkg {
|
||||
return &rpc.Pkg{Name: basename, PackageBase: basename}
|
||||
}
|
||||
|
||||
func newSplitPkg(basename, name string) *rpc.Pkg {
|
||||
return &rpc.Pkg{Name: name, PackageBase: basename}
|
||||
}
|
||||
|
||||
func getPgpKey(key string) string {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
@ -73,7 +70,7 @@ func TestImportKeys(t *testing.T) {
|
||||
config.GpgFlags = fmt.Sprintf("--homedir %s --keyserver 127.0.0.1", keyringDir)
|
||||
|
||||
server := startPgpKeyServer()
|
||||
defer server.Shutdown(nil)
|
||||
defer server.Shutdown(context.TODO())
|
||||
|
||||
casetests := []struct {
|
||||
keys []string
|
||||
@ -138,7 +135,7 @@ func TestCheckPgpKeys(t *testing.T) {
|
||||
config.GpgFlags = fmt.Sprintf("--homedir %s --keyserver 127.0.0.1", keyringDir)
|
||||
|
||||
server := startPgpKeyServer()
|
||||
defer server.Shutdown(nil)
|
||||
defer server.Shutdown(context.TODO())
|
||||
|
||||
casetests := []struct {
|
||||
pkgs []*rpc.Pkg
|
||||
|
@ -220,7 +220,7 @@ func (parser *arguments) getArg(options ...string) (arg string, double bool, exi
|
||||
existCount := 0
|
||||
|
||||
for _, option := range options {
|
||||
arg, exists = parser.options[option]
|
||||
_, exists = parser.options[option]
|
||||
|
||||
if exists {
|
||||
existCount++
|
||||
@ -619,8 +619,8 @@ func (parser *arguments) parseCommandLine() (err error) {
|
||||
//of course the implementation is up to the caller, this function mearley parses
|
||||
//the input and organizes it
|
||||
func parseNumberMenu(input string) (intRanges, intRanges, stringSet, stringSet) {
|
||||
include := make(intRanges, 0, 0)
|
||||
exclude := make(intRanges, 0, 0)
|
||||
include := make(intRanges, 0)
|
||||
exclude := make(intRanges, 0)
|
||||
otherInclude := make(stringSet)
|
||||
otherExclude := make(stringSet)
|
||||
|
||||
|
@ -19,7 +19,7 @@ func intRangesEqual(a, b intRanges) bool {
|
||||
r1 := a[n]
|
||||
r2 := b[n]
|
||||
|
||||
if r1.min != r1.min || r1.max != r2.max {
|
||||
if r1.min != r2.min || r1.max != r2.max {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
4
print.go
4
print.go
@ -341,6 +341,10 @@ func printUpdateList(parser *arguments) error {
|
||||
old := os.Stdout // keep backup of the real stdout
|
||||
os.Stdout = nil
|
||||
_, _, localNames, remoteNames, err := filterPackages()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
aurUp, repoUp, err := upList(warnings)
|
||||
os.Stdout = old // restoring the real stdout
|
||||
if err != nil {
|
||||
|
2
query.go
2
query.go
@ -353,7 +353,7 @@ func hangingPackages(removeOptional bool) (hanging []string, err error) {
|
||||
|
||||
iterateAgain := true
|
||||
processDependencies := func(pkg alpm.Package) error {
|
||||
if state, _ := safePackages[pkg.Name()]; state == 0 || state == 2 {
|
||||
if state := safePackages[pkg.Name()]; state == 0 || state == 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -193,8 +193,8 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||
}
|
||||
|
||||
func upDevel(remote []alpm.Package) (toUpgrade upSlice, err error) {
|
||||
toUpdate := make([]alpm.Package, 0, 0)
|
||||
toRemove := make([]string, 0, 0)
|
||||
toUpdate := make([]alpm.Package, 0)
|
||||
toRemove := make([]string, 0)
|
||||
|
||||
var mux1 sync.Mutex
|
||||
var mux2 sync.Mutex
|
||||
|
Loading…
Reference in New Issue
Block a user