OLD | NEW |
1 <!--{ | 1 <!--{ |
2 "Title": "Effective Go", | 2 "Title": "Effective Go", |
3 "Template": true | 3 "Template": true |
4 }--> | 4 }--> |
5 | 5 |
6 <h2 id="introduction">Introduction</h2> | 6 <h2 id="introduction">Introduction</h2> |
7 | 7 |
8 <p> | 8 <p> |
9 Go is a new language. Although it borrows ideas from | 9 Go is a new language. Although it borrows ideas from |
10 existing languages, | 10 existing languages, |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 a common use of <code>init</code> functions is to verify or repair | 1767 a common use of <code>init</code> functions is to verify or repair |
1768 correctness of the program state before real execution begins. | 1768 correctness of the program state before real execution begins. |
1769 </p> | 1769 </p> |
1770 | 1770 |
1771 <pre> | 1771 <pre> |
1772 func init() { | 1772 func init() { |
1773 if USER == "" { | 1773 if USER == "" { |
1774 log.Fatal("$USER not set") | 1774 log.Fatal("$USER not set") |
1775 } | 1775 } |
1776 if HOME == "" { | 1776 if HOME == "" { |
1777 HOME = "/usr/" + USER | 1777 HOME = "/home/" + USER |
1778 } | 1778 } |
1779 if GOROOT == "" { | 1779 if GOROOT == "" { |
1780 GOROOT = HOME + "/go" | 1780 GOROOT = HOME + "/go" |
1781 } | 1781 } |
1782 // GOROOT may be overridden by --goroot flag on command line. | 1782 // GOROOT may be overridden by --goroot flag on command line. |
1783 flag.StringVar(&GOROOT, "goroot", GOROOT, "Go root directory") | 1783 flag.StringVar(&GOROOT, "goroot", GOROOT, "Go root directory") |
1784 } | 1784 } |
1785 </pre> | 1785 </pre> |
1786 | 1786 |
1787 <h2 id="methods">Methods</h2> | 1787 <h2 id="methods">Methods</h2> |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3040 <pre> | 3040 <pre> |
3041 verifying implementation | 3041 verifying implementation |
3042 type Color uint32 | 3042 type Color uint32 |
3043 | 3043 |
3044 // Check that Color implements image.Color and image.Image | 3044 // Check that Color implements image.Color and image.Image |
3045 var _ image.Color = Black | 3045 var _ image.Color = Black |
3046 var _ image.Image = Black | 3046 var _ image.Image = Black |
3047 </pre> | 3047 </pre> |
3048 --> | 3048 --> |
3049 | 3049 |
OLD | NEW |