How to "require" your own private modules in go.mod

Using the replace directive, you can develop a Diarkis server with private modules.

Place your private module in your Diarkis server project directory.

Here is an example of a directory structure to add your private module to the directory extracted by diarkis-server-template.

$ tree -d
.
├── build.yml
├── go.mod
├── cmds
│   ├── custom
│   ├── field
│   ├── group
│   ├── http
│   └── room
├── configs
│   ├── connector
│   ├── http
│   ├── mars
│   ├── shared
│   ├── tcp
│   ├── udp
│   └── ws
├── servers
│   ├── connector
│   ├── http
│   ├── tcp
│   ├── udp
│   └── ws
├── ws_cmds
│  ├── custom
│  │   └── ws_custom
│  ├── field
│  ├── group
│  ├── http
│  └── room
└── your_modules_dir
├── go.mod
 └── private_module.go

Referencing your private module in go.mod

Add a reference to the module to go.mod in your Diarkis server project.

module my-diarkis-project

go 1.16

require github.com/Diarkis/diarkis v0.2.26
require example.com/Your/module => /path/to/your_modules_dir

What is "replace" directive

This is a directive that replaces the content (reference) of the module specified by import.

See also : https://go.dev/ref/mod#go-mod-file-replace