github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/Doc/go.txt (about)

     1  Let ROOT be the root of the CloudProxy source tree
     2  
     3  > cd ${ROOT}/go/src/cloudproxy/tao
     4  > go build
     5  > go test
     6  
     7  Now, just for extra information about Go style and such: 
     8  
     9  - golint will check for obvious style violations. You can get it by running
    10  
    11  go get github.com/golang/lint/golint
    12  
    13  Then run golint file.go
    14  
    15  - go vet will check for correctness issues. You can get it by running
    16  
    17  go get code.google.com/p/go.tools/cmd/vet
    18  
    19  Then run go vet file.go
    20  
    21  - go test -coverprofile=c.out  will generate test coverage stats. You can get the cover tool by running 
    22  
    23  go get code.google.com/p/go.tools/cmd/cover
    24  
    25  To see a nice HTML representation of test coverage (I don't think ours is great at the moment), run
    26  
    27  go tool cover -html=c.out
    28  
    29  after running the test command.
    30  
    31  - The standard conventions of Go are covered very nicely in the article Effective Go:
    32  
    33  http://golang.org/doc/effective_go.html
    34  
    35  Set GOPATH.
    36  
    37  Your GOPATH should be the root above your source directory where you want it to find things. For example, in our case, you should have at least
    38  
    39  export GOPATH=${ROOT}/go
    40  
    41  where ROOT is the root of the cloudproxy source tree. You might want to have other paths, too. I usually have $HOME in my gopath, since then it will install binaries it builds into ${HOME}/bin and will install go source code it downloads into ${HOME}/src. For example, if you execute 
    42  
    43  go get github.com/kevinawalsh/datalog
    44  
    45  it will add the directory
    46  
    47  ${HOME}/src/github.com/kevinawalsh/datalog
    48