Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit f2b038d

Browse files
committed
docker: Only generate sources list w/ config
Some cases we may not even have a config to load, so there is no reason to generate the sources list since there will be nothing to replace.
1 parent 0468334 commit f2b038d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docker.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ func invokeDocker(ctx context.Context) error {
339339
}
340340

341341
var result Result
342-
if modPath != "" {
342+
switch {
343+
case modPath != "":
344+
debug("Reading source replacements from", modPath)
343345
data, err := os.ReadFile(modPath)
344346
if err != nil {
345347
return fmt.Errorf("error reading specified modfile path: %w", err)
@@ -348,7 +350,8 @@ func invokeDocker(ctx context.Context) error {
348350
if err := json.Unmarshal(data, &result); err != nil {
349351
return fmt.Errorf("error parsing specified modfile: %w", err)
350352
}
351-
} else {
353+
case modConfig != "":
354+
debug("Generating source replacements from config", modConfig, "using prog", modProg)
352355
dt, err := getDockerfile(dArgs.Context, dArgs.DockerfileName)
353356
if err != nil {
354357
return err
@@ -358,6 +361,8 @@ func invokeDocker(ctx context.Context) error {
358361
if err != nil {
359362
return err
360363
}
364+
default:
365+
debug("no modfile or modconfig, skipping source analysis")
361366
}
362367

363368
for _, o := range dArgs.Output {

0 commit comments

Comments
 (0)