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 ...
随机推荐
- Python3.7.0的安装方法
安装Python3.7.0 1.下载Python-3.7.0.tar.xz包安装 wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.t ...
- VS2010编译Unigine_2010源码
VS2010编译Unigine_2010源码[Debug版本] 1.Laucher工程属性改为控制台项目 2.Unigine工程编译时的Warnning LNK2019 a.属性--常规-目标文件名改 ...
- 7系列FPGA远程更新方案-QuickBoot(转)
reference: http://xilinx.eetrend.com/d6-xilinx/article/2014-04/7009.html reference : quickboot meth ...
- Docker技术综述
从技术入门到实战:docker初步尝试 docker中文社区 容器和镜像的导入和导出
- 『翻译』Android USB Host
USB Host When your Android-powered device is in USB host mode, it acts as the USB host, powers the b ...
- day 03 变量与基本数据类型
变量的命名规范 一:变量命名的大前提,应该能够反映出变量值所记录内容 1:变量名只能由数字,字母,下划线组成 2:变量名不能以数字开头 3:变量名不能使用系统的关键字,不然可能会报错 二:变量名的命名 ...
- 什么是虚拟DOM?为啥虚拟DOM可以提升性能?
现在流行的框架无论是React还是vue,都采用的是虚拟DOM 采用虚拟DOM的好处是,当数据变化的时候,无需像Backbone那样整体重新渲染,而是局部刷新变化部分 所谓虚拟DOM,其实就说用Jav ...
- Vue.js学习使用心得(二)——自定义指令
自定义指令 除了核心功能默认内置的指令,Vue 也允许注册自定义指令. 自定义指令可以定义全局指令,也可以定义局部指令. 使用 directives 选项来自定义指令. 定义全局指令: <div ...
- HDU2019数列有序!
Problem Description 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给一个整数x,请将该数插入到序列中,并使新的序列仍然有序. Input 输入数据包含多个测 ...
- mysql操作基本命令
查看索引 : show index from table_name 创建索引:create index index_name on table_name(column_name) 创建唯一索引:cre ...