Andrew Gerrand | 7cb21a7 | 2012-01-19 11:24:54 +1100 | [diff] [blame] | 1 | <!--{ |
| 2 | "Title": "Contribution Guidelines" |
| 3 | }--> |
Russ Cox | fb39a4d | 2009-10-23 15:24:08 -0700 | [diff] [blame] | 4 | |
Russ Cox | 6c7f9f6 | 2009-11-09 16:56:17 -0800 | [diff] [blame] | 5 | <h2 id="Introduction">Introduction</h2> |
Rob Pike | 5b72f9c | 2009-11-01 20:48:21 -0800 | [diff] [blame] | 6 | |
| 7 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 8 | This document explains how to contribute changes to the Go project. |
Andrew Gerrand | 968f0df | 2014-12-12 13:53:29 +1100 | [diff] [blame] | 9 | It assumes you have followed the |
Jonathan Feinberg | 452f40f | 2012-09-26 14:39:31 -0400 | [diff] [blame] | 10 | <a href="/doc/install/source">installation instructions</a> and |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 11 | have <a href="code.html">written and tested your code</a>. |
Andrew Gerrand | 968f0df | 2014-12-12 13:53:29 +1100 | [diff] [blame] | 12 | </p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 13 | |
| 14 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 15 | (Note that the <code>gccgo</code> frontend lives elsewhere; |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 16 | see <a href="gccgo_contribute.html">Contributing to gccgo</a>.) |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 17 | </p> |
Russ Cox | fb39a4d | 2009-10-23 15:24:08 -0700 | [diff] [blame] | 18 | |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 19 | <h2 id="Design">Discuss your design</h2> |
| 20 | |
| 21 | <p> |
| 22 | The project welcomes submissions but please let everyone know what |
| 23 | you're working on if you want it to become part of the main repository. |
| 24 | </p> |
| 25 | |
| 26 | <p> |
| 27 | Before undertaking to write something new for the Go project, send |
Brad Fitzpatrick | 967901a | 2014-03-05 14:09:03 -0800 | [diff] [blame] | 28 | mail to the <a href="https://groups.google.com/group/golang-nuts">mailing |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 29 | list</a> to discuss what you plan to do. This gives everyone a |
| 30 | chance to validate the design, helps prevent duplication of effort, |
| 31 | and ensures that the idea fits inside the goals for the language |
| 32 | and tools. It also guarantees that the design is sound before code |
| 33 | is written; the code review tool is not the place for high-level |
| 34 | discussions. |
| 35 | </p> |
| 36 | |
| 37 | <p> |
| 38 | In short, send mail before you code. |
| 39 | And don't start the discussion by mailing a change list! |
| 40 | </p> |
| 41 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 42 | <h2 id="Testing">Testing redux</h2> |
Russ Cox | 830813f | 2009-11-08 21:08:27 -0800 | [diff] [blame] | 43 | |
| 44 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 45 | You've <a href="code.html">written and tested your code</a>, but |
| 46 | before sending code out for review, run all the tests for the whole |
| 47 | tree to make sure the changes don't break other packages or programs: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 48 | </p> |
| 49 | |
| 50 | <pre> |
Nathan John Youngman | d5f208c | 2014-03-17 09:35:04 +1100 | [diff] [blame] | 51 | $ cd go/src |
| 52 | $ ./all.bash |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 53 | </pre> |
| 54 | |
| 55 | <p> |
Nathan John Youngman | d5f208c | 2014-03-17 09:35:04 +1100 | [diff] [blame] | 56 | (To build under Windows use <code>all.bat</code>.) |
| 57 | </p> |
| 58 | |
| 59 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 60 | After running for a while, the command should print |
| 61 | "<code>ALL</code> <code>TESTS</code> <code>PASSED</code>". |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 62 | </p> |
| 63 | |
Russ Cox | 6c7f9f6 | 2009-11-09 16:56:17 -0800 | [diff] [blame] | 64 | <h2 id="Code_review">Code review</h2> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 65 | |
| 66 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 67 | Changes to Go must be reviewed before they are accepted, |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 68 | no matter who makes the change. |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 69 | A custom git command called <code>git-codereview</code>, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 70 | discussed below, helps manage the code review process through a Google-hosted |
| 71 | <a href="https://go-review.googlesource.com/">instance</a> of the code review |
| 72 | system called <a href="https://code.google.com/p/gerrit/">Gerrit</a>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 73 | </p> |
| 74 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 75 | <h3>Set up authentication for code review</h3> |
Russ Cox | 9ad14c9 | 2009-11-06 10:33:46 -0800 | [diff] [blame] | 76 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 77 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 78 | Gerrit uses Google Accounts for authentication. If you don't have |
| 79 | a Google Account, you can create an account which |
| 80 | <a href="https://www.google.com/accounts/NewAccount">includes |
| 81 | a new Gmail email account</a> or create an account associated |
| 82 | <a href="https://accounts.google.com/SignUpWithoutGmail">with your existing |
| 83 | email address</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 84 | </p> |
| 85 | |
| 86 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 87 | The email address associated with the Google Account you use will be recorded in |
| 88 | the <a href="https://go.googlesource.com/go/+log/">change log</a> |
| 89 | and in the <a href="/CONTRIBUTORS">contributors file</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 90 | </p> |
| 91 | |
| 92 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 93 | To set up your account in Gerrit, visit |
| 94 | <a href="https://go.googlesource.com">go.googlesource.com</a> |
| 95 | and click on "Generate Password" in the page's top right menu bar. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 96 | </p> |
| 97 | |
| 98 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 99 | You will be redirected to accounts.google.com to sign in. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 100 | </p> |
| 101 | |
| 102 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 103 | Once signed in, you are returned back to go.googlesource.com to "Configure Git". |
| 104 | Follow the instructions on the page. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 105 | (If you are on a Windows computer, you should instead follow the instructions |
| 106 | in the yellow box to run the command.) |
| 107 | </p> |
| 108 | |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 109 | <p> |
| 110 | Your secret authentication token is now in a <code>.gitcookie</code> file |
| 111 | and Git is configured to use this file. |
| 112 | </p> |
| 113 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 114 | <h3>Register with Gerrit</h3> |
| 115 | |
| 116 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 117 | Now that you have your authentication token, |
| 118 | you need to register your account with Gerrit. |
| 119 | To do this, visit |
| 120 | <a href="https://go-review.googlesource.com/login/"> |
| 121 | go-review.googlesource.com/login/</a>. You will immediately be redirected |
| 122 | to Google Accounts. Sign in using the same Google Account you used above. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 123 | That is all that is required. |
| 124 | </p> |
| 125 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 126 | <h3>Install the git-codereview command</h3> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 127 | |
| 128 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 129 | Now install the <code>git-codereview</code> command by running, |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 130 | </p> |
| 131 | |
| 132 | <pre> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 133 | $ go get -u golang.org/x/review/git-codereview |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 134 | </pre> |
| 135 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 136 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 137 | Make sure <code>git-codereview</code> is installed in your shell path, so that the |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 138 | <code>git</code> command can find it. Check that |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 139 | </p> |
| 140 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 141 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 142 | $ git codereview help |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 143 | </pre> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 144 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 145 | <p> |
| 146 | prints help text, not an error. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 147 | </p> |
| 148 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 149 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 150 | Note to Git aficionados: The <code>git-codereview</code> command is not required to |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 151 | upload and manage Gerrit code reviews. For those who prefer plain Git, the text |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 152 | below gives the Git equivalent of each git-codereview command. If you do use plain |
| 153 | Git, note that you still need the commit hooks that the git-codereview command |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 154 | configures; those hooks add a Gerrit <code>Change-Id</code> line to the commit |
| 155 | message and check that all Go source files have been formatted with gofmt. Even |
| 156 | if you intend to use plain Git for daily work, install the hooks in a new Git |
Oling Cat | ce36552 | 2014-12-14 14:32:56 +0800 | [diff] [blame] | 157 | checkout by running <code>git-codereview</code> <code>hooks</code>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 158 | </p> |
| 159 | |
| 160 | <h3>Set up git aliases</h3> |
| 161 | |
| 162 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 163 | The <code>git-codereview</code> command can be run directly from the shell |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 164 | by typing, for instance, |
| 165 | </p> |
| 166 | |
| 167 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 168 | $ git codereview sync |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 169 | </pre> |
| 170 | |
| 171 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 172 | but it is more convenient to set up aliases for <code>git-codereview</code>'s own |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 173 | subcommands, so that the above becomes, |
| 174 | </p> |
| 175 | |
| 176 | <pre> |
| 177 | $ git sync |
| 178 | </pre> |
| 179 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 180 | <p> |
| 181 | The <code>git-codereview</code> subcommands have been chosen to be distinct from |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 182 | Git's own, so it's safe to do so. |
| 183 | </p> |
| 184 | |
| 185 | <p> |
| 186 | The aliases are optional, but in the rest of this document we will assume |
| 187 | they are installed. |
| 188 | To install them, copy this text into your Git configuration file |
| 189 | (usually <code>.gitconfig</code> in your home directory): |
| 190 | </p> |
| 191 | |
| 192 | <pre> |
| 193 | [alias] |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 194 | change = codereview change |
| 195 | gofmt = codereview gofmt |
| 196 | mail = codereview mail |
| 197 | pending = codereview pending |
| 198 | submit = codereview submit |
| 199 | sync = codereview sync |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 200 | </pre> |
| 201 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 202 | <h3>Understanding the git-codereview command</h3> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 203 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 204 | <p>After installing the <code>git-codereview</code> command, you can run</p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 205 | |
| 206 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 207 | $ git codereview help |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 208 | </pre> |
| 209 | |
| 210 | <p> |
| 211 | to learn more about its commands. |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 212 | You can also read the <a href="https://godoc.org/golang.org/x/review/git-codereview">command documentation</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 213 | </p> |
| 214 | |
| 215 | <h3>Switch to the master branch</h3> |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 216 | |
| 217 | <p> |
| 218 | Most Go installations use a release branch, but new changes should |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 219 | only be made based on the master branch. |
| 220 | (They may be applied later to a release branch as part of the release process, |
| 221 | but most contributors won't do this themselves.) |
| 222 | Before making a change, make sure you start on the master branch: |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 223 | </p> |
| 224 | |
| 225 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 226 | $ git checkout master |
| 227 | $ git sync |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 228 | </pre> |
| 229 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 230 | <p> |
| 231 | (In Git terms, <code>git</code> <code>sync</code> runs |
| 232 | <code>git</code> <code>pull</code> <code>-r</code>.) |
| 233 | </p> |
| 234 | |
Russ Cox | 9ad14c9 | 2009-11-06 10:33:46 -0800 | [diff] [blame] | 235 | <h3>Make a change</h3> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 236 | |
| 237 | <p> |
| 238 | The entire checked-out tree is writable. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 239 | Once you have edited files, you must tell Git that they have been modified. |
| 240 | You must also tell Git about any files that are added, removed, or renamed files. |
| 241 | These operations are done with the usual Git commands, |
| 242 | <code>git</code> <code>add</code>, |
| 243 | <code>git</code> <code>rm</code>, |
| 244 | and |
| 245 | <code>git</code> <code>mv</code>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 246 | </p> |
| 247 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 248 | <p> |
| 249 | If you wish to checkpoint your work, or are ready to send the code out for review, run</p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 250 | |
| 251 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 252 | $ git change <i><branch></i> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 253 | </pre> |
| 254 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 255 | <p> |
| 256 | from any directory in your Go repository to commit the changes so far. |
| 257 | The name <i><branch></i> is an arbitrary one you choose to identify the |
| 258 | local branch containing your changes. |
| 259 | </p> |
| 260 | |
| 261 | <p> |
| 262 | (In Git terms, <code>git</code> <code>change</code> <code><branch></code> |
| 263 | runs <code>git</code> <code>checkout</code> <code>-b</code> <code>branch</code>, |
| 264 | then <code>git</code> <code>branch</code> <code>--set-upstream-to</code> <code>origin/master</code>, |
| 265 | then <code>git</code> <code>commit</code>.) |
| 266 | </p> |
| 267 | |
| 268 | <p> |
| 269 | Git will open a change description file in your editor. |
| 270 | (It uses the editor named by the <code>$EDITOR</code> environment variable, |
| 271 | <code>vi</code> by default.) |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 272 | The file will look like: |
| 273 | </p> |
| 274 | |
| 275 | <pre> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 276 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 277 | # Please enter the commit message for your changes. Lines starting |
| 278 | # with '#' will be ignored, and an empty message aborts the commit. |
| 279 | # On branch foo |
| 280 | # Changes not staged for commit: |
| 281 | # modified: editedfile.go |
| 282 | # |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 283 | </pre> |
| 284 | |
| 285 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 286 | At the beginning of this file is a blank line; replace it |
| 287 | with a thorough description of your change. |
Nigel Tao | 3f38342 | 2011-01-05 13:00:08 +1100 | [diff] [blame] | 288 | The first line of the change description is conventionally a one-line |
| 289 | summary of the change, prefixed by the primary affected package, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 290 | and is used as the subject for code review mail. |
| 291 | The rest of the |
| 292 | description elaborates and should provide context for the |
| 293 | change and explain what it does. |
| 294 | If there is a helpful reference, mention it here. |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 295 | </p> |
| 296 | |
| 297 | <p> |
| 298 | After editing, the template might now read: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 299 | </p> |
| 300 | |
| 301 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 302 | math: improved Sin, Cos and Tan precision for very large arguments |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 303 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 304 | The existing implementation has poor numerical properties for |
| 305 | large arguments, so use the McGillicutty algorithm to improve |
| 306 | accuracy above 1e10. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 307 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 308 | The algorithm is described at http://wikipedia.org/wiki/McGillicutty_Algorithm |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 309 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 310 | Fixes #159 |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 311 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 312 | # Please enter the commit message for your changes. Lines starting |
| 313 | # with '#' will be ignored, and an empty message aborts the commit. |
| 314 | # On branch foo |
| 315 | # Changes not staged for commit: |
| 316 | # modified: editedfile.go |
| 317 | # |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 318 | </pre> |
| 319 | |
| 320 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 321 | The commented section of the file lists all the modified files in your client. |
| 322 | It is best to keep unrelated changes in different change lists, |
| 323 | so if you see a file listed that should not be included, abort |
| 324 | the command and move that file to a different branch. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 325 | </p> |
| 326 | |
| 327 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 328 | The special notation "Fixes #159" associates the change with issue 159 in the |
| 329 | <a href="https://golang.org/issue/159">Go issue tracker</a>. |
| 330 | When this change is eventually submitted, the issue |
| 331 | tracker will automatically mark the issue as fixed. |
| 332 | (There are several such conventions, described in detail in the |
| 333 | <a href="https://help.github.com/articles/closing-issues-via-commit-messages/">GitHub Issue Tracker documentation</a>.) |
| 334 | </p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 335 | |
| 336 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 337 | Once you have finished writing the commit message, |
| 338 | save the file and exit the editor. |
| 339 | </p> |
| 340 | |
| 341 | <p> |
| 342 | If you wish to do more editing, re-stage your changes using |
| 343 | <code>git</code> <code>add</code>, and then run |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 344 | </p> |
| 345 | |
| 346 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 347 | $ git change |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 348 | </pre> |
| 349 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 350 | <p> |
| 351 | to update the change description and incorporate the staged changes. The |
| 352 | change description contains a <code>Change-Id</code> line near the bottom, |
| 353 | added by a Git commit hook during the initial |
| 354 | <code>git</code> <code>change</code>. |
| 355 | That line is used by Gerrit to match successive uploads of the same change. |
| 356 | Do not edit or delete it. |
| 357 | </p> |
| 358 | |
| 359 | <p> |
| 360 | (In Git terms, <code>git</code> <code>change</code> with no branch name |
| 361 | runs <code>git</code> <code>commit</code> <code>--amend</code>.) |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 362 | </p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 363 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 364 | <h3>Mail the change for review</h3> |
| 365 | |
| 366 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 367 | Once the change is ready, mail it out for review: |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 368 | </p> |
| 369 | |
| 370 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 371 | $ git mail |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 372 | </pre> |
| 373 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 374 | <p> |
| 375 | You can specify a reviewer or CC interested parties |
| 376 | using the <code>-r</code> or <code>-cc</code> options. |
| 377 | Both accept a comma-separated list of email addresses: |
| 378 | </p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 379 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 380 | <pre> |
| 381 | $ git mail -r joe@golang.org -cc mabel@example.com,math-nuts@swtch.com |
| 382 | </pre> |
| 383 | |
| 384 | <p> |
| 385 | Unless explicitly told otherwise, such as in the discussion leading |
| 386 | up to sending in the change list, it's better not to specify a reviewer. |
| 387 | All changes are automatically CC'ed to the |
| 388 | <a href="https://groups.google.com/group/golang-codereviews">golang-codereviews@googlegroups.com</a> |
| 389 | mailing list. |
| 390 | </p> |
| 391 | |
| 392 | <p> |
| 393 | (In Git terms, <code>git</code> <code>mail</code> pushes the local committed |
| 394 | changes to Gerrit using <code>git</code> <code>push</code> <code>origin</code> |
| 395 | <code>HEAD:refs/for/master</code>.) |
| 396 | </p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 397 | |
| 398 | <p> |
| 399 | If your change relates to an open issue, please add a comment to the issue |
| 400 | announcing your proposed fix, including a link to your CL. |
| 401 | </p> |
| 402 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 403 | <p> |
| 404 | The code review server assigns your change an issue number and URL, |
| 405 | which <code>git</code> <code>mail</code> will print, something like: |
| 406 | </p> |
| 407 | |
| 408 | <pre> |
| 409 | remote: New Changes: |
| 410 | remote: https://go-review.googlesource.com/99999 math: improved Sin, Cos and Tan precision for very large arguments |
| 411 | </pre> |
| 412 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 413 | <h3>Reviewing code</h3> |
| 414 | |
| 415 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 416 | Running <code>git</code> <code>mail</code> will send an email to you and the |
| 417 | reviewers asking them to visit the issue's URL and make comments on the change. |
| 418 | When done, the reviewer adds comments through the Gerrit user interface |
| 419 | and clicks "Reply" to send comments back. |
| 420 | You will receive a mail notification when this happens. |
| 421 | You must reply through the web interface. |
| 422 | (Unlike with the old Rietveld review system, replying by mail has no effect.) |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 423 | </p> |
| 424 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 425 | <h3>Revise and upload</h3> |
| 426 | |
| 427 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 428 | You must respond to review comments through the web interface. |
| 429 | (Unlike with the old Rietveld review system, responding by mail has no effect.) |
| 430 | </p> |
| 431 | |
| 432 | <p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 433 | When you have revised the code and are ready for another round of review, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 434 | stage those changes and use <code>git</code> <code>change</code> to update the |
| 435 | commit. |
| 436 | To send the update change list for another round of review, |
| 437 | run <code>git</code> <code>mail</code> again. |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 438 | </p> |
| 439 | |
| 440 | <p> |
| 441 | The reviewer can comment on the new copy, and the process repeats. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 442 | The reviewer approves the change by giving it a positive score |
| 443 | (+1 or +2) and replying <code>LGTM</code>: looks good to me. |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 444 | </p> |
| 445 | |
| 446 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 447 | You can see a list of your pending changes by running <code>git</code> |
| 448 | <code>pending</code>, and switch between change branches with <code>git</code> |
| 449 | <code>change</code> <code><i><branch></i></code>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 450 | </p> |
| 451 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 452 | <h3>Synchronize your client</h3> |
| 453 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 454 | <p> |
| 455 | While you were working, others might have submitted changes to the repository. |
| 456 | To update your local branch, run |
| 457 | </p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 458 | |
| 459 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 460 | $ git sync |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 461 | </pre> |
| 462 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 463 | <p> |
Oling Cat | ce36552 | 2014-12-14 14:32:56 +0800 | [diff] [blame] | 464 | (In git terms, <code>git</code> <code>sync</code> runs |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 465 | <code>git</code> <code>pull</code> <code>-r</code>.) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 466 | </p> |
| 467 | |
| 468 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 469 | If files you were editing have changed, Git does its best to merge the |
| 470 | remote changes into your local changes. |
| 471 | It may leave some files to merge by hand. |
| 472 | </p> |
| 473 | |
| 474 | <p> |
| 475 | For example, suppose you have edited <code>sin.go</code> but |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 476 | someone else has committed an independent change. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 477 | When you run <code>git</code> <code>sync</code>, |
| 478 | you will get the (scary-looking) output: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 479 | |
| 480 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 481 | $ git sync |
| 482 | Failed to merge in the changes. |
| 483 | Patch failed at 0023 math: improved Sin, Cos and Tan precision for very large arguments |
| 484 | The copy of the patch that failed is found in: |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 485 | /home/you/repo/.git/rebase-apply/patch |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 486 | |
| 487 | When you have resolved this problem, run "git rebase --continue". |
| 488 | If you prefer to skip this patch, run "git rebase --skip" instead. |
| 489 | To check out the original branch and stop rebasing, run "git rebase --abort". |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 490 | </pre> |
| 491 | |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 492 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 493 | If this happens, run |
| 494 | </p> |
| 495 | |
| 496 | <pre> |
| 497 | $ git status |
| 498 | </pre> |
| 499 | |
| 500 | <p> |
| 501 | to see which files failed to merge. |
| 502 | The output will look something like this: |
| 503 | </p> |
| 504 | |
| 505 | <pre> |
| 506 | rebase in progress; onto a24c3eb |
| 507 | You are currently rebasing branch 'mcgillicutty' on 'a24c3eb'. |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 508 | (fix conflicts and then run "git rebase --continue") |
| 509 | (use "git rebase --skip" to skip this patch) |
| 510 | (use "git rebase --abort" to check out the original branch) |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 511 | |
| 512 | Unmerged paths: |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 513 | (use "git reset HEAD <file>..." to unstage) |
| 514 | (use "git add <file>..." to mark resolution) |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 515 | |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 516 | <i>both modified: sin.go</i> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 517 | </pre> |
| 518 | |
| 519 | <p> |
| 520 | The only important part in that transcript is the italicized "both modified" |
| 521 | line: Git failed to merge your changes with the conflicting change. |
| 522 | When this happens, Git leaves both sets of edits in the file, |
| 523 | with conflicts marked by <code><<<<<<<</code> and |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 524 | <code>>>>>>>></code>. |
Tetsuo Kiso | 48347cc | 2014-07-07 16:31:20 +1000 | [diff] [blame] | 525 | It is now your job to edit the file to combine them. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 526 | Continuing the example, searching for those strings in <code>sin.go</code> |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 527 | might turn up: |
| 528 | </p> |
| 529 | |
| 530 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 531 | arg = scale(arg) |
| 532 | <<<<<<< HEAD |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 533 | if arg < 1e9 { |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 534 | ======= |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 535 | if arg &lh; 1e10 { |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 536 | >>>>>>> mcgillicutty |
| 537 | largeReduce(arg) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 538 | </pre> |
| 539 | |
| 540 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 541 | Git doesn't show it, but suppose the original text that both edits |
| 542 | started with was 1e8; you changed it to 1e10 and the other change to 1e9, |
| 543 | so the correct answer might now be 1e10. First, edit the section |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 544 | to remove the markers and leave the correct code: |
| 545 | </p> |
| 546 | |
| 547 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 548 | arg = scale(arg) |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 549 | if arg < 1e10 { |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 550 | largeReduce(arg) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 551 | </pre> |
| 552 | |
| 553 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 554 | Then tell Git that the conflict is resolved by running |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 555 | </p> |
| 556 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 557 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 558 | $ git add sin.go |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 559 | </pre> |
| 560 | |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 561 | <p> |
Russ Cox | 830813f | 2009-11-08 21:08:27 -0800 | [diff] [blame] | 562 | If you had been editing the file, say for debugging, but do not |
| 563 | care to preserve your changes, you can run |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 564 | <code>git</code> <code>reset</code> <code>HEAD</code> <code>sin.go</code> |
| 565 | to abandon your changes. |
| 566 | Then run <code>git</code> <code>rebase</code> <code>--continue</code> to |
| 567 | restore the change commit. |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 568 | </p> |
| 569 | |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 570 | <h3>Reviewing code by others</h3> |
| 571 | |
| 572 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 573 | You can import a change proposed by someone else into your local Git repository. |
| 574 | On the Gerrit review page, click the "Download ▼" link in the upper right |
| 575 | corner, copy the "Checkout" command and run it from your local Git repo. |
| 576 | It should look something like this: |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 577 | </p> |
| 578 | |
| 579 | <pre> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 580 | $ git fetch https://go.googlesource.com/review refs/changes/21/1221/1 && git checkout FETCH_HEAD |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 581 | </pre> |
| 582 | |
| 583 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 584 | To revert, change back to the branch you were working in. |
Oling Cat | aecbcd0 | 2013-02-15 14:01:12 +1100 | [diff] [blame] | 585 | </p> |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 586 | |
Russ Cox | 5facb84 | 2009-12-09 14:39:41 -0800 | [diff] [blame] | 587 | <h3>Submit the change after the review</h3> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 588 | |
| 589 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 590 | After the code has been <code>LGTM</code>'ed, an approver may |
| 591 | submit it to the master branch using the Gerrit UI. |
| 592 | There is a "Submit" button on the web page for the change |
| 593 | that appears once the change is approved (marked +2). |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 594 | </p> |
| 595 | |
| 596 | <p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 597 | This checks the change into the repository. |
| 598 | The change description will include a link to the code review, |
| 599 | and the code review will be updated with a link to the change |
| 600 | in the repository. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 601 | Since the method used to integrate the changes is "Cherry Pick", |
| 602 | the commit hashes in the repository will be changed by |
| 603 | the submit operation. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 604 | </p> |
| 605 | |
Robert Hencke | 75ba181 | 2014-04-25 20:09:04 -0700 | [diff] [blame] | 606 | <h3>More information</h3> |
| 607 | |
| 608 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 609 | In addition to the information here, the Go community maintains a <a href="https://golang.org/wiki/CodeReview">CodeReview</a> wiki page. |
Robert Hencke | 75ba181 | 2014-04-25 20:09:04 -0700 | [diff] [blame] | 610 | Feel free to contribute to this page as you learn the review process. |
| 611 | </p> |
| 612 | |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 613 | <h2 id="copyright">Copyright</h2> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 614 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 615 | <p>Files in the Go repository don't list author names, |
| 616 | both to avoid clutter and to avoid having to keep the lists up to date. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 617 | Instead, your name will appear in the |
| 618 | <a href="https://golang.org/change">change log</a> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 619 | and in the <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file |
| 620 | and perhaps the <a href="/AUTHORS"><code>AUTHORS</code></a> file. |
| 621 | </p> |
| 622 | |
| 623 | <p>The <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file |
| 624 | defines who the Go contributors—the people—are; |
Caleb Spare | 41f32e0 | 2013-01-06 22:44:16 -0500 | [diff] [blame] | 625 | the <a href="/AUTHORS"><code>AUTHORS</code></a> file defines |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 626 | who “The Go Authors”—the copyright holders—are. |
Dmitry Savintsev | 30ab39a | 2015-06-09 12:01:38 +0200 | [diff] [blame] | 627 | These files will be periodically updated based on the commit logs. |
| 628 | |
| 629 | <p>Gerrit serves as the gatekeeper and uses your e-mail address as the key. |
| 630 | To send your first change to the Go project from a given address, |
| 631 | you must have completed one of the contributor license agreements: |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 632 | <ul> |
| 633 | <li> |
Brad Fitzpatrick | 967901a | 2014-03-05 14:09:03 -0800 | [diff] [blame] | 634 | If you are the copyright holder, you will need to agree to the |
| 635 | <a href="https://developers.google.com/open-source/cla/individual">individual |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 636 | contributor license agreement</a>, which can be completed online. |
| 637 | </li> |
| 638 | <li> |
| 639 | If your organization is the copyright holder, the organization |
Brad Fitzpatrick | 967901a | 2014-03-05 14:09:03 -0800 | [diff] [blame] | 640 | will need to agree to the |
| 641 | <a href="https://developers.google.com/open-source/cla/corporate">corporate |
| 642 | contributor license agreement</a>. |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 643 | (If the copyright holder for your code has already completed the |
| 644 | agreement in connection with another Google open source project, |
| 645 | it does not need to be completed again.) |
| 646 | </li> |
| 647 | </ul> |
| 648 | |
| 649 | <p> |
| 650 | This rigmarole needs to be done only for your first submission. |
| 651 | </p> |
| 652 | |
| 653 | <p>Code that you contribute should use the standard copyright header:</p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 654 | |
| 655 | <pre> |
David Symonds | 6cb4033 | 2015-01-01 00:00:00 +1100 | [diff] [blame] | 656 | // Copyright 2015 The Go Authors. All rights reserved. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 657 | // Use of this source code is governed by a BSD-style |
| 658 | // license that can be found in the LICENSE file. |
| 659 | </pre> |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 660 | |
| 661 | <p> |
| 662 | Files in the repository are copyright the year they are added. It is not |
| 663 | necessary to update the copyright year on files that you change. |
| 664 | </p> |