How to switch go dependencies path to local for development

Kobe
Dec 29, 2022

--

Step 1: Open the go.mod file

module github.com/pub-technology/ProductAPI

go 1.19

require (
github.com/aws/aws-lambda-go v1.28.0
github.com/aws/aws-sdk-go v1.44.126
github.com/pub-technology/helper v1.0.0
)

require (
github.com/pub-technology/uuid v1.0.0
)

require (
... // indirect
... // indirect
)

Step 2: Example we want to run helper v1.0.0 locally instead of checkout it from git

Simple update go.mod with option replace replace checkout from git to the ${path} (Ex: Path of the helper is the same folder )

go 1.19

require (
github.com/aws/aws-lambda-go v1.28.0
github.com/aws/aws-sdk-go v1.44.126
)

replace github.com/pub-technology/helper => ./helper

Step 3: Re-build your app

--

--

Kobe
Kobe

Written by Kobe

I’m working at KMS-Technology company. I love code (▀̿Ĺ̯▀̿ ̿) — Full Stack Software Engineer

No responses yet