• go 常见问题


      以下是我在go项目中碰到问题

    1. 如何只测试指定的test文件,而不是所有的单元测试都跑一遍.

    go tool vet -test -v srcgithub.comastaxieeegocontroller_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
    

      

     

  • 相关阅读:
    移动端开发常遇问题解答
    CSS属性小结之--半透明处理
    jquery事件代理
    sprite图在移动端的使用
    vertical-align及IE7下的inline-block
    图片延迟加载
    iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
    GCD深入理解(1)
    iOS 开发图片资源选择png格式还是jpg格式
    iOS沙盒(sandbox)机制及获取沙盒路径
  • 原文地址:https://www.cnblogs.com/baizx/p/5008839.html
Copyright © 2020-2023  润新知