Uh oh!
There was an error while loading. Please reload this page.
Skip vendor directories for go.mod extraction - #224
Conversation
max-schaefer
commented
Jun 23, 2020
Matching the behaviour of In fact, taking a step back, is there a way we could determine the |
sauyon
commented
Jun 23, 2020
Right, this would be much nicer. I'll implement this. |
This now uses the code from #170 to detect module roots and only extract An ad-hoc dist-compare shows 369 removed results, which seem to be mostly results from inside |
max-schaefer
commented
Jun 29, 2020
OK, then I'll hold off on reviewing this until that PR has landed. |
max-schaefer
commented
Jul 2, 2020
Could you rebase this now that #170 has been merged? |
max-schaefer
commented
Jul 9, 2020
Ping @sauyon, I think this should be a shoo-in once rebased. |
sauyon
commented
Jul 10, 2020
Sorry about that, I've rebased it. |
sauyon
commented
Jul 10, 2020
Somewhat cleaner diff than what GitHub seems to generate: diff --git a/extractor/extractor.go b/extractor/extractor.go
index 4bcbe142..d4465b3c 100644
--- a/extractor/extractor.go+++ b/extractor/extractor.go@@ -161,49 +161,29 @@ func ExtractWithFlags(buildFlags []string, patterns []string) error {
}
extractPackage(pkg, &wg, goroutineSem, fdSem)
++ if pkgRoots[pkg.PkgPath] != "" {+ modPath := filepath.Join(pkgRoots[pkg.PkgPath], "go.mod")+ if util.FileExists(modPath) {+ log.Printf("Extracting %s", modPath)+ start := time.Now()++ err := extractGoMod(modPath)+ if err != nil {+ log.Printf("Failed to extract go.mod: %s", err.Error())+ }++ end := time.Since(start)+ log.Printf("Done extracting %s (%dms)", modPath, end.Nanoseconds()/1000000)+ }+ }+
return
}
})
wg.Wait()
- cwd, err := os.Getwd()- if err != nil {- log.Printf("Warning: unable to get working directory: %s", err.Error())- log.Println("Skipping go.mod extraction")- }- rcwd, err := filepath.EvalSymlinks(cwd)- if err == nil {- cwd = rcwd- }-- goModPaths := make([]string, 0, 10)-- filepath.Walk(cwd, func(path string, info os.FileInfo, err error) error {- if filepath.Base(path) == "go.mod" && info != nil && info.Mode().IsRegular() {- if err != nil {- log.Printf("Found go.mod with path %s, but encountered error %s", path, err.Error())- }-- goModPaths = append(goModPaths, path)- }-- return nil- })-- for _, path := range goModPaths {- log.Printf("Extracting %s", path)- start := time.Now()-- err := extractGoMod(path)- if err != nil {- log.Printf("Failed to extract go.mod: %s", err.Error())- }-- end := time.Since(start)- log.Printf("Done extracting %s (%dms)", path, end.Nanoseconds()/1000000)- }-
return nil
} |
max-schaefer
commented
Jul 10, 2020
Thanks, that diff is indeed much nicer! I would have said LGTM, but the test failures seem to suggest that we now fail to extract many (all?) |
sauyon
commented
Jul 10, 2020
Yep, I just took a look, it's because we didn't have a building Go project around the I'm fixing it now, though it's a bit more annoying than I expected for the |
max-schaefer
commented
Jul 10, 2020
You mean they are free-floating
Thanks! |
sauyon
commented
Jul 10, 2020
So I've run into an issue with this: It seems like local imports don't play very nicely with the build system; they don't seem to work at all when importing those packages, which means having a project that just imports them with some replaces doesn't work. Just building with the Also, because we must vendor dependencies (and even local replacements are vendored), My current plan is to create a mock |
Make implicit dereferences explicit
max-schaefer
commented
Jul 27, 2020
Looking at your comment above again, I must confess that I have lost all context, and am no longer able to make sense of it. I thought the reason we weren't extracting the |
I did as well, but it turns out that Is there a way to force custom build commands? (EDIT: for tests?) |
max-schaefer
commented
Aug 25, 2020
Not at the moment, no. |
0093526 to
598a11cComparesauyon
commented
Sep 29, 2020
I believe tests should finally be working now. I'm currently reworking the |
sauyon
commented
Oct 1, 2020
This should be ready for review now. |
smowton
commented
Oct 1, 2020
Looks good -- what's the evaluation status? Has this changed enough since your distcompare at the top that it ought to be rerun? Is this likely enough to break extraction that we should run an lgtm distribution test? |
smowton
commented
Oct 1, 2020
Also are there user-visible changes worthy of a change-note? |
sauyon
commented
Oct 1, 2020
The only real changes here are test changes (and the rebase), so hopefully nothing should have changed.
I'll add a change note. |
Uh oh!
There was an error while loading. Please reload this page.
bea9009 to
8d7c707CompareCo-authored-by: Chris Smowton <smowton@github.com>
sauyon
commented
Oct 14, 2020
I think this should be ready for review now. |
smowton
commented
Oct 15, 2020
Haven't looked at the test changes in great detail but the extractor change itself looks good. |
Sanity check dist-compare shows no result or performance changes as expected.
Should I also exclude directories starting with
[._]andtestdatalike./...does?