# Developing on multiple modules that are dependent at the same time

It can be tricky to work on the operator in the ecida/runtime-controller repo, while also working on the 2022-phd-mostafa-ecida-demo package that is a dependency of the controller. Ideally you make changes in Mostafa's package, and without having to push anything those changes should be reflected in the runtime-controller during development.

This is possible using the replace directive in go.mod.

# Using the replace directive

Given a go.mod that looks approximately like this:

module github.com/ecida/runtime-controller

go 1.15

require (
        ...
        github.com/onsi/ginkgo v1.14.1
        github.com/rug-ds-lab/2022-phd-mostafa-ecida-demo v0.0.0-20220224144749-8916d98f4b6d
        k8s.io/api v0.19.2
        ...
)

Simply add the following line before the require section to replace that given module with a local copy.

replace github.com/rug-ds-lab/2022-phd-mostafa-ecida-demo => ../2022-phd-mostafa-ecida-demo

Final version:

module github.com/ecida/runtime-controller

go 1.15

replace github.com/rug-ds-lab/2022-phd-mostafa-ecida-demo => ../2022-phd-mostafa-ecida-demo

require (
        ...
        github.com/onsi/ginkgo v1.14.1
        github.com/rug-ds-lab/2022-phd-mostafa-ecida-demo v0.0.0-20220224144749-8916d98f4b6d
        k8s.io/api v0.19.2
        ...
)