Skip to content

Commit

Permalink
osprepare: don't pass PackageRequirements by reference
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Tim Pepper committed Aug 23, 2016
1 parent 8ab5f6a commit 8d4713b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions osprepare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ 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 {
return nil
}

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) {
Expand All @@ -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 {
Expand All @@ -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)
}

0 comments on commit 8d4713b

Please sign in to comment.