• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

使用Markfile开发GO程序

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

Markfile

makefile是用于构建和运行软件应用程序的自动化工具。

GO程序

首先,我们创建一个GO应用程序

package main

import "fmt"

func main() {
	fmt.Println("Hello Markfile!!")
}

创建Markfile

build:
	go build -o bin/main main.go

run:
	go run main.go

compile:
	# 32-Bit Systems
	# FreeBDS
	GOOS=freebsd GOARCH=386 go build -o bin/main-freebsd-386 main.go
	# MacOS
	GOOS=darwin GOARCH=386 go build -o bin/main-darwin-386 main.go
	# Linux
	GOOS=linux GOARCH=386 go build -o bin/main-linux-386 main.go
	# Windows
	GOOS=windows GOARCH=386 go build -o bin/main-windows-386 main.go
  # 64-Bit
	# FreeBDS
	GOOS=freebsd GOARCH=amd64 go build -o bin/main-freebsd-amd64 main.go
	# MacOS
	GOOS=darwin GOARCH=amd64 go build -o bin/main-darwin-amd64 main.go
	# Linux
	GOOS=linux GOARCH=amd64 go build -o bin/main-linux-amd64 main.go
	# Windows
	GOOS=windows GOARCH=amd64 go build -o bin/main-windows-amd64 main.go

运行Markfile命令

构建命令

为我们的平台构建Go应用程序

make build

运行命令

运行go应用程序

make run

编译命令

为了针对不同的平台和操作系统编译Go 应用程序

make compile

参考

跟我一起写Makefile

https://harrisonbrock.blog/go-makefile/


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
关于go mod 的使用和goland 配置 go mod发布时间:2022-07-10
下一篇:
如何封装安全的go发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap