'How to call different function code based on parameters(Pluggable) in Golang

I would like to implement a project that enables several different features based on different startup parameters or configuration files, a pluggable feature set. The desired effect is that main.go can call the run function in cmd/<feature>/<feature>.go according to the parameters

├── cmd
│   ├── feature1
│   │   └── feature1.go
│   └── feature2
│       └── feature2.go
├── pkg
│   ├── feature1
│   │   └── feature1.go
│   └── feature2
│       └── feature2.go
└── main.go

Projects are complex and need to be extended

Is there a design pattern or an existing project that can be learned, if there is hope you can give advice

I really appreciate any help with this.

go


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source