Dealing with case-only variations in import paths

98 views
Skip to first unread message

Sam Boyer

unread,
Sep 10, 2017, 11:49:04 PM9/10/17
to Go Package Management
hi folks -

i've had this PR open for a little while now, and while it's been brought up for discussion in a couple places, i want to run it by here, too: https://github.com/golang/dep/pull/1079

this is an attempt to address what is currently a rather nasty problem with case-only variations in imports. such variations are already disallowed by the compiler (https://github.com/golang/go/blob/a4e1a72f0a40acf84f4b7bd982f3d9cffdf01cfd/src/cmd/go/internal/load/pkg.go#L1147-L1157) - if you have two import paths in a single build that vary only by case, the compiler will complain and die. we see this pretty regularly with github.com/Sirupsen/logrus and github.com/sirupsen/logrus.

dep currently handles this situation much less gracefully, by not handling it at all - case-variant imports will result in nasty, opaque git checkout errors on case-insensitive filesystems, and silently give you a build that won't compile on case-sensitive filesystems. the PR changes the way dep operates to be, more or less, case-preserving and case-insensitive in its treatment of import paths.

all of this feels dangerous and fraught to me. these changes basically amount to just deciding that hosting platforms don't allow case-only variations the repositories/projects they host - and that that's how all Go code works. certainly it'd be a bad idea for hosting platforms to allow such a thing, but codifying the assumption is a much stronger step.

feedback very welcome.

s

Henrik Johansson

unread,
Sep 11, 2017, 1:32:21 AM9/11/17
to Sam Boyer, Go Package Management
Doing it the way the compiler does it seems to be the _only_ sensible thing to do.

--
You received this message because you are subscribed to the Google Groups "Go Package Management" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-package-manag...@googlegroups.com.
To post to this group, send email to go-package...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam Boyer

unread,
Sep 11, 2017, 7:38:01 AM9/11/17
to Henrik Johansson, Go Package Management
this is a complex issue, there is no single clear antecedent for your "it" be that I can see. to the extent there is - the compiler already enforces a check in this area. the question is how we complement this behavior.

To unsubscribe from this group and stop receiving emails from it, send an email to go-package-management+unsub...@googlegroups.com.

To post to this group, send email to go-package-management@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Go Package Management" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-package-management/r-ozQozv7KQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-package-management+unsub...@googlegroups.com.
To post to this group, send email to go-package-management@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages