go build Multiple main.go file
golang 如何编译同目录下多个main文件?
多个go 文件在相同目录编译时候会报错,
可将文件放在不同的package下,结构如下:
buidtest/
├── a
│ └── a.go
└── b
└── b.go
b.go
package main import "fmt" func main() {
fmt.Println("b ....")
}
a.go
package main import "fmt" func main() {
fmt.Println("a ....")
}
可采用如下方式编译安装:
go install ./...
此时执行,a,b
localhost:buidtest hao$ a
a ....
localhost:buidtest hao$ b
b ....
可以看到执行后将自动编译安装到项目到$GOPATH/bin 目录下;
您的赞赏是对我最大的支持
https://ieftimov.com/golang-package-multiple-binaries
go build Multiple main.go file的更多相关文章
- Warning: Multiple build commands for output file /xxx
xcode中 有时候会报一个警告: [WARN]Warning: Multiple build commands for output file /xxx 要解决这个问题很简单: 1.选择你的工程 2 ...
- multiple build commands for output file
在项目中 我们经常会碰到图片这方面的警告 虽然不影响运行 但是警告太多了也不是很好 其中 图片方面遇到的警告以下面的警告偏多:multiple build commands for output ...
- ld can't link with a main executable file for architecture armv7
在iPhone 6 Plus上跑的时候遇到了这么一个错误:ld can't link with a main executable file for architecture armv7,然后就各种改 ...
- Error: Cannot open main configuration file '//start' for reading! 解决办法
当执行service nagios start启动nagios时,报错:Error: Cannot open main configuration file '//start' for reading ...
- Mac OS build caffe2 Error:This file was generated by an older version of protoc which is
问题所在 我们可以发现这个错误跟protobuf的版本有关,因此我们可以执行script/diagnose_protobuf.py 我们可以看到,pip install protobuf 和 brew ...
- [Functional Programming] mapReduce over Async operations with first success prediction (fromNode, alt, mapReduce, maybeToAsync)
Let's say we are going to read some files, return the first file which pass the prediction method, t ...
- gin框架使用Air实时加载
Air实时加载 本章我们要介绍一个神器--Air能够实时监听项目的代码文件,在代码发生变更之后自动重新编译并执行,大大提高gin框架项目的开发效率. 1.1.1. 为什么需要实时加载? 之前使用Pyt ...
- Visual Studio - File Properties (Build Action, Copy to Output Directory)
Ref: MSDN (https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/0c6xyb ...
- Gradle Goodness: Changing Name of Default Build File
Gradle uses the name build.gradle as the default name for a build file. If we write our build code i ...
随机推荐
- Spring、SpringMVC、Hibernate详细整合实例,包含所有步骤
Eclipse完整工程如下 Jar包如下 CSDN下载地址:https://download.csdn.net/download/zhutouaizhuwxd/9721062 其中,整个工程主要可以分 ...
- 生成器 Generators
function* quips(name) { yield "你好 " + name + "!"; yield "希望你能喜欢这篇介绍ES6的译文&q ...
- 初始化集合的花样new HashMap<String, String>{ {put("str1":"abc");} }(转)
Map集合的普通初始化方法: Map<String, String> map = new HashMap<String, String>(); map.put("Na ...
- 强震记录和GPS记录,地震波记录的区别
强震记录的是加速度数据,但gps记录的是位移数据.这样的话,强震记录应该说是近场地震数据: 那么, 为什么不干脆用近场的地震波仪器呢,是因为,地震仪记录会限幅,导致记录不全.
- day 58 关于bootstrap
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- ios scrollView代理的用法
// // ZQRViewController.m // 03-图片缩放 // // Created by apple on 17-08-25. // #import "ZQRViewCon ...
- Struts2中的ModelDriven接口
若没有实现ModelDriven的接口,Controll的代码会比较冗余,不能实现Controll和Model代码的分离 下面是没有实现ModelDriven接口的SuggestAction pack ...
- java学习笔记19(Arrays类)
Arrays类: 此类包含用来操作数组的各种方法(比如升序和搜索): import java.util.Arrays; public class Demo { public static void m ...
- 6--Python入门--Python基本运算符
算数运算符 运算符 描述 示例 + 相加 1+1→2 - 相减 1-1→0 * 相乘 1*2→2 / 相除 1/2→0.5 % 取余数 3%2→1 ** 幂运算 2**2→4 // 取商 7//2→3 ...
- 5--Python入门--Python数据集合类型--字典
列表list,最常用的数据类型,以[]为标识 元组tuple,和list很相似,但是不能二次赋值,用()标识 集合set,和list类似,但是set中没有重复的元素,常用于集合间的运算,用{}标识 字 ...