Skip to content

Commit 06c121d

Browse files
authored
fix: do not preallocate strings in package install (#409)
Preallocating the strings will override the container's own built in configurations for these if they're not explicitly set in the package. This broke the `cardano-node` package's use of arguments to the entrypoint script. Signed-off-by: Chris Gianelloni <[email protected]>
1 parent e6c4c40 commit 06c121d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkgmgr/package.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,23 +731,26 @@ func (p *PackageInstallStepDocker) install(cfg Config, pkgName string) error {
731731
}
732732
tmpEnv[k] = tmplVal
733733
}
734-
tmpCommand := []string{}
734+
//nolint:prealloc
735+
var tmpCommand []string
735736
for _, cmd := range p.Command {
736737
tmpCmd, err := cfg.Template.Render(cmd, extraVars)
737738
if err != nil {
738739
return err
739740
}
740741
tmpCommand = append(tmpCommand, tmpCmd)
741742
}
742-
tmpArgs := []string{}
743+
//nolint:prealloc
744+
var tmpArgs []string
743745
for _, arg := range p.Args {
744746
tmpArg, err := cfg.Template.Render(arg, extraVars)
745747
if err != nil {
746748
return err
747749
}
748750
tmpArgs = append(tmpArgs, tmpArg)
749751
}
750-
tmpBinds := []string{}
752+
//nolint:prealloc
753+
var tmpBinds []string
751754
for _, bind := range p.Binds {
752755
tmpBind, err := cfg.Template.Render(bind, extraVars)
753756
if err != nil {
@@ -769,7 +772,8 @@ func (p *PackageInstallStepDocker) install(cfg Config, pkgName string) error {
769772
)
770773
}
771774
}
772-
tmpPorts := []string{}
775+
//nolint:prealloc
776+
var tmpPorts []string
773777
for _, port := range p.Ports {
774778
tmpPort, err := cfg.Template.Render(port, extraVars)
775779
if err != nil {

0 commit comments

Comments
 (0)