Skip to content

Commit 7a503ae

Browse files
Rename variable, remove superfluous check
Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent 236d00b commit 7a503ae

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

client/llb/fileop.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type CopyInput interface {
5656
}
5757

5858
type subAction interface {
59-
toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platform string) (pb.IsFileAction, error)
59+
toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platformOS string) (pb.IsFileAction, error)
6060
}
6161

6262
type capAdder interface {
@@ -162,8 +162,8 @@ type fileActionMkdir struct {
162162
info MkdirInfo
163163
}
164164

165-
func (a *fileActionMkdir) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platform string) (pb.IsFileAction, error) {
166-
normalizedPath, err := system.NormalizePath(parent, a.file, platform, false)
165+
func (a *fileActionMkdir) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platformOS string) (pb.IsFileAction, error) {
166+
normalizedPath, err := system.NormalizePath(parent, a.file, platformOS, false)
167167
if err != nil {
168168
return nil, errors.Wrap(err, "normalizing path")
169169
}
@@ -340,8 +340,8 @@ type fileActionMkfile struct {
340340
info MkfileInfo
341341
}
342342

343-
func (a *fileActionMkfile) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platform string) (pb.IsFileAction, error) {
344-
normalizedPath, err := system.NormalizePath(parent, a.file, platform, false)
343+
func (a *fileActionMkfile) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platformOS string) (pb.IsFileAction, error) {
344+
normalizedPath, err := system.NormalizePath(parent, a.file, platformOS, false)
345345
if err != nil {
346346
return nil, errors.Wrap(err, "normalizing path")
347347
}
@@ -412,8 +412,8 @@ type fileActionRm struct {
412412
info RmInfo
413413
}
414414

415-
func (a *fileActionRm) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platform string) (pb.IsFileAction, error) {
416-
normalizedPath, err := system.NormalizePath(parent, a.file, platform, false)
415+
func (a *fileActionRm) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platformOS string) (pb.IsFileAction, error) {
416+
normalizedPath, err := system.NormalizePath(parent, a.file, platformOS, false)
417417
if err != nil {
418418
return nil, errors.Wrap(err, "normalizing path")
419419
}
@@ -506,12 +506,12 @@ type fileActionCopy struct {
506506
info CopyInfo
507507
}
508508

509-
func (a *fileActionCopy) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platform string) (pb.IsFileAction, error) {
510-
src, err := a.sourcePath(ctx, platform)
509+
func (a *fileActionCopy) toProtoAction(ctx context.Context, parent string, base pb.InputIndex, platformOS string) (pb.IsFileAction, error) {
510+
src, err := a.sourcePath(ctx, platformOS)
511511
if err != nil {
512512
return nil, err
513513
}
514-
normalizedPath, err := system.NormalizePath(parent, a.dest, platform, false)
514+
normalizedPath, err := system.NormalizePath(parent, a.dest, platformOS, false)
515515
if err != nil {
516516
return nil, errors.Wrap(err, "normalizing path")
517517
}
@@ -773,11 +773,11 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
773773
}
774774

775775
// Assume that we're building an image for the same OS we're running on.
776-
platform := runtime.GOOS
776+
platformOS := runtime.GOOS
777777
if f.constraints.Platform != nil {
778-
platform = f.constraints.Platform.OS
778+
platformOS = f.constraints.Platform.OS
779779
}
780-
action, err := st.action.toProtoAction(ctx, parent, st.base, platform)
780+
action, err := st.action.toProtoAction(ctx, parent, st.base, platformOS)
781781
if err != nil {
782782
return "", nil, nil, nil, err
783783
}

frontend/dockerfile/dockerfile2llb/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ func dispatchRun(d *dispatchState, c *instructions.RunCommand, proxy *llb.ProxyE
996996

997997
func dispatchWorkdir(d *dispatchState, c *instructions.WorkdirCommand, commit bool, opt *dispatchOpt) error {
998998
platformOS := runtime.GOOS
999-
if d != nil && d.platform != nil {
999+
if d.platform != nil {
10001000
platformOS = d.platform.OS
10011001
}
10021002
wd, err := system.NormalizeWorkdir(d.image.Config.WorkingDir, c.Path, platformOS)

0 commit comments

Comments
 (0)