github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/docs/Style-guides/go-style.md (about)

     1  ## Coding guidelines
     2  
     3  ### Coding Golang <a name="coding-go"></a>
     4  
     5  We code in Go&trade; and strictly follow the [best
     6  practices](http://golang.org/doc/effective_go.html) and will not accept any
     7  deviations. You must run the following tools against your Go code and fix all
     8  errors and warnings:
     9    - [golint](https://github.com/golang/lint)
    10    - [go vet](https://golang.org/cmd/vet/)
    11    - [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports)
    12  
    13  ## Generating gRPC code <a name="gRPC"></a>
    14  
    15  If you modify any `.proto` files, run the following command to generate/update
    16  the respective `.pb.go` files.
    17  
    18  ```
    19  cd $GOPATH/src/github.com/hyperledger/fabric
    20  make protos
    21  ```
    22  
    23  ## Adding or updating Go packages
    24  
    25  The Hyperledger Fabric Project uses Go 1.6 vendoring for package management.
    26  This means that all required packages reside in the `vendor` folder within the
    27  fabric project. Go will use packages in this folder instead of the GOPATH when
    28  the `go install` or `go build` commands are executed. To manage the packages in
    29  the `vendor` folder, we use [Govendor](https://github.com/kardianos/govendor),
    30  which is installed in the Vagrant environment. The following commands can be
    31  used for package management:
    32  
    33  ```
    34    # Add external packages.
    35    govendor add +external
    36  
    37    # Add a specific package.
    38    govendor add github.com/kardianos/osext
    39  
    40    # Update vendor packages.
    41    govendor update +vendor
    42  
    43    # Revert back to normal GOPATH packages.
    44    govendor remove +vendor
    45  
    46    # List package.
    47    govendor list
    48  ```