From 8d4713b3e48576519bc13341584d5a43247c9461 Mon Sep 17 00:00:00 2001 From: Tim Pepper Date: Tue, 23 Aug 2016 15:05:56 -0700 Subject: [PATCH] osprepare: don't pass PackageRequirements by reference For this call stack there's no need to pass by reference. Trust in the memory manager and garbage collector ye olde C programmers. Signed-off-by: Tim Pepper --- osprepare/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osprepare/main.go b/osprepare/main.go index 295f940a7..1e970a7aa 100644 --- a/osprepare/main.go +++ b/osprepare/main.go @@ -63,7 +63,7 @@ var BootstrapRequirements = PackageRequirements{ // CollectPackages returns a list of non-installed packages from // the PackageRequirements received -func collectPackages(dist distro, reqs *PackageRequirements) []string { +func collectPackages(dist distro, reqs PackageRequirements) []string { // For now just support keys like "ubuntu" vs "ubuntu:16.04" var pkgsMissing []string if reqs == nil { @@ -71,7 +71,7 @@ func collectPackages(dist distro, reqs *PackageRequirements) []string { } id := dist.getID() - if pkgs, success := (*reqs)[id]; success { + if pkgs, success := reqs[id]; success { for _, pkg := range pkgs { // Have the path existing, skip. if pathExists(pkg.BinaryName) { @@ -85,9 +85,9 @@ func collectPackages(dist distro, reqs *PackageRequirements) []string { return nil } -// PrepareOsDeps installs all the dependencies defined in -// PackageRequirements in order to run the ciao component -func PrepareOsDeps(reqs *PackageRequirements) { +// PrepareOsDeps installs all the dependencies defined in a component +// specific PackageRequirements in order to enable running the component +func PrepareOsDeps(reqs PackageRequirements) { distro := getDistro() if distro == nil { @@ -113,5 +113,5 @@ func PrepareOsDeps(reqs *PackageRequirements) { // Bootstrap installs all the core dependencies required to bootstrap the core // configuration of all Ciao components func Bootstrap() { - PrepareOsDeps(&BootstrapRequirements) + PrepareOsDeps(BootstrapRequirements) }