From 88e40417af752ca9bf42c84c54bfc7d88a7410ad Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Thu, 27 Jul 2023 17:53:53 +0300 Subject: [PATCH] fix --workdir Signed-off-by: Avi Deitcher --- internal/cli/build.go | 4 ++++ internal/cli/commands.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/cli/build.go b/internal/cli/build.go index 93187a748..f235362f4 100644 --- a/internal/cli/build.go +++ b/internal/cli/build.go @@ -263,7 +263,11 @@ func buildImageComponents(ctx context.Context, wd string, archs []types.Architec if err != nil { return fmt.Errorf("failed to get installed packages for %q: %w", arch, err) } + // this should be unnecessary, as the arch list already is unique, + // but the race detector complains, so we can use it anyways + mtx.Lock() pkgs[arch] = installed + mtx.Unlock() // Compute the "build date epoch" from the packages that were // installed. The "build date epoch" is the MAX of the builddate // embedded in the installed APKs. If SOURCE_DATE_EPOCH is diff --git a/internal/cli/commands.go b/internal/cli/commands.go index 5882b967b..71e59f1a1 100644 --- a/internal/cli/commands.go +++ b/internal/cli/commands.go @@ -36,9 +36,9 @@ func New() *cobra.Command { SilenceUsage: true, PersistentPreRun: func(cmd *cobra.Command, args []string) { http.DefaultTransport = userAgentTransport{http.DefaultTransport} - if cwd != "" { - if err := os.Chdir(cwd); err != nil { - fmt.Printf("failed to change dir to %s: %v\n", cwd, err) + if workDir != "" { + if err := os.Chdir(workDir); err != nil { + fmt.Printf("failed to change dir to %s: %v\n", workDir, err) } } },