-
Notifications
You must be signed in to change notification settings - Fork 24
Extract PackageTree and stuff into subpackage #189
Conversation
analysis.go
Outdated
@@ -30,943 +20,3 @@ func init() { | |||
archListString := "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64" | |||
archList = strings.Split(archListString, " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found any references to these variables. Could you provide some details, why they are here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah. I thought I was going to get to this earlier, but I still haven't.
Basically, they're supposed to be for this: golang/dep#291
woohoo more contributors! welcome! 👏 👏 🎉 I think the best route with the
Let's lump it in with the |
pkgtree/pkgtree.go
Outdated
) | ||
|
||
// Stored as a var so that tests can swap it out. Ugh globals, ugh. | ||
var IsStdLib = doIsStdLib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those things I'd really strongly prefer not to export, but we have the call to it in the solver.
If we can't think of any clever solutions, then I'd prefer we duplicate the function in both packages than have it exposed. The only solution I can think of is adding a stdlib filtering param to ToReachMap()
...but that doesn't take care of the calls in rootdata.go
.
17dd765
to
00ee443
Compare
00ee443
to
f3a4a56
Compare
Codecov Report
@@ Coverage Diff @@
## master #189 +/- ##
==========================================
- Coverage 78.03% 77.41% -0.63%
==========================================
Files 25 27 +2
Lines 3989 3989
==========================================
- Hits 3113 3088 -25
- Misses 658 683 +25
Partials 218 218
Continue to review full report at Codecov.
|
solve_test.go
Outdated
@@ -47,6 +49,8 @@ func overrideIsStdLib() { | |||
isStdLib = func(path string) bool { | |||
return false | |||
} | |||
// NOTE(narqo): this is an ugly hack! One have to think about better way to do cross-package mocking. | |||
pkgtree.MockIsStdLib() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this, but currently, I don't see another way to make fixtures work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yknow...I think maybe we could just expose var IsStdlib
on the subpackage, then have tests overwrite it in much the way they do now. As long as there's a doc on it indicating its intended use, and that overwriting it except for test purposes will cause undefined behavior, then I'm not too bothered.
(btw, i'd prefer that you just push up commits as you go, rather than amending/squashing and force pushing. i realize i might be weird in this regard, but it's easier for me to keep track of a running diff) |
No problem. Will try to do some meaningful commits in future, not some random lazy "wip!"s. :) I think I'm done with #166 for now and waiting for your review. |
OK, great. Might take me a couple days, but I'll definitely try to get this to happen before moving gps into dep (golang/dep#300). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took me so long to get to a review - in general, this looks great! There are a few changes I've noted with inline the comments.
The bigger thing, though, is that the circle.yaml
needs to be updated so that the subpackages are also tested. Ideally, that would also include the coverage information...but that takes a little doing, because you have to stitch together output from individual tests to make it work.
I'd love it if you could take care of that part, too, but if not, I can work it out 😄
solve_test.go
Outdated
@@ -47,6 +49,8 @@ func overrideIsStdLib() { | |||
isStdLib = func(path string) bool { | |||
return false | |||
} | |||
// NOTE(narqo): this is an ugly hack! One have to think about better way to do cross-package mocking. | |||
pkgtree.MockIsStdLib() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yknow...I think maybe we could just expose var IsStdlib
on the subpackage, then have tests overwrite it in much the way they do now. As long as there's a doc on it indicating its intended use, and that overwriting it except for test purposes will cause undefined behavior, then I'm not too bothered.
solve_bimodal_test.go
Outdated
if len(em) > 0 { | ||
panic(fmt.Sprintf("pkgs with errors in reachmap processing: %s", em)) | ||
} | ||
fmt.Printf("reachmap: %+v\n", reachmap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over from debugging?
analysis.go
Outdated
@@ -1,17 +1,7 @@ | |||
package gps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just get rid of this file entirely - move it into solver.go.
fs/fs.go
Outdated
@@ -1,7 +1,7 @@ | |||
package gps | |||
package fs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather make this internal/fs
, at least for now - these funcs aren't really intended to be a part of the public surface area.
Ready for next iteration. |
(sorry for delay - very very busy week, changing jobs et. all) Looks like the change you made to the coverage counter ended up just reporting the coverage from the pkgtree subdir :( Get that fixed, and we can merge! Also, I decided on a much more pleasant way to deal with the |
e1e4428
to
ad41126
Compare
This is weird, AppVeyor's tests are failing with "nil pointer dereference" from |
That seems like it's an ephemeral error. (Which is itself not reassuring, but...) |
Let's remove that latest revert (9e5eeb6), we do want those errors renamed. With any luck, tests will pass on re-run. |
After spending some time digging through go's standard library internals, it seems that naming error types as |
indeed! i'm glad that's the standard, i rather like that better :D
OK, i think i should be able to merge this tonight, then. just finishing
up a couple things elsewhere, first.
…On 3/28/17 20:17, Vladimir Varankin wrote:
Let's remove that latest revert (9e5eeb6
<9e5eeb6>),
we do want those errors renamed
After spending some time digging through go's standard library
internals, it seems that naming error types as |SomethingError| is
actually a common practice. See
https://talks.golang.org/2014/names.slide#15 If you don't mind, I'd like
to consider that my initial renaming in the fist commit of the PR, was a
mistake.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#189 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AABUX6kxNmPzBF4TxPUnsi-BCa_j3_0hks5rqaM3gaJpZM4MZ-Hk>.
|
OK, pulling this in. Thanks for all your work and patience on this! |
Extract PackageTree and stuff into subpackage
I've started working on #166 to get some overview of the project's internals. While the process hasn't finished yet, I feel it might be a good time to get some early feedback.
Tests for
solve_bimodal_test.go
are failing as they rely on privateworkmap
of pkgtree. I feel we could refactor this piece, but I'm not sure what is the best way to do it. Definitely, need to dive more deeply into the project's code base.P. S. It looks like
fs
package might be a candidate for havingfastWalk
function from #180, doesn't it?