Golang

Looking into dependency management in golang and I was quite surprised that it’s possible to import multiple versions of the same library.

However it only works for major version that are considered as a different module. Which must be specified when creating the package

E.g

module multiversion

go 1.15

require (
	github.com/go-redis/redis/v7 v7.0.0
	github.com/go-redis/redis/v8 v8.0.0
)
package main

import (
	redisv1 "github.com/go-redis/redis/v7"
	redisv2 "github.com/go-redis/redis/v8"
)

func main() {
	redisv1.NewClient(&redisv1.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	})
	redisv2.NewClient(&redisv2.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	})
}

Python

It’s impossible in Python for now see this thread

Credits: