Load package dynamically

前端 未结 5 1745
-上瘾入骨i
-上瘾入骨i 2020-12-15 03:03

Is it possible to load a specific package during runtime? I want to have a kind of plugins where each one has the same functions than the others but with different behaviou

5条回答
  •  情歌与酒
    2020-12-15 03:28

    You might consider executing the ‘plugin’ packages at runtime, by writing out a new program (say, to a temp directory) and executing via exec.Command, something along the lines of exec.Command("go", "run", files…).Run()

    You’ll see some similar code here.

提交回复
热议问题