I am using the go language and I want to understand the alternative to one scenario that I am facing.
we have import statements in the files as
import "github.com/Dir1/Dir2/v101/ServiceName"
I have a dependency on SDK which follows the directory structure like this. It has version_no directory.
Problem - Every-time the SDK version is updated we have to replace the import statement with appropriate version.
Currently in project it is achieved using the sed command which is very heavy operation as we have thousands of files. Ex Changing "github.com/Dir1/Dir2/v101/ServiceName" ==> "github.com/Dir1/Dir2/v102/ServiceName"
SDK team will not provide any support so we have to find the good way to resolve this.
I need your suggestion about how this can be achieved.
Add this in the
go.mod
file:Now, you can keep using
github.com/Dir1/Dir2/v101/ServiceName
everywhere, and update thisreplace
directive every time the version needs to be updated. For example, if the next version isv103
, update this: