Make aurInfo return a pointer

This commit is contained in:
morganamilo 2018-03-22 18:11:00 +00:00
parent f1fd4a1203
commit 074ea4465a
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
2 changed files with 9 additions and 9 deletions

View file

@ -397,10 +397,7 @@ func depTreeRecursive(dt *depTree, localDb *alpm.Db, syncDb alpm.DbList, isMake
// Cache the results
for _, pkg := range info {
// Copying to p fixes a bug.
// Would rather not copy but cant find another way to fix.
p := pkg
dt.Aur[pkg.Name] = &p
dt.Aur[pkg.Name] = pkg
}

View file

@ -137,7 +137,7 @@ func syncSearch(pkgS []string) (err error) {
// SyncInfo serves as a pacman -Si for repo packages and AUR packages.
func syncInfo(pkgS []string) (err error) {
var info []rpc.Pkg
var info []*rpc.Pkg
aurS, repoS, err := packageSlices(pkgS)
if err != nil {
return
@ -170,7 +170,7 @@ func syncInfo(pkgS []string) (err error) {
if len(aurS) != 0 {
for _, pkg := range info {
PrintInfo(&pkg)
PrintInfo(pkg)
}
}
@ -336,8 +336,8 @@ func statistics() (info struct {
// of packages exceeds the number set in config.RequestSplitN.
// If the number does exceed config.RequestSplitN multiple rpc requests will be
// performed concurrently.
func aurInfo(names []string) ([]rpc.Pkg, error) {
info := make([]rpc.Pkg, 0, len(names))
func aurInfo(names []string) ([]*rpc.Pkg, error) {
info := make([]*rpc.Pkg, 0, len(names))
seen := make(map[string]int)
var mux sync.Mutex
var wg sync.WaitGroup
@ -358,7 +358,10 @@ func aurInfo(names []string) ([]rpc.Pkg, error) {
return
}
mux.Lock()
info = append(info, tempInfo...)
for _, _i := range tempInfo {
i := _i
info = append(info, &i)
}
mux.Unlock()
}