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

go 常见问题

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

  以下是我在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

  

 

 


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Go开源项目-goconfig使用方法发布时间: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