-
Notifications
You must be signed in to change notification settings - Fork 1k
Allow dot-prefixed packages as valid import paths #572
Conversation
// | ||
// Note that there are some pathological edge cases this doesn't cover, | ||
// such as a user using Git for version control, but having a package | ||
// named "svn" in a directory named ".svn". |
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.
Not sure if we want to try and address this -- should we only skip these dirs if we're at the root of the project? Will that cause problems for submodules?
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 we're OK ignoring it for now, though I appreciate you pointing it out. It's a very, very edge case, and trying to deal with it here would do some level-busting: a fix would equate "root of repo" with "root of project". That's something that's true 99% of the time, but isn't actually entailed by the design of the system - at least, not this far down.
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.
Just a naming nit, otherwise LGTM
internal/gps/pkgtree/pkgtree.go
Outdated
@@ -28,6 +28,15 @@ type Package struct { | |||
TestImports []string // Imports from all go test files (in go/build parlance: both TestImports and XTestImports) | |||
} | |||
|
|||
// svnRoots is a set of directories we should not descend into in ListPackages when | |||
// searching for Go packages | |||
var svnRoots = map[string]struct{}{ |
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.
vcsRoots
instead of svnRoots
, no?
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.
lol not sure where i get svnRoots
from, good catch
@@ -1304,6 +1292,18 @@ func TestListPackages(t *testing.T) { | |||
Imports: []string{"sort"}, | |||
}, | |||
}, | |||
"dotgodir/.m1p": { |
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'm glad you caught these to move them, I entirely forgot they were there 😄
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.
NP :)
These are no longer "disallowed", so having them in that case block is misleading.
Hygiene question: I did a rebase rather than a merge of master before pushing my branch. Is there guidance on this project around squashing/rebasing/merging? |
LGTM. In we go 😄
We haven't really established any formally. Informally, here's what I operate by:
|
Cool. I'll probably start self-squashing a la gerrit / phab / other tools I'm used to to keep lineage clean, and continue rebasing. Thanks! |
Fixes #564