filecoin-project / sentinel-drone

An analytics capture agent for lotus daemon which is forked from Telegraf (https://github.com/influxdata/telegraf) to support custom input/output plugins.
MIT License
6 stars 4 forks source link

Potential import collision: import path should be "k8s.io/apimachinery", not "github.com/kubernetes/apimachinery" #17

Open KateGo520 opened 4 years ago

KateGo520 commented 4 years ago

Background

I find that k8s.io/apimachinery and github.com/kubernetes/apimachinery coexist in this repo: https://github.com/filecoin-shipyard/telegraf-lotus/blob/master/go.mod (Line 81 & 139)

github.com/kubernetes/apimachinery v0.0.0-20190119020841-d41becfba9ee 
k8s.io/apimachinery v0.17.1 // indirect 

That’s because the apimachinery has already renamed it’s import path from "github.com/kubernetes/apimachinery" to "k8s.io/apimachinery",in this version. When you use the old path "github.com/kubernetes/apimachinery" to import the apimachinery, will reintroduces apimachinery through the import statements "import k8s.io/apimachinery" in the go source file of apimachinery.

https://github.com/kubernetes/apimachinery/blob/d41becfba9ee9bf8e55cec1dd3934cd7cfc04b99/pkg/api/resource/quantity_example_test.go

package resource_test
import (
    "fmt"
    "k8s.io/apimachinery/pkg/api/resource"
)

"k8s.io/apimachinery" and "github.com/kubernetes/apimachinery" are the same repos. This will work in isolation, bring about potential risks and problems.

Solution

Replace all the old import paths, change "github.com/kubernetes/apimachinery" to "k8s.io/apimachinery".

Where did you import it: https://github.com/filecoin-shipyard/telegraf-lotus/search?q=kubernetes%2Fapimachinery&unscoped_q=kubernetes%2Fapimachinery

KateGo520 commented 4 years ago

@danielnelson @ssoroka Could you help me review this issue? Thx :p