我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在golang代码中编译golang程序?

I need to compile programs within golang in golang. Is there any native form without using exec.Command("go","build") ?

Unfortunately I think using exec.Command is your best bet to harness the tools written by the Go community in order to compile your go programs within a go program.

You can try this

First set the $GOPATH

then set the $GOBIN

after that you can run go build or go get..

近期文章

  • 可以在Go中高效地分配具有较大起始索引的片(的基础数组)吗?
  • 使用Go包中的私有“小写”功能
  • Go是否支持内置类型(例如map和slice)的运算符重载?
  • Go(Golang)-检查文件扩展名在Go中不起作用
  • 使用某些参数调用命令有效,但不适用于其他参数,但可以从控制台使用
  • 在列表中查找最小的数字
  • GoLang中的Getter [关闭]
  • 当golang字段返回给函数调用者时,无法保留其值
  • 在Go中使用映射时忽略goroutine /线程安全的危险是什么?
  • 对goroutine的“选择性”互斥
  • 如何在Go中将Float64转换为Base36?
  • 如何将字符串转换为JSON obj? [重复]
  • http请求会自动重试吗?
  • 如何创建5个值都相同的数组/切片
  • 使用go在标签中列出AWS负载均衡器[关闭]
  • Javascript的布尔翻译到Golang
  • 如何使用socket.io连接Golang和Android?
  • 从golang程序安装npm
  • 不带元素名称的解组json
  • 了解Golang中的MUX路由器

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华