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