获取 golang 包并自动运行脚本。

huangapple go评论76阅读模式
英文:

go get golang package and run a script automatically

问题

当我们发布Python包时,我们使用pip,它会触发setup.py来构建一些必要的包。

我正在发布一个Golang包,我希望当我的用户获取我的包时,在安装之前能自动触发一个makefile(一些准备环境的脚本)。这种情况是否可能?

英文:

when we publish python package, we use pip, which will trigger setup.py to build some necessary packages.

I'm publishing a golang package, I wish when my user gets my package, it will auto trigger a makefile (some scripts to prepare environment) before installation. Is it possible?

答案1

得分: 2

当我的用户收到我的软件包时,我希望在安装之前能自动触发一个makefile(一些脚本)。

这将允许你在我执行一些看似无害的go get github.com/yiw/totallyharmless时,在我的机器上执行任意命令。

我希望这是不可能的。过去曾发生过类似情况(通过巧妙的cgo技巧),但已经修复,因为这是一个重大的安全问题。

英文:

> I wish when my user get my package, it will auto trigger an makefile (some scirpts) before installation.

That would allow you to execute arbitrary commands on my machine while I do some innocent looking go get github.com/yiw/totallyharmless because I want to use that package.

> Is it possible?

I hope not. This happened in the past (through clever cgo stuff) and was fixed as this is a major security issue.

huangapple
  • 本文由 发表于 2021年9月30日 18:44:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/69390804.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定