Mage 类似make&&rake 基于golang 的build 工具


Mage 是基于golang 开发的,类似make/rake 的工具,我们可以使用golang 代码编写类似make 的功能
以下是一个简单的使用

安装

 
go get -u -d github.com/magefile/mage

基本使用

  • 代码
go mod init github.com/rongfengliang/build-make
main.go
//+build mage
package main
import (
    "fmt"
    "github.com/magefile/mage/sh"
)
// echo && ls
func Build() {
    if err := sh.Run("ls", "-sialh", "."); err != nil {
        fmt.Println("some wrong")
    }
    sh.RunV("echo", "$PWD")
}

说明

类似的工具还是很多的,比如go-task,just,tusk

参考资料

https://github.com/magefile/mage
https://github.com/casey/just
https://github.com/rliebz/tusk
https://github.com/go-task/task


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM