mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Fix shadowed variables.
This commit is contained in:
+3
-3
@@ -22,9 +22,9 @@ func ListPackagesRefList(reflist *debian.PackageRefList) (err error) {
|
||||
packageCollection := debian.NewPackageCollection(context.database)
|
||||
|
||||
err = reflist.ForEach(func(key []byte) error {
|
||||
p, err := packageCollection.ByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
p, err2 := packageCollection.ByKey(key)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
fmt.Printf(" %s\n", p)
|
||||
return nil
|
||||
|
||||
+6
-6
@@ -94,13 +94,13 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
|
||||
context.progress.InitBar(int64(existingPackageRefs.Len()), false)
|
||||
|
||||
err = existingPackageRefs.ForEach(func(key []byte) error {
|
||||
pkg, err := packageCollection.ByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
pkg, err2 := packageCollection.ByKey(key)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
paths, err := pkg.FilepathList(context.packagePool)
|
||||
if err != nil {
|
||||
return err
|
||||
paths, err2 := pkg.FilepathList(context.packagePool)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
referencedFiles = append(referencedFiles, paths...)
|
||||
context.progress.AddBar(1)
|
||||
|
||||
+8
-8
@@ -45,15 +45,15 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
||||
packageFiles := []string{}
|
||||
|
||||
for _, location := range args[1:] {
|
||||
info, err := os.Stat(location)
|
||||
if err != nil {
|
||||
context.progress.ColoredPrintf("@y[!]@| @!Unable to process %s: %s@|", location, err)
|
||||
info, err2 := os.Stat(location)
|
||||
if err2 != nil {
|
||||
context.progress.ColoredPrintf("@y[!]@| @!Unable to process %s: %s@|", location, err2)
|
||||
continue
|
||||
}
|
||||
if info.IsDir() {
|
||||
err = filepath.Walk(location, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
err2 = filepath.Walk(location, func(path string, info os.FileInfo, err3 error) error {
|
||||
if err3 != nil {
|
||||
return err3
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
@@ -81,7 +81,6 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
||||
for _, file := range packageFiles {
|
||||
var (
|
||||
stanza debian.Stanza
|
||||
err error
|
||||
p *debian.Package
|
||||
)
|
||||
|
||||
@@ -106,7 +105,8 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
checksums, err := utils.ChecksumsForFile(file)
|
||||
var checksums utils.ChecksumInfo
|
||||
checksums, err = utils.ChecksumsForFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+5
-4
@@ -51,23 +51,24 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
|
||||
|
||||
srcRefList = srcRepo.RefList()
|
||||
} else if command == "import" {
|
||||
var srcRemoteRepo *debian.RemoteRepo
|
||||
repoCollection := debian.NewRemoteRepoCollection(context.database)
|
||||
|
||||
srcRepo, err := repoCollection.ByName(args[0])
|
||||
srcRemoteRepo, err = repoCollection.ByName(args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to %s: %s", command, err)
|
||||
}
|
||||
|
||||
err = repoCollection.LoadComplete(srcRepo)
|
||||
err = repoCollection.LoadComplete(srcRemoteRepo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to %s: %s", command, err)
|
||||
}
|
||||
|
||||
if srcRepo.RefList() == nil {
|
||||
if srcRemoteRepo.RefList() == nil {
|
||||
return fmt.Errorf("unable to %s: mirror not updated", command)
|
||||
}
|
||||
|
||||
srcRefList = srcRepo.RefList()
|
||||
srcRefList = srcRemoteRepo.RefList()
|
||||
} else {
|
||||
panic("unexpected command")
|
||||
}
|
||||
|
||||
@@ -15,10 +15,12 @@ func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
|
||||
|
||||
if len(args) == 4 && args[1] == "from" && args[2] == "mirror" {
|
||||
// aptly snapshot create snap from mirror mirror
|
||||
var repo *debian.RemoteRepo
|
||||
|
||||
repoName, snapshotName := args[3], args[0]
|
||||
|
||||
repoCollection := debian.NewRemoteRepoCollection(context.database)
|
||||
repo, err := repoCollection.ByName(repoName)
|
||||
repo, err = repoCollection.ByName(repoName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create snapshot: %s", err)
|
||||
}
|
||||
@@ -34,10 +36,12 @@ func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
|
||||
}
|
||||
} else if len(args) == 4 && args[1] == "from" && args[2] == "repo" {
|
||||
// aptly snapshot create snap from repo repo
|
||||
var repo *debian.LocalRepo
|
||||
|
||||
localRepoName, snapshotName := args[3], args[0]
|
||||
|
||||
localRepoCollection := debian.NewLocalRepoCollection(context.database)
|
||||
repo, err := localRepoCollection.ByName(localRepoName)
|
||||
repo, err = localRepoCollection.ByName(localRepoName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create snapshot: %s", err)
|
||||
}
|
||||
|
||||
@@ -127,7 +127,8 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
|
||||
pL := debian.NewPackageList()
|
||||
pL.Add(pkg)
|
||||
|
||||
missing, err := pL.VerifyDependencies(context.dependencyOptions, []string{arch}, packageList, nil)
|
||||
var missing []debian.Dependency
|
||||
missing, err = pL.VerifyDependencies(context.dependencyOptions, []string{arch}, packageList, nil)
|
||||
if err != nil {
|
||||
context.progress.ColoredPrintf("@y[!]@| @!Error while verifying dependencies for pkg %s: %s@|", pkg, err)
|
||||
}
|
||||
|
||||
@@ -44,8 +44,9 @@ func aptlySnapshotVerify(cmd *commander.Command, args []string) error {
|
||||
fmt.Errorf("unable to merge sources: %s", err)
|
||||
}
|
||||
|
||||
var pL *debian.PackageList
|
||||
for i := 1; i < len(snapshots); i++ {
|
||||
pL, err := debian.NewPackageListFromRefList(snapshots[i].RefList(), packageCollection, context.progress)
|
||||
pL, err = debian.NewPackageListFromRefList(snapshots[i].RefList(), packageCollection, context.progress)
|
||||
if err != nil {
|
||||
fmt.Errorf("unable to load packages: %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user