hotfix

package module
v0.0.0-...-a86e919 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

README

GoDoc Go Report Card

Usage

  • Add hotfix.Watch() in your main process, and run it.
  • Use hotfix.Build() and hotfix.RegisterPatch() to generate a plugin in anther script.
  • The main process will autoload the plugin and call the monkeypatch function inside it.
  • Look up the ./example folder to explore the detail. Try test.sh.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(name string, c *Config) error

Generate a plugin file in pluginPath. name: the name of .so file.

func RegisterPatch

func RegisterPatch(name string, patch *gomonkey.Patches)

func SetPluginPath

func SetPluginPath(path string)

Set the install path of plugins as you want

func StopWatch

func StopWatch()

close *fsnotify.Watcher

func Watch

func Watch(dir string, loadAll bool)

watch pluginPath, autoload plugins to replace origin function.

dir: watch directory of plugin files. if dir is empty, use default value: os.Getwd() + "/tmp".

if loadAll is true, will load and run all existing plugins under dir before start watching

Types

type Config

type Config struct {
	// ImportPath specifies the import path
	ImportPath string
	// NewFunc creates an instance of the plugin
	NewFunc interface{}
}

Config is the plugin config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL