go 常见问题
以下是我在go项目中碰到问题
1. 如何只测试指定的test文件,而不是所有的单元测试都跑一遍.
go tool vet -test -v src\github.com\astaxie\beego\controller_test.go
go tool vet 是个很不错的工具,里面有很强大的功能
go tool vet 参数
Usage of vet:
vet [flags] directory...
vet [flags] files... # Must be a single package
For more information run
godoc golang.org/x/tools/cmd/vet Flags:
-all
check everything; disabled if any explicit check is requested (default true)
-asmdecl
check assembly against Go declarations (default unset)
-assign
check for useless assignments (default unset)
-atomic
check for common mistaken usages of the sync/atomic package (default unset)
-bool
check for mistakes involving boolean operators (default unset)
-buildtags
check that +build tags are valid (default unset)
-composites
check that composite literals used field-keyed elements (default unset)
-compositewhitelist
use composite white list; for testing only (default true)
-copylocks
check that locks are not passed by value (default unset)
-methods
check that canonically named methods are canonically defined (default unset)
-nilfunc
check for comparisons between functions and nil (default unset)
-printf
check printf-like invocations (default unset)
-printfuncs string
comma-separated list of print function names to check
-rangeloops
check that range loop variables are used correctly (default unset)
-shadow
check for shadowed variables (experimental; must be set explicitly) (default unset)
-shadowstrict
whether to be strict about shadowing; can be noisy
-shift
check for useless shifts (default unset)
-structtags
check that struct field tags have canonical format and apply to exported fields as needed (default unset)
-tags string
comma-separated list of build tags to apply when parsing
-test
for testing only: sets -all and -shadow
-unreachable
check for unreachable code (default unset)
-unsafeptr
check for misuse of unsafe.Pointer (default unset)
-unusedfuncs string
comma-separated list of functions whose results must be used (default "errors.New,fmt.Errorf,fmt.Sprintf,fmt.Sprint,sort.Reverse")
-unusedresult
check for unused result of calls to functions in -unusedfuncs list and methods in -unusedstringmethods list (default unset)
-unusedstringmethods string
comma-separated list of names of methods of type func() string whose results must be used (default "Error,String")
-v verbose
go 常见问题的更多相关文章
- C++常见笔试面试要点以及常见问题
1. C++常见笔试面试要点: C++语言相关: (1) 虚函数(多态)的内部实现 (2) 智能指针用过哪些?shared_ptr和unique_ptr用的时候需要注意什么?shared_ptr的实现 ...
- SQL Server常见问题介绍及快速解决建议
前言 本文旨在帮助SQL Server数据库的使用人员了解常见的问题,及快速解决这些问题.这些问题是数据库的常规管理问题,对于很多对数据库没有深入了解的朋友提供一个大概的常见问题框架. 下面一些问题是 ...
- 【腾讯优测干货分享】如何降低App的待机内存(二)——规范测试流程及常见问题
本文来自于腾讯优测公众号(wxutest),未经作者同意,请勿转载,原文地址:https://mp.weixin.qq.com/s/806TiugiSJvFI7fH6eVA5w 作者:腾讯TMQ专项测 ...
- mysql数据库开发常见问题及优化
mysql 数据库是被广泛应用的关系型数据库,其体积小.支持多处理器.开源并免费的特性使其在 Internet 中小型网站中的使用率尤其高.在使用 mysql 的过程中不规范的 SQL 编写.非最优的 ...
- 《PDF.NE数据框架常见问题及解决方案-初》
<PDF.NE数据框架常见问题及解决方案-初> 1.新增数据库后,获取标识列的值: 解决方案: PDF.NET数据框架,已经为我们考略了很多,因为用PDF.NET进行数据的添加操作时 ...
- MIS性能优化常见问题与方案(辅助项目组性能优化的总结贴)
最近帮忙公司的几个项目组进行了不同方面的性能优化,发现几个项目都出现了一些共性的问题.这里写一篇文章,总结一下这几类问题,以及其对应的解决方案.方便其它项目组参考. 常见问题一:打开页面非常慢,有 ...
- JMeter常见问题集合
前言 本文内容仅仅是针对Jmeter的部分功能名词的介绍和解释,以及初学者不易理解的问题的整理.部分内容来自别人做的整理,为了更好地整理自己的思路,所以可耻的整理一下发到博客上. 标题[1-6]和[参 ...
- NHibernate常见问题及解决方法
NHibernate常见问题及解决方法 曾经学过NHibernate的,但是自从工作到现在快一年了却从未用到过,近来要巩固一下却发现忘记了许多,一个"in expected: <end ...
- .NET Core中ADO.NET SqlClient的使用与常见问题
一.简介 在很多要求性能的项目中,我们都要使用传统的ADO.NET的方式来完成我们日常的工作:目前有一些网友问有关于.NET Core操作SQL Server的问题在本文中解答一下. 本文旨在指出,在 ...
- 企业IT管理员IE11升级指南【6】—— Internet Explorer 11面向IT专业人员的常见问题
企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...
随机推荐
- Java-Maven-Runoob:Maven 依赖管理
ylbtech-Java-Maven-Runoob:Maven 依赖管理 1.返回顶部 1. Maven 依赖管理 Maven 一个核心的特性就是依赖管理.当我们处理多模块的项目(包含成百上千个模块或 ...
- 字符串转换为字典的函数eval(字符串)
首先把多行的字符串,变成一个字符串,用'''和'''扩起来: 然后把这个字符串,赋值给b 这个时候,b根本调不出来,也用不起来: 用eval(b),来格式化字符串变成字典: 然后b就变成了一个字典:
- django-settings.py配置
django settings 详细资料 ############ 开始项目 python3.5 pip -m install django==1.11.7 指定版本安装 pip3 install d ...
- 在液晶屏里显示浮点数的方法 (sprintf 的妙用)
思路:使用 sprintf 函数将浮点型数据转为指定格式的字符串 #include <stdio.h> #include<string.h> int main() { unsi ...
- AngularJS学习(二)——Angular应用的解析
本节描述AngularJS应用程序的三个组成部分,并解释它们如何映射到模型-视图-控制器设计模式 模板(Template) 模板是您用HTML和CSS编写的文件,展现应用的视图.您可给HTML添加新的 ...
- 中国大学MOOC 玩转AutoCAD 熟悉AutoCAD的工作空间
- file_get_content() 超时
set_time_limit 只能影响php 程序的超时时间. file_get_contents 读取的是URL的超时时间. 因此 set_limit_limit 对file_get_conte ...
- 自定义的parse_url逆向函数http_build_url,将数组转为url字符串
parse_url函数可以讲一个url字符串解析成一个数组,但是php中似乎没有parse_url的逆向函数来讲一个解析出来的数组组合成url字符串,只有一个http_build_query用来将数组 ...
- Ubuntu无法安装rpm包,ubuntu RPM should not be used directly install RPM packages, use Alien instead!
Ubuntu无法安装rpm包,ubuntu RPM should not be used directly install RPM packages, use Alien instead! 简单来说, ...
- 新建tomcat的server服务,在左侧项目浏览处,右键空白的地方,选择new,再选择other选项
新建tomcat的server服务,在左侧项目浏览处,右键空白的地方,选择new,再选择other选项. 在弹出的窗口中,下拉滚动条找到Server,并单击next按钮. 在弹出的窗口中,找到第一个A ...