src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 542 forks source link

filesystem.NewStorage and filesystem.NewStorageWithOptions broke compatibility #1262

Open johanbrandhorst opened 4 years ago

johanbrandhorst commented 4 years ago

Specifically, this change https://github.com/src-d/go-git/commit/8f6b3127c1ff7661113fff2662416c328971a285#diff-8dd110426eb72706e38f9798b9a95230R37, which removed the error return from these functions, merged with https://github.com/src-d/go-git/pull/949.

This is a real problem, https://github.com/mitchellh/golicense depends on https://gopkg.in/src-d/go-license-detector.v2 which uses gopkg.in/src-d/go-git.v4 v4.1.0, which is before this breaking change was made. So a user cannot simultaneously use github.com/mitchellh/golicense and gopkg.in/src-d/go-git.v4 latest even though SemVer (and by extension, go modules) promises compatibility.

My recommendation would be to revert the signature to include the error, even though it will always be nil. That way we'll be able to tell users to update to latest and it will remain compatible with previous releases, except for 4.7.1-4.13.1.

johanbrandhorst commented 4 years ago

For others experiencing this issue, for now it's possible to use

replace gopkg.in/src-d/go-git.v4 => gopkg.in/src-d/go-git.v4 v4.7.0

In your go.mod to work around this issue.