I have two internal projects.
Project1 - go.mod
file
go github.com/company/project1
go 1.16
require github.com/company/project2 v1.1.0 // indirect
Project2 - go.mod
file
go github.com/company/project2
go 1.16
Project1 is dependent on Project2 based on the above go.mod file.
When Project2 moves across multiple environments it needs to be dependent upon different version of Project1.
For instance, based on environment variable:
If ENVIRONMENT = LOAD
Project1 depends on 1.1.0-<ENVIRONMENT> version of Project2
If ENVIRONMENT = TEST
Project1 depends on 1.1.0-<ENVIRONMENT>.<DATE> version of Project2
Can this be done dynamically without modifying the go.mod
file everytime ?