Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 <!-- Weekly Snapshot History --> | 1 <!-- Weekly Snapshot History --> |
2 | 2 |
3 <p>This page summarizes the changes between tagged weekly snapshots of Go. | 3 <p>This page summarizes the changes between tagged weekly snapshots of Go. |
4 For full details, see the <a href="http://code.google.com/p/go/source/list">Merc urial change log</a>.</p> | 4 For full details, see the <a href="http://code.google.com/p/go/source/list">Merc urial change log</a>.</p> |
5 | 5 |
6 <p>Weekly snapshots occur often and may not be stable. | 6 <p>Weekly snapshots occur often and may not be stable. |
7 If stability of API and code is more important than having the | 7 If stability of API and code is more important than having the |
8 latest features, use the <a href="release.html">official releases</a> instead.</ p> | 8 latest features, use the <a href="release.html">official releases</a> instead.</ p> |
9 | 9 |
10 <p>To update to a specific snapshot, use:</p> | 10 <p>To update to a specific snapshot, use:</p> |
11 | 11 |
12 <pre> | 12 <pre> |
13 hg pull | 13 hg pull |
14 hg update weekly.<i>YYYY-MM-DD</i> | 14 hg update weekly.<i>YYYY-MM-DD</i> |
15 </pre> | 15 </pre> |
16 | 16 |
17 <h2 id="2011-12-01">2011-12-01</h2> | 17 <h2 id="2011-12-01">2011-12-01</h2> |
18 | 18 |
19 <pre> | 19 <pre> |
20 This weekly snapshot includes significant, related API changes in | 20 This weekly snapshot includes changes to the time, os, and text/template |
21 package time and package os and changes to package text/template. | 21 packages. The changes to the time and os packages are significant and related. |
r
2011/12/01 03:51:45
very hard to parse.
adg
2011/12/01 04:06:13
Rewritten.
| |
22 Code that uses package time, package text/template, or package os's FileInfo | |
23 type will require changes. | |
22 | 24 |
23 In package time, there is now one type - time.Time - to represent times. | 25 In package time, there is now one type - time.Time - to represent times. |
24 Note that time.Time should be used as a value, in contrast to old code | 26 Note that time.Time should be used as a value, in contrast to old code |
25 which typically used a *time.Time, a pointer to a large struct. (Drop the *.) | 27 which typically used a *time.Time, a pointer to a large struct. (Drop the *.) |
26 Any function that previously accepted a *time.Time, an int64 | 28 Any function that previously accepted a *time.Time, an int64 |
27 number of seconds since 1970, or an int64 number of nanoseconds | 29 number of seconds since 1970, or an int64 number of nanoseconds |
28 since 1970 should now accept a time.Time. Especially as a replacement | 30 since 1970 should now accept a time.Time. Especially as a replacement |
29 for the int64s, the type is good documentation about the meaning of | 31 for the int64s, the type is good documentation about the meaning of |
30 its value. | 32 its value. |
31 | 33 |
(...skipping 22 matching lines...) Expand all Loading... | |
54 counts (but not since 1970). | 56 counts (but not since 1970). |
55 | 57 |
56 Gofix can do the above conversions and some others, but it does not | 58 Gofix can do the above conversions and some others, but it does not |
57 rewrite explicit int64 types as time.Time. It is very likely that you will | 59 rewrite explicit int64 types as time.Time. It is very likely that you will |
58 need to edit your program to change these types after running gofix. | 60 need to edit your program to change these types after running gofix. |
59 As always, be sure to read the changes that gofix makes using your | 61 As always, be sure to read the changes that gofix makes using your |
60 version control system's diff feature. | 62 version control system's diff feature. |
61 | 63 |
62 See http://weekly.golang.org/pkg/time/ for details. | 64 See http://weekly.golang.org/pkg/time/ for details. |
63 | 65 |
64 | |
65 In package os, the FileInfo struct is replaced by a FileInfo interface, | 66 In package os, the FileInfo struct is replaced by a FileInfo interface, |
66 admitting implementations by code beyond the operating system. | 67 admitting implementations by code beyond the operating system. |
67 Code that refers to *os.FileInfo (a pointer to the old struct) should | 68 Code that refers to *os.FileInfo (a pointer to the old struct) should |
68 instead refer to os.FileInfo (the new interface). | 69 instead refer to os.FileInfo (the new interface). |
69 The interface has just a few methods: | 70 The interface has just a few methods: |
70 | 71 |
71 type FileInfo interface { | 72 type FileInfo interface { |
72 Name() string // base name of the file | 73 Name() string // base name of the file |
73 Size() int64 // length in bytes | 74 Size() int64 // length in bytes |
74 Mode() FileMode // file mode bits | 75 Mode() FileMode // file mode bits |
75 ModTime() time.Time // modification time | 76 ModTime() time.Time // modification time |
76 IsDir() bool // abbreviation for Mode().IsDir() | 77 IsDir() bool // abbreviation for Mode().IsDir() |
77 } | 78 } |
78 | 79 |
79 If you need access to the underlying stat_t provided by the operating | 80 If you need access to the underlying stat_t provided by the operating |
80 system kernel, you can access it by assuming that the FileInfo you are | 81 system kernel, you can access it by assuming that the FileInfo you are |
81 holding is actually an *os.FileStat, and that it's Sys field is actually a | 82 holding is actually an *os.FileStat, and that it's Sys field is actually a |
82 *syscall.Stat_t, as in: | 83 *syscall.Stat_t, as in: |
83 | 84 |
84 dev := fi.(*os.FileStat).Sys.(*syscall.Stat_t).Dev | 85 dev := fi.(*os.FileStat).Sys.(*syscall.Stat_t).Dev |
85 | 86 |
86 Of course, this is not necessarily portable across different operating | 87 Of course, this is not necessarily portable across different operating |
87 systems. | 88 systems. |
88 | 89 |
89 Gofix will take care of rewriting *os.FileInfo to os.FileInfo for you, | 90 Gofix will take care of rewriting *os.FileInfo to os.FileInfo for you, |
90 and it will also rewrite expressions like fi.Name into calls like fi.Name(). | 91 and it will also rewrite expressions like fi.Name into calls like fi.Name(). |
91 | 92 |
92 See http://weekly.golang.org/pkg/os/#FileInfo for details. | 93 See http://weekly.golang.org/pkg/os/#FileInfo for details. |
93 | 94 |
94 | |
95 The template package has been changed to export a new, simpler API. | 95 The template package has been changed to export a new, simpler API. |
96 The Set type is gone. Instead, templates are automatically associated by | 96 The Set type is gone. Instead, templates are automatically associated by |
97 being parsed together; nested definitions implicitly create associations. | 97 being parsed together; nested definitions implicitly create associations. |
98 Only associated templates can invoke one another. | 98 Only associated templates can invoke one another. |
99 This approach dramatically reduces the breadth of the construction API. | 99 This approach dramatically reduces the breadth of the construction API. |
100 THe html/template package has been updated also. | 100 The html/template package has been updated also. |
r
2011/12/01 03:51:45
s/H/h/
there's a gofix for the simplest and most
adg
2011/12/01 04:06:13
Done.
| |
101 There's a gofix for the simplest and most common uses of the old API. | |
102 Code that doesn't mention the Set type is likely to work after running gofix; | |
103 code that uses Set will need to be updated by hand. | |
104 The template definition language itself is unchanged. | |
101 | 105 |
102 See http://weekly.golang.org/pkg/text/template/ for details. | 106 See http://weekly.golang.org/pkg/text/template/ for details. |
103 | 107 |
104 | 108 |
105 Other changes: | 109 Other changes: |
106 * cgo: add support for callbacks from dynamic libraries. | 110 * cgo: add support for callbacks from dynamic libraries. |
107 * codereview: gofmt check for non-src/ files (thanks David Crawshaw). | 111 * codereview: gofmt check for non-src/ files (thanks David Crawshaw). |
108 * crypto/openpgp/packet: fix private key checksum. | 112 * crypto/openpgp/packet: fix private key checksum. |
109 * crypto/tls: add openbsd root certificate location, | 113 * crypto/tls: add openbsd root certificate location, |
110 don't rely on map iteration order. | 114 don't rely on map iteration order. |
111 * crypto/x509, crypto/tls: support PKCS#8 private keys. | 115 * crypto/x509, crypto/tls: support PKCS#8 private keys. |
112 * dashboard: start a Go implementation of the App Engine app. | 116 * dashboard: start of reimplementation in Go for App Engine. |
r
2011/12/01 03:51:45
unclear and don't say app twice
start of reimplem
adg
2011/12/01 04:06:13
Done.
| |
113 * encoding/xml: fix copy bug. | 117 * encoding/xml: fix copy bug. |
114 * exp/gui: move exp/gui and exp/gui/x11 to http://code.google.com/p/x-go-binding | 118 * exp/gui: move exp/gui and exp/gui/x11 to http://code.google.com/p/x-go-binding |
115 * exp/ssh: various improvements (thanks Dave Cheney and Gustav Paul). | 119 * exp/ssh: various improvements (thanks Dave Cheney and Gustav Paul). |
116 * filepath/path: fix Rel buffer sizing (thanks Gustavo Niemeyer). | 120 * filepath/path: fix Rel buffer sizing (thanks Gustavo Niemeyer). |
117 * gc: fix Nconv bug (thanks Rémy Oudompheng) and other fixes. | 121 * gc: fix Nconv bug (thanks Rémy Oudompheng) and other fixes. |
118 * go/printer, gofmt: performance improvements. | 122 * go/printer, gofmt: performance improvements. |
119 * gofix: test and fix missorted renames. | 123 * gofix: test and fix missorted renames. |
120 * goinstall: add -fix flag to run gofix on packages on build failure, | 124 * goinstall: add -fix flag to run gofix on packages on build failure, |
121 better error reporting, | 125 better error reporting, |
122 don't hit network unless a checkout or update is required, | 126 don't hit network unless a checkout or update is required, |
(...skipping 4598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4721 global channel lock is gone.· | 4725 global channel lock is gone.· |
4722 * sync: RWMutex now allows concurrent readers (thanks Péter Szabó)· | 4726 * sync: RWMutex now allows concurrent readers (thanks Péter Szabó)· |
4723 * template: can use maps as data (thanks James Meneghello)· | 4727 * template: can use maps as data (thanks James Meneghello)· |
4724 * unicode: updated to Unicode 5.2.· | 4728 * unicode: updated to Unicode 5.2.· |
4725 * websocket: new package (thanks Fumitoshi Ukai)· | 4729 * websocket: new package (thanks Fumitoshi Ukai)· |
4726 * xgb: preliminary X Go Bindings (thanks Tor Andersson)· | 4730 * xgb: preliminary X Go Bindings (thanks Tor Andersson)· |
4727 * xml: fixed crash (thanks Vish Subramanian)· | 4731 * xml: fixed crash (thanks Vish Subramanian)· |
4728 * misc: bbedit config (thanks Anthony Starks),· | 4732 * misc: bbedit config (thanks Anthony Starks),· |
4729 kate config (thanks Evan Shaw)· | 4733 kate config (thanks Evan Shaw)· |
4730 </pre> | 4734 </pre> |
LEFT | RIGHT |