I have the following file structure:
.
├── bin
│ └── hello
├── pkg
└── src
└── jacob.uk.com
├── greeting
│ └── greeting.go
└─
You can add the local packages using replace in go 1.11<= go to your go.mod and use "replace" keyword, as below, (you do not need to create a github repo, just add the lines like this)
module github.com/yourAccount/yourModule
go 1.15
require (
github.com/cosmtrek/air v1.21.2 // indirect
github.com/creack/pty v1.1.11 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/julienschmidt/httprouter v1.3.0
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
go.uber.org/zap v1.15.0
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a // indirect
)
replace (
github.com/yourAccount/yourModule/localFolder =>"./yourModule/localFolder"
github.com/yourAccount/yourModule/localFolder =>"./yourModule/localFolder"
)
Then in your main.go =>
import (
alog "github.com/yourAccount/yourModule/localFolder"
slog "github.com/yourAccount/yourModule/localFolder"
)