hack-pad / hackpadfs

An extensible file system abstraction for Go. File systems, composable interfaces, and test suites.
Apache License 2.0
254 stars 11 forks source link

Potential dependency inconsistency #32

Closed Ben131-Go closed 1 year ago

Ben131-Go commented 1 year ago

Dependency line:

github.com/hack-pad/hackpadfs/examples --> github.com/minio/minio --> github.com/gomodule/redigo
github.com/minio/minio 9ca25bd --> github.com/gomodule/redigo v1.8.5
https://github.com/minio/minio/blob/9ca25bd48f7fec228f246ef5452465be009d4d7a/go.mod#L234

Background

Repo github.com/minio/minio at version 9ca25bd uses replace directive to pin dependency github.com/gomodule/redigo to version v1.8.5.
According to Go Modules wikis, replace directives in modules other than the main module are ignored when building the main module. It means such replace usage in dependency's go.mod cannot be inherited when building main module. And it turns out that github.com/hack-pad/hackpadfs/examples indirectly relies on gomodule/redigo@v2.0.0, which is different from the pinned version minio/minio needed.

https://github.com/hack-pad/hackpadfs/blob/main/examples/go.mod(Line 76)

github.com/gomodule/redigo v2.0.0+incompatible // indirect

https://github.com/minio/minio/blob/9ca25bd48f7fec228f246ef5452465be009d4d7a/go.mod(line 32&234)

github.com/gomodule/redigo v2.0.0+incompatible
replace github.com/gomodule/redigo => github.com/gomodule/redigo v1.8.5

So this is just a reminder in the hope that you can notice such an inconsistency.

Solution

1. Bump the version of dependency github.com/minio/minio

You may try upgrading dependency github.com/minio/minio to a newer version, which may have eliminated the use of this directive.

2. Add the same replace rule to your go.mod

replace github.com/gomodule/redigo => github.com/gomodule/redigo v1.8.5
JohnStarich commented 1 year ago

Hey @Ben131-Go, thanks for opening. We can upgrade the minio dependencies, of course. I've opened a PR to do so here.

Please be aware that the examples aren't intended to be imported or have any sort of back-compatibility guarantees – they only function as working examples. Feel free to contribute an upgrade, too ❤️