OLD | NEW |
1 <!-- Contributing to the Go project --> | 1 <!-- Contributing to the Go project --> |
2 | 2 |
3 <h2 id="Introduction">Introduction</h2> | 3 <h2 id="Introduction">Introduction</h2> |
4 | 4 |
5 <p> | 5 <p> |
6 This document explains how to write a new package, | 6 This document explains how to write a new package, |
7 how to test code, and how to contribute changes to the Go project. | 7 how to test code, and how to contribute changes to the Go project. |
8 It assumes you have installed Go using the | 8 It assumes you have installed Go using the |
9 <a href="install.html">installation instructions</a>. (Note that | 9 <a href="install.html">installation instructions</a>. (Note that |
10 the <code>gccgo</code> frontend lives elsewhere; | 10 the <code>gccgo</code> frontend lives elsewhere; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 <p> | 57 <p> |
58 It would be nice to have Go-specific tools that | 58 It would be nice to have Go-specific tools that |
59 inspect the source files to determine what to build and in | 59 inspect the source files to determine what to build and in |
60 what order, but for now, Go uses GNU <code>make</code>. | 60 what order, but for now, Go uses GNU <code>make</code>. |
61 Thus, the first file to create in a new package directory is | 61 Thus, the first file to create in a new package directory is |
62 usually the <code>Makefile</code>. | 62 usually the <code>Makefile</code>. |
63 The basic form is illustrated by <a href="../src/pkg/container/vector/Makefile">
<code>src/pkg/container/vector/Makefile</code></a>: | 63 The basic form is illustrated by <a href="../src/pkg/container/vector/Makefile">
<code>src/pkg/container/vector/Makefile</code></a>: |
64 </p> | 64 </p> |
65 | 65 |
66 <pre> | 66 <pre> |
67 include $(GOROOT)/src/Make.$(GOARCH) | 67 include ../../../Make.$(GOARCH) |
68 | 68 |
69 TARG=container/vector | 69 TARG=container/vector |
70 GOFILES=\ | 70 GOFILES=\ |
71 intvector.go\ | 71 intvector.go\ |
72 stringvector.go\ | 72 stringvector.go\ |
73 vector.go\ | 73 vector.go\ |
74 | 74 |
75 include $(GOROOT)/src/Make.pkg | 75 include ../../../Make.pkg |
76 </pre> | 76 </pre> |
77 | 77 |
78 <p> | 78 <p> |
79 The first and last lines <code>include</code> standard definitions and rules, | 79 The first and last lines <code>include</code> standard definitions and rules, |
| 80 <code>$(GOROOT)/src/Make.$(GOARCH)</code> and <code>$(GOROOT)/src/Make.pkg</code
>, |
80 so that the body of the <code>Makefile</code> need only specify two variables. | 81 so that the body of the <code>Makefile</code> need only specify two variables. |
| 82 For packages to be installed in the Go tree, use a relative path instead of |
| 83 <code>$(GOROOT)/src</code>, so that make will work correctly even if <code>$(GOR
OOT)</code> contains spaces. |
81 </p> | 84 </p> |
82 | 85 |
83 <p> | 86 <p> |
84 <code>TARG</code> is the target install path for the package, | 87 <code>TARG</code> is the target install path for the package, |
85 the string that clients will use to import it. | 88 the string that clients will use to import it. |
86 This string should be the same as the directory | 89 This string should be the same as the directory |
87 in which the <code>Makefile</code> appears, with the | 90 in which the <code>Makefile</code> appears, with the |
88 <code>$GOROOT/src/pkg/</code> removed. | 91 <code>$GOROOT/src/pkg/</code> removed. |
89 </p> | 92 </p> |
90 | 93 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 codereview.appspot.com as the email address in these files.</ol> | 655 codereview.appspot.com as the email address in these files.</ol> |
653 <p> | 656 <p> |
654 This rigamarole needs to be done only for your first submission. | 657 This rigamarole needs to be done only for your first submission. |
655 </p> | 658 </p> |
656 | 659 |
657 <p> | 660 <p> |
658 Once the code is ready to be committed, | 661 Once the code is ready to be committed, |
659 one of the Go developers at Google will approve and submit | 662 one of the Go developers at Google will approve and submit |
660 your change. | 663 your change. |
661 </p> | 664 </p> |
OLD | NEW |