go-git icon indicating copy to clipboard operation
go-git copied to clipboard

filesystem.NewStorage and filesystem.NewStorageWithOptions broke compatibility

Open johanbrandhorst opened this issue 5 years ago • 1 comments

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 avatar Dec 17 '19 11:12 johanbrandhorst

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.

johanbrandhorst avatar Dec 17 '19 11:12 johanbrandhorst