uwu-tools/magex

GitHub: uwu-tools/magex

为 Magefile 提供辅助方法的开源 Go 库,简化构建脚本中工具安装、版本管理和命令执行等常见操作。

Stars: 7 | Forks: 4

# Magefile 扩展 ![test](https://github.com/yuin/goldmark/actions?query=workflow:test](https://static.pigsec.cn/wp-content/uploads/repos/cas/96/96516d7a51f21139fae950e3129296fedeb5ab5f68f6a4dd1d280445b5bfdb15.svg) 本库提供了与 [mage](https://magefile.org) 配合使用的辅助方法。 以下是可用辅助方法的示例。完整的示例和文档请见 [godoc](https://godoc.org/github.com/uwu-tools/magex)。 ``` // +build mage package main import ( "github.com/uwu-tools/magex/pkg" "github.com/uwu-tools/magex/shx" ) // Check if packr2 is in the bin/ directory and is at least v2. // If not, install packr@v2.8.0 into bin/ func EnsurePackr2() error { opts := pkg.EnsurePackageOptions{ Name: "github.com/gobuffalo/packr/v2/packr2", DefaultVersion: "v2.8.0", VersionCommand: "version", Destination: "bin", } return pkg.EnsurePackageWith(opts) } // Install mage if it's not available, and ensure it's in PATH. We don't care which version func Mage() error { return pkg.EnsureMage("") } // Run a docker registry in a container. Do not print stdout and only print // stderr when the command fails even when -v is set. // // Useful for commands that you only care about when it fails, keeping unhelpful // output out of your logs. func StartRegistry() error { return shx.RunE("docker", "run", "-d", "-p", "5000:5000", "--name", "registry", "registry:2") } // Use go to download a tool, build and install it manually so // that it has version information embedded in the final binary. func CustomInstallTool() error { err := shx.RunE("go", "get", "-u", "github.com/magefile/mage") if err != nil { return err } src := filepath.Join(GOPATH(), "src/github.com/magefile/mage") return shx.Command("go", "run", "bootstrap.go").In(src).RunE() } ``` ## 致谢 本项目是 https://github.com/carolynvs/magex 在 [0b6a1c6](https://github.com/carolynvs/magex/tree/0b6a1c6d5cba42cbad741c93546e99837b1c1fb9) 处的 fork。 ### 谨此悼念 [Carolyn Van Slyck](https://github.com/carolynvs) 是本项目的原维护者,但她已离开了我们。 她是 [`mage`](https://magefile.org/) 的粉丝,我希望能尽自己的一份绵薄之力,将她的扩展项目继续下去。 如果您曾有幸与 Carolyn 共事,并希望留言缅怀她,请花一点时间在她的 CNCF [纪念页面](https://github.com/cncf/memorials/blob/main/carolyn-van-slyck.md) 上留言。
标签:EVTX分析, Go语言, Magefile, SOC Prime, 开发工具, 日志审计, 程序破解, 请求拦截, 辅助函数