libopenstorage/stork

Module breaks semver rules and has complicated dependency tree

Opened this issue · 0 comments

Is this a BUG REPORT or FEATURE REQUEST?:

Bug report or maybe both?

What happened:

I have a project that depends on this package. Starting from v2.4.4 you moved from dep to go modules, and I've been having a hard time upgrading to the latest version. Basically, I'm unable to use "go get" to import the latest version of lib as part of my go modules dependencies.

What you expected to happen:

Everything to work as intended with go modules.

How to reproduce it (as minimally and precisely as possible):

Try adding to a new project with go modules enabled:

go get github.com/libopenstorage/stork@v2.8.2
go get: github.com/libopenstorage/stork@v2.8.2: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

According to the Go module reference:

Starting with major version 2, module paths must have a major version suffix like /v2 that matches the major version.

However, even in latest version this module's go.mod does not follow this rule:

module github.com/libopenstorage/stork

It should be:

module github.com/libopenstorage/stork/v2

Anything else we need to know?:

I notice that this module has a direct dependency on k8s.io/kubernetes. This makes it awkward to import this module into other projects as you have to explicitly pin each of the transitive dependencies to their respective versions in the project go.mod ("replace" rules). This is because k8s.io/kubernetes doesn't play well with go modules and semver.

Ideally, it would be great if this module could drop that depency and only depend on k8s.io/client-go, k8s.io/api, k8s.io/apimachinery, etc. which are intended to be used by 3. party libs. There doesn't seem to be a whole lot of functionality from the kubernetes package that is used (mostly stuff from pkg/printers), so perhaps those pieces could be extracted and included in this project instead? I haven't looked in detail, though, so it might not be possible. Just a suggestion.