elyby / chrly

Lightweight implementation of Minecraft skins system server. It's packaged and distributed as a Docker image.
Apache License 2.0
35 stars 4 forks source link

Potential import collision: import path should be "gopkg.in/h2non/gock.v1", not "github.com/h2non/gock". #27

Closed KateGo520 closed 4 years ago

KateGo520 commented 4 years ago

Background

The h2non/gock has already renamed it’s import path from "github.com/h2non/gock" to "gopkg.in/h2non/gock.v1". As README of h2non/gock v1.0.14 said, downstream repos should use "gopkg.in/h2non/gock.v1" to get or import h2non/gock.

Installation
> go get -u gopkg.in/h2non/gock.v1

Examples
See examples directory for more featured use cases.
Simple mocking via tests
package test
import (
  "github.com/nbio/st"
  "gopkg.in/h2non/gock.v1"
  "io/ioutil"
  "net/http"
  "testing"
)
…

But elyby/chrly still used the old path: https://github.com/elyby/chrly/blob/master/Gopkg.lock#L92

[[projects]]
  digest = "1:5eeb4bfc6db411dbb34a6d9e5d49a9956b160d59fd004ee8f03fe53c9605c082"
  name = "github.com/h2non/gock"
  packages = ["."]
  pruneopts = ""
  revision = "ba88c4862a27596539531ce469478a91bc5a0511"
  version = "v1.0.14"

When you use the old path "github.com/h2non/gock" to import the h2non/gock, it will be very easy to reintroduce h2non/gock through the import statements "import gopkg.in/h2non/gock.v1" in the go source file of h2non/gock. https://github.com/h2non/gock/blob/v1.0.14/_examples/custom_matcher/matcher.go#L5

package main
import (
    "fmt"
    "gopkg.in/h2non/gock.v1"
    "net/http"
)
…

The "gopkg.in/h2non/gock.v1" and "github.com/h2non/gock" 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/h2non/gock" to "gopkg.in/h2non/gock.v1". Where did you import it: https://github.com/elyby/chrly/search?q=github.com%2Fh2non%2Fgock&unscoped_q=github.com%2Fh2non%2Fgock

KateGo520 commented 4 years ago

@erickskrauch @KolFoxy Could you help me review this issue? Thx :p

erickskrauch commented 4 years ago

@KateGo520, thanks for the raising of the issue and sorry for the long response. I applied the necessary changes.