diff --git a/modules/mesh-build-go/cmd/mesh-build-go/fetch.go b/modules/mesh-build-go/cmd/mesh-build-go/fetch.go index 046e9a9b3..cd61cc20a 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/fetch.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/fetch.go @@ -22,8 +22,6 @@ import ( "golang.org/x/mod/modfile" - stdio "git.novox.be/novox/mesh-sdk/go" - sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" dforgekey "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/forgekey" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" @@ -110,11 +108,8 @@ func (m *Module) fetch(ctx context.Context, args map[string]any) (res any, err e if err != nil { return nil, err } - // A build is for one module, never a repository (design 47 G, A-447b): a fetch names its module's directory. - if cleanDir(req.Dir) == "" { - return nil, fmt.Errorf("the fetch of %s at %s names no module directory (dir): a fetch is for one module, never a whole repository; asked by %s", - req.Repository, req.Commit, askerOf(args)) - } + // A fetch with no dir (the checker's check of a pull request, until G removes the checker; A-447e) fetches the tree + // whole: every go.mod of it. siblings, err := siblingsArg(args["beside"]) if err != nil { return nil, err @@ -717,11 +712,3 @@ func scopedDirs(tree, dir string, all []string) ([]string, error) { } return out, nil } - -// askerOf names who asked a tool: the caller the bus proved, else "an unnamed asker". -func askerOf(args map[string]any) string { - if c := stdio.CallerOf(args); c != "" { - return c - } - return "an unnamed asker" -} diff --git a/modules/mesh-build-go/cmd/mesh-build-go/gomoddirs_test.go b/modules/mesh-build-go/cmd/mesh-build-go/gomoddirs_test.go index 1001dbb0a..f08f77218 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/gomoddirs_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/gomoddirs_test.go @@ -95,22 +95,16 @@ func TestAFetchAskedWithADirectoryChoosesItsModuleAndWhatItReplacesAlone(t *test } } -// A-447b: a build is for one module, never a repository: a fetch with no module directory is refused, naming its asker -// and the repository, and nothing is fetched. -func TestAFetchWithNoDirectoryIsRefusedNamingItsAsker(t *testing.T) { - f := &fakeStep{gomods: "go.mod\n"} +// A-447e: a fetch with no dir (the checker's check of a pull request, until G removes the checker) fetches the tree whole: +// it chooses every go.mod of it. +func TestAFetchWithNoDirectoryChoosesEveryGoModOfTheTree(t *testing.T) { + f := &fakeStep{gomods: "go.mod\nsub/go.mod\n"} m, states := fetchModule(t, f) if _, err := rawFetchTool(t, m)(map[string]any{"repository": "novox/mesh-sdk", "commit": commitSHA}); err != nil { t.Fatal(err) } st := states.waitEnd(t) - if st.State != sdkstep.StepFailed || !strings.Contains(st.Reason, "novox/mesh-sdk") || !strings.Contains(st.Reason, "names no module directory") || - !strings.Contains(st.Reason, "asked by") { - t.Fatalf("a fetch with no dir ended %s: %q", st.State, st.Reason) - } - for _, l := range f.lines() { - if strings.HasPrefix(l, "git ") { - t.Errorf("a refused fetch ran %s", l) - } + if st.State != sdkstep.StepPassed || !strings.Contains(string(st.Result), `"modules":[".","sub"]`) { + t.Fatalf("a fetch with no dir ended %s: %q %s", st.State, st.Reason, st.Result) } }