nokia / CPU-Pooler

A Device Plugin for Kubernetes, which exposes the CPU cores as consumable Devices to the Kubernetes scheduler.
BSD 3-Clause "New" or "Revised" License
93 stars 22 forks source link

Potential import collision: import path should be "gopkg.in/yaml.v2", not "github.com/go-yaml/yaml". #50

Closed KateGo520 closed 4 years ago

KateGo520 commented 4 years ago

Background

The go-yaml/yaml has already renamed it’s import path from "github.com/go-yaml/yaml" to "gopkg.in/yaml.v2". As README of go-yaml/yaml v2.1.0 said, downstream repos should use "gopkg.in/yaml.v2" to get or import go-yaml/yaml.

Example
Some more examples can be found in the "examples" folder.

package main
import (
        "fmt"
        "log"
        "gopkg.in/yaml.v2"
)
…

But nokia/CPU-Pooler still used the old path: https://github.com/nokia/CPU-Pooler/blob/master/go.mod#L7

github.com/go-yaml/yaml v2.1.0+incompatible 

When you use the old path "github.com/go-yaml/yaml" to import the go-yaml/yaml, it will be very easy to reintroduce go-yaml/yaml through the import statements "import gopkg.in/yaml.v2" in the go source file of go-yaml/yaml. https://github.com/go-yaml/yaml/blob/v2.1.0/decode_test.go#L12

package yaml_test
import (
    …
    . "gopkg.in/check.v1"
    "gopkg.in/yaml.v2"
)

The "gopkg.in/yaml.v2" and "github.com/go-yaml/yaml" are the same repos. This will work in isolation, bring about potential risks and problems. So, why not get rid of the old import path "github.com/go-yaml/yaml", use "gopkg.in/yaml.v2" instead.

Solution

Replace all the old import paths, change "github.com/go-yaml/yaml" to "gopkg.in/yaml.v2". Where did you import it: https://github.com/nokia/CPU-Pooler/search?q=github.com%2Fgo-yaml%2Fyaml&unscoped_q=github.com%2Fgo-yaml%2Fyaml

KateGo520 commented 4 years ago

@balintTobik @eMGabriel Could you help me review this issue? Thx :p

eMGabriel commented 4 years ago

@KateGo520 Sorry for the slow response. Thank you for highlighting the deprecated import. It will be fixed in PR #52

KateGo520 commented 4 years ago

@eMGabriel Thanks for your efforts and feedback.