Hi,
I am using two hooks, https://github.com/rogierlommers/logrus-redis-hook and https://github.com/bshuster-repo/logrus-logstash-hook, one is using upper case while the other one is using lowercase. Therefore I got this annoying error
can't load package: package github.com/sirupsen/logrus/examples/hook: case-insensitive import collision: "github.com/Sirupsen/logrus" and "github.com/sirupsen/logrus"
How can I solve this issue?
As there is a thread mentioned that the change has been reverted, so should I use uppercase or lowercase package name?
I am very confused!
Thanks
Having similar trouble with Glide, I'm using logrus with the Postgres hook, and glide can't load the repo. Here's my vote for leaving it uppercase, so all dependencies don't break.
Also hitting this, we've switched to lowercase, filed issues in upstream packages but it's a bit of a mess if they have dependencies that use logrus as well...
We have to converge to lower-case because reverting would break things for people too. Unfortunately, this is messy either way, caused by the author renaming to lower-case. We have to convert everything to lowercase, as regretful as it is.
So I ended up working around this by levering glide aliasing support. Eg in your glide.yaml do :
- package: github.com/sirupsen/logrus
version: master
- package: github.com/Sirupsen/logrus
repo: [email protected]:/sirupsen/logrus
vcs: git
version: master
the version: master is optional but I wanted to make sure I get https://github.com/sirupsen/logrus/pull/547 in
As a convenience, posting this here for Glide:
Glide has a cache that needs to be busted, so once you update imports to 'sirupsen' do this:
glide install --force
FYI: The glide cache is located at ~/.glide/cache
I understand that renaming the account was incredibly important (clearly, the difference matters), but since you realized the consequences, can you please tag a new release so that we can stop using the latest master (as you advised us not to do it)?
Be sure to clear your glide cache as @rohanthewiz is telling us. Renaming is a b!@#$, but yah .....
Also we had issues with renaming on osx in the previous renaming, if so follow this:
@sdboyer FYI.... when thinking of dep.
@iheitlager clearing the cache does not help this:
https://github.com/sirupsen/logrus/blob/v0.11.5/hooks/test/test.go#L6
well you need to remove the version pinning, i can see master is updated to lower case
https://github.com/sirupsen/logrus/blob/master/hooks/test/test.go
well you need to remove the version pinning
Well, that's a terrible idea. There are reasons why we version software.
don't use version 0.11.5 I would say, that one is not compatible
So which (preferably newer) version should I use than?
I've been fine on this one:
# glide.yaml
- package: github.com/sirupsen/logrus
version: 33a34430d1c3dc71777fdd677864928e5b5812bc
Hopefully we'll get a semantic release soon.
We hit this and were then forced to vendor dependency packages and manually modify them to work with our own packages using logrus. It was easy to make a PR changing glide for one of our deps but maybe that actually would be worse for people already using it.
Once dependencies dependencies start mixing things may grow out of hand. Maybe Golang itself needs an option to ignore capitalization with it's toolchain since this seems like it will affect a lot of people and could easily be remedied.
v1.0.0 has been released, which is the official release that performs the rename.
@sagikazarmark please consider your tone. I understand the frustration, but it doesn't help anything.
I am completely aware this was a mistake, but it's not as simple as "the author renamed because he wanted to cause havoc in the Go community and refuses to revert". Originally, this was attempting to address problems on systems where the upper-case of Logrus was causing issues, the maintainers made the incorrect assumption that most users of Logrus would be vendored and it wouldn't cause major issues鈥攂ut it did. It then turned out that people had been importing in lower-case in various places anyway because it worked with both after the rename. This was realized late in the process, and reverting, either way, would be painful.
@sirupsen sorry for the harsh words, indeed I was quite frustrated about the situation.
Thanks for the release.
As others pointed out, a postmortem blog post might be a good idea, partly to communicate to the world why half of go applications broke down, also to provide a clear picture to Golang maintainers.
So what was the reason for renaming to lower case in the first place? I must be lost...
@mattfarina thanks for the heads-up. we have an issue for the case sensitivity issues (golang/dep#433); i thought it was going to be horrible and nasty, but after a long hashing-out in slack a couple months ago it seems like we might have a pretty tight, contained solution for it.
unfortunately, the person i was talking to didn't have time to follow up, so we haven't got the fix actually implemented yet 馃槩
having a really hard time with this - followed the suggestions posted by @n1koo, @rohanthewiz, and others from https://github.com/sirupsen/logrus/issues/543
I've deleted my ~/.glide/cache, removed entries in glide.yaml/glide.lock, ran glide install --force, glide update, even resorted to glide config-wizard. Also removed sirupsen from my go/src/github.com folder
Each time I run glide install (with or without --force) it exits with
[ERROR] The Remote does not match the VCS endpoint
example output (removed anything not directly related to logrus):
glide install --force
[INFO] Lock file (glide.lock) does not exist. Performing update.
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for github.com/Gurpartap/logrus-stack.
[INFO] --> Fetching updates for github.com/sirupsen/logrus.
[INFO] --> Fetching updates for github.com/gemnasium/logrus-graylog-hook.
[WARN] Replacing github.com/sirupsen/logrus with contents from https://github.com/sirupsen/logrus
[INFO] --> Setting version for github.com/sirupsen/logrus to 33a34430d1c3dc71777fdd677864928e5b5812bc.
[INFO] --> Detected semantic version. Setting version for github.com/gemnasium/logrus-graylog-hook to v2.0.6.
[INFO] Resolving imports
[INFO] --> Fetching updates for github.com/Sirupsen/logrus.
[WARN] Replacing github.com/Sirupsen/logrus with contents from https://github.com/Sirupsen/logrus
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for github.com/rifflock/lfshook.
[INFO] Setting references for remaining imports
[INFO] Exporting resolved dependencies...
[INFO] --> Exporting github.com/Gurpartap/logrus-stack
[INFO] --> Exporting github.com/gemnasium/logrus-graylog-hook
[INFO] --> Exporting github.com/Sirupsen/logrus
[ERROR] The Remote does not match the VCS endpoint
glide.yaml:
package: github.com/XXX/XXX_go
import:
- package: github.com/Gurpartap/logrus-stack
- package: github.com/sirupsen/logrus
version: 33a34430d1c3dc71777fdd677864928e5b5812bc
- package: github.com/gemnasium/logrus-graylog-hook
version: ~2.0.6
github.com/Gurpartap/logrus-stack is still not updated, so file your Pull Request to have this fixed. github.com/gemnasium/logrus-graylog-hook seems to be already upgraded.
(rohanthewiz disguised as a lion). Your best bet until logrus-stack is updated is to fork the logrus-stack repo, make the case change on yours and import from yours.
thanks, forked and updated to fix. took longer than I'd like to admit to discover the issue, I should have run glide tree.
glide list is a good one also (sorry for the glide advice here, but it might help someone).
Here is a generic fix we are using at the time being with glide. It renames all github.com/Sirupsen/logrus to the lowercased version under the vendor folder.
In our code we renamed to sirupsen, and then fixed dependency tree problems by including the following after glide install or glide update
grep -lr "github.com/Sirupsen/logrus" vendor | grep -E '.*\.go' | while read x; do \
gofmt -w -r '"github.com/Sirupsen/logrus" -> "github.com/sirupsen/logrus"' $x; echo $x; done;
I was able to get it working, the issue was that I had multiple dependencies that relied on logrus with capital s and that also used glide. I updated the according glide.yaml files and added
- package: github.com/sirupsen/logrus
version: master
- package: github.com/Sirupsen/logrus
repo: https://github.com/sirupsen/logrus.git
vcs: git
version: master
Please note that I am using the https syntax because I use personal access tokens for authentication instead of ssh keys on my laptop. ~This fix isn't confirmed yet on windows.~ Works on windows too.
Closing this. The package should be used fully lowercased.
I have added the glide solution earlier on the thread but I get the following:
[ERROR] Update failed for github.com/Sirupsen/logrus: Unable to get repository: Cloning into '/home/travis/.glide/cache/src/git-github.com--sirupsen-logrus'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Anyone know the solution?
@rws-github I don't have the whole history. But today the package should be named all lowercase and if an importing package use some uppercase it should be fixed.
This thread helped me fix my problem https://github.com/Masterminds/glide/issues/210
So I ended up working around this by levering
glidealiasing support. Eg in yourglide.yamldo :- package: github.com/sirupsen/logrus version: master - package: github.com/Sirupsen/logrus repo: [email protected]:/sirupsen/logrus vcs: git version: masterthe
version: masteris optional but I wanted to make sure I get #547 in
For anyone who've tried this solution in MacOS: I believe this fix only works for running glide in Linux with case sensitive filesystem. On Mac OS this will only create either sirupsen or Sirupsen in vendor. So if you've built a docker image that can run on Mac OS but the same image will fail running in Linux.
Most helpful comment
So I ended up working around this by levering
glidealiasing support. Eg in yourglide.yamldo :the
version: masteris optional but I wanted to make sure I get https://github.com/sirupsen/logrus/pull/547 in