Skip to content

Ensure org name in the import path is always NYTimes#76

Merged
fsouza merged 4 commits into
nytimes:masterfrom
fsouza:prep-for-rename
Feb 11, 2019
Merged

Ensure org name in the import path is always NYTimes#76
fsouza merged 4 commits into
nytimes:masterfrom
fsouza:prep-for-rename

Conversation

@fsouza
Copy link
Copy Markdown
Contributor

@fsouza fsouza commented Feb 9, 2019

Fun times are coming.

Copy link
Copy Markdown

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment, but LGTM

Comment thread gzip.go
@@ -1,4 +1,4 @@
package gziphandler
package gziphandler // import "github.com/NYTimes/gziphandler"
Copy link
Copy Markdown

@marwan-at-work marwan-at-work Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this vanity import? Pretty sure I think Go Modules ignores it and the old Go will freak out anyway if a user did lower case "get"

Copy link
Copy Markdown
Contributor Author

@fsouza fsouza Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marwan-at-work because gziphandler doesn't have sub-packages, there's nothing enforcing what case is used in the import path.

Before this change:

% docker run golang go get -v github.com/nytimes/gziphandler
github.com/nytimes/gziphandler (download)
github.com/nytimes/gziphandler
% docker run golang go get -v github.com/NYTimes/gziphandler
github.com/NYTimes/gziphandler (download)
github.com/NYTimes/gziphandler

Using the CASE-fold org, where the canonical import path is declared:

% docker run golang go get -v github.com/CASE-fold/gziphandler
github.com/CASE-fold/gziphandler (download)
package github.com/CASE-fold/gziphandler: code in directory /go/src/github.com/CASE-fold/gziphandler expects import "github.com/case-fold/gziphandler"
% docker run golang go get -v github.com/case-fold/gziphandler
github.com/case-fold/gziphandler (download)
github.com/case-fold/gziphandler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same thing applies to dep)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, the lack of sub packages makes the import path work both ways...maybe that's a good thing 😄

Copy link
Copy Markdown
Contributor Author

@fsouza fsouza Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, because every package in a build have to agree on the import path, so if one of your dependencies wants to use nytimes while others want to use NYTimes, you're busted.

This is what happened to logrus: while it does have sub-packages, the package github.com/sirupsen/logrus doesn't depend on any of the them. The internet crashed once some packages started using sirupsen while others were still using Sirupsen.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good point ^

Copy link
Copy Markdown
Contributor

@jprobinson jprobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌮

@fsouza fsouza merged commit ae3e73a into nytimes:master Feb 11, 2019
@fsouza fsouza deleted the prep-for-rename branch February 11, 2019 20:03
fsouza pushed a commit to nytimes/logrotate that referenced this pull request Feb 12, 2019
Same as nytimes/gziphandler#76.

Also giving the travis.yml file some love.
fsouza pushed a commit to nytimes/logrotate that referenced this pull request Feb 12, 2019
Same as nytimes/gziphandler#76.

Also giving the travis.yml file some love.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants