examples icon indicating copy to clipboard operation
examples copied to clipboard

Potential import collision: import path should be "go.etcd.io/bbolt", not "github.com/etcd-io/bbolt"

Open KateGo520 opened this issue 3 years ago • 4 comments

Background

The etcd-io/bbolt has already renamed it’s import path from "github.com/etcd-io/bbolt" to "go.etcd.io/bbolt". As etcd-io/bbolt README.md said, downstream repos should use "go.etcd.io/bbolt" to get or import etcd-io/bbolt.

But iris-contrib/examples still used the old path: https://github.com/iris-contrib/examples/blob/v12/tutorial/url-shortener/go.mod#L6

github.com/etcd-io/bbolt v1.3.3 

When you use the old path "github.com/etcd-io/bbolt" to import the etcd-io/bbolt, will reintroduces etcd-io/bbolt through the import statements "import go.etcd.io/bbolt" in the go source file of etcd-io/bbolt.

https://github.com/etcd-io/bbolt/blob/v1.3.3/cursor_test.go#L14

package bbolt_test
import (
	bolt "go.etcd.io/bbolt"
	…
) 

The "go.etcd.io/bbolt" and "github.com/etcd-io/bbolt" 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/etcd-io/bbolt", use "go.etcd.io/bbolt" instead.

Solution

Replace all the old import paths, change "github.com/etcd-io/bbolt" to "go.etcd.io/bbolt ". Where did you import it: https://github.com/iris-contrib/examples/search?q=github.com%2Fetcd-io%2Fbbolt&unscoped_q=github.com%2Fetcd-io%2Fbbolt

KateGo520 avatar Aug 12 '20 01:08 KateGo520

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

KateGo520 avatar Aug 12 '20 01:08 KateGo520

Yes @KateGo520, this is already fixed two months ago look here. The iris-contrib/examples repository is a clone of kataras/iris/_examples. The v12 branch cannot be modified until the next release of Iris. This repository is not synchronized yet with the latest kataras/iris/_examples, probably will do it now.

kataras avatar Aug 12 '20 14:08 kataras

@kataras Thank you for your reply! Looking forward to the synchronized iris-contrib/examples.

KateGo520 avatar Aug 13 '20 05:08 KateGo520

They are now :) you welcome!

kataras avatar Aug 13 '20 05:08 kataras