Skip to content

bygui86/go-plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-plugins

Sample project to explore plugins offered by Golang

Pros

  • Go plugins give you a tool to help you adopt the single responsibility principle and separation of concerns.
  • It helps to break down your code into small manageable and reusable components.
  • It gives you a way to load plugins dynamically during application runtime without recompiling the program.

Cons

  • The environment for building a Go plugin such as OS, Go language version, and dependency versions must match exactly.
  • As of now, unloading plugins are not allowed without restarting the program.
  • You cannot replace a plugin with a newer version during runtime; that’s because Go doesn’t currently support unloading plugins.
  • As of Go v1.11, you can only build plugins on Linux, FreeBSD, and Mac.

Example program

The basic shipping calculator will give you rates based on which shipping method and parcel weight you provide. You can support different shipping methods by adding new plugins, and the calculator will produce the rates and currency based on your preferred shipping method.

Run

Calculate using fedex

make run-fedex

Calculate using royalmail

make run-royalmail

Links

About

Sample project to explore plugins offered by Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published