Skip to content

Commit 43200ea

Browse files
christoph-zededadeitch
authored andcommitted
pkglib: untangle WithBuildDocker and DryRun
this makes it possible for a user of this API to build their own DryRunner also make newDockerRunner public as well to be consistent Signed-off-by: Christoph Ostarek <christoph@zededa.com>
1 parent bb0cf49 commit 43200ea

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/cmd/linuxkit/pkglib/build.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ func (p Pkg) Build(bos ...BuildOpt) error {
319319

320320
d := bo.runner
321321
switch {
322-
case bo.dryRun:
323-
d = newDockerDryRunner()
322+
case d == nil && bo.dryRun:
323+
d = NewDockerDryRunner()
324324
case d == nil:
325-
d = newDockerRunner(p.cache)
325+
d = NewDockerRunner(p.cache)
326326
}
327327

328328
c := bo.cacheProvider

‎src/cmd/linuxkit/pkglib/dockerdryrun.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
type dockerDryRunnerImpl struct {
2626
}
2727

28-
func newDockerDryRunner() DockerRunner {
28+
func NewDockerDryRunner() DockerRunner {
2929
return &dockerDryRunnerImpl{}
3030
}
3131

‎src/cmd/linuxkit/pkglib/dockerimpl.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type dockerRunnerImpl struct {
7171
cache bool
7272
}
7373

74-
func newDockerRunner(cache bool) DockerRunner {
74+
func NewDockerRunner(cache bool) DockerRunner {
7575
return &dockerRunnerImpl{cache: cache}
7676
}
7777

‎src/cmd/linuxkit/pkglib/utils.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func getClientForPlatform(ctx context.Context, buildersMap map[string]string, bu
9898
if err != nil {
9999
return nil, fmt.Errorf("failed to parse platform: %s", err)
100100
}
101-
dr := newDockerRunner(false)
101+
dr := NewDockerRunner(false)
102102
builderName := getBuilderForPlatform(p.Architecture, buildersMap)
103103
client, err := dr.Builder(ctx, builderName, builderImage, builderConfigPath, platform, false)
104104
if err != nil {

0 commit comments

Comments
 (0)