I am trying to use multiple version of a single go tool in one project. For example, here is a package: https://godoc.org/github.com/docker/docker/pkg, now this package has some directories that are available in older versions, but not in current version and vice-versa. I want to use both, doing go get always gets the latest version. If I switch to old version, I miss out on the latest directories. Any idea how can I keep both the versions?
TIA.
It's possible if major version of new and old releases is different with help of gopkg.in, you can import with different import path:
And then use them in Go separately:
import (
redisv1 "gopkg.in/go-redis/redis.v1"
redisv2 "gopkg.in/go-redis/redis.v2"
)
If major version is the same it's not possible to implement, since go get
, go modules
and other package managers do not support it.