Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com>
  • Loading branch information
embano1 committed Jan 19, 2023
1 parent c512f73 commit aa0e185
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 182 deletions.
5 changes: 1 addition & 4 deletions pkg/build/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ func (c *layerCache) readBuildToDiff(file string) (buildIDToDiffID, error) {
}

func getBuildID(ctx context.Context, file string) (string, error) {
gobin := defaultGoBin
if env := os.Getenv(goBinPathEnv); env != "" {
gobin = env
}
gobin := getGoBinary()

cmd := exec.CommandContext(ctx, gobin, "tool", "buildid", file)
var output bytes.Buffer
Expand Down
17 changes: 9 additions & 8 deletions pkg/build/gobuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ func getGoarm(platform v1.Platform) (string, error) {
return "", nil
}

func getGoBinary() string {
if env := os.Getenv(goBinPathEnv); env != "" {
return env
}
return defaultGoBin
}

func build(ctx context.Context, ip string, dir string, platform v1.Platform, config Config) (string, error) {
buildArgs, err := createBuildArgs(config)
if err != nil {
Expand Down Expand Up @@ -289,10 +296,7 @@ func build(ctx context.Context, ip string, dir string, platform v1.Platform, con
args = append(args, "-o", file)
args = append(args, ip)

gobin := defaultGoBin
if bin := os.Getenv(goBinPathEnv); bin != "" {
gobin = bin
}
gobin := getGoBinary()
cmd := exec.CommandContext(ctx, gobin, args...)
cmd.Dir = dir
cmd.Env = env
Expand All @@ -313,10 +317,7 @@ func build(ctx context.Context, ip string, dir string, platform v1.Platform, con
}

func goversionm(ctx context.Context, file string, appPath string, appFileName string, se oci.SignedEntity, dir string) ([]byte, types.MediaType, error) {
gobin := defaultGoBin
if env := os.Getenv(goBinPathEnv); env != "" {
gobin = env
}
gobin := getGoBinary()

switch se.(type) {
case oci.SignedImage:
Expand Down
170 changes: 0 additions & 170 deletions pkg/commands/deps.go

This file was deleted.

0 comments on commit aa0e185

Please sign in to comment.