...

Text file src/github.com/google/pprof/CONTRIBUTING.md

Documentation: github.com/google/pprof

     1Want to contribute? Great: read the page (including the small print at the end).
     2
     3# Before you contribute
     4
     5As an individual, sign the [Google Individual Contributor License
     6Agreement](https://cla.developers.google.com/about/google-individual) (CLA)
     7online. This is required for any of your code to be accepted.
     8
     9Before you start working on a larger contribution, get in touch with us first
    10through the issue tracker with your idea so that we can help out and possibly
    11guide you. Coordinating up front makes it much easier to avoid frustration later
    12on.
    13
    14# What to expect
    15
    16All submissions (including by project members) are done via GitHub pull requests
    17and require a code review by a project member.
    18
    19We expect contributions to be good, clean code following style and practices for
    20the language the contribution is in. The pprof source code is in Go with a bit
    21of JavaScript, CSS and HTML. If you are new to Go, read [Effective
    22Go](https://golang.org/doc/effective_go.html) and the [summary on typical
    23comments during Go code
    24reviews](https://github.com/golang/go/wiki/CodeReviewComments).
    25
    26All contributions should include automated tests for the change. We are
    27continuously improving pprof automated testing and we can't accept changes that
    28are not helping that direction. Code coverage numbers are automatically
    29published in each pull request - we expect that number to go up.  Note that
    30adding a good test often requires more time than the fix itself - this is
    31expected and you should be prepared for that time investment.
    32
    33Contributions that do not meet the above guidelines will get less attention and
    34will be slow to get accepted or won't be accepted at all. We will also likely
    35refuse to accept changes that have fairly limited audience but will require us
    36to commit to maintain them for foreseeable future. This includes support for
    37specific platforms, making internal pprof APIs public, etc.
    38
    39# Development
    40
    41The commands below assume `/tmp/pprof` as the location for the source code.
    42You can change it to a directory of your choice.
    43
    44To get the source code, run
    45
    46```
    47cd /tmp
    48git clone git@github.com:google/pprof.git
    49cd pprof
    50```
    51
    52To run the tests, do
    53
    54```
    55cd /tmp/pprof
    56go test -v ./...
    57```
    58
    59When you wish to work with your own fork of the source (which is required to be
    60able to create a pull request), you'll want to get your fork repo as another Git
    61remote in the same `github.com/google/pprof` directory. Otherwise, if you'll `go
    62get` your fork directly, you'll be getting errors like `use of internal package
    63not allowed` when running tests.  To set up the remote do something like
    64
    65```
    66cd /tmp/pprof
    67git remote add aalexand git@github.com:aalexand/pprof.git
    68git fetch aalexand
    69git checkout -b my-new-feature
    70# hack hack hack
    71go test -v ./...
    72git commit -a -m "Add new feature."
    73git push aalexand
    74```
    75
    76where `aalexand` is your GitHub user ID. Then proceed to the GitHub UI to send a
    77code review.
    78
    79# The small print
    80
    81Contributions made by corporations are covered by a different agreement than the
    82one above, the [Software Grant and Corporate Contributor License
    83Agreement](https://cla.developers.google.com/about/google-corporate).

View as plain text