1 <!--{ 2 "Title": "Pre-Go 1 Release History" 3 }--> 4 5 <p> 6 This page summarizes the changes between stable releases of Go prior to Go 1. 7 See the <a href="release.html">Release History</a> page for notes on recent releases. 8 </p> 9 10 <h2 id="r60">r60 (released 2011/09/07)</h2> 11 12 <p> 13 The r60 release corresponds to 14 <code><a href="weekly.html#2011-08-17">weekly.2011-08-17</a></code>. 15 This section highlights the most significant changes in this release. 16 For a more detailed summary, see the 17 <a href="weekly.html#2011-08-17">weekly release notes</a>. 18 For complete information, see the 19 <a href="//code.google.com/p/go/source/list?r=release-branch.r60">Mercurial change list</a>. 20 </p> 21 22 <h3 id="r60.lang">Language</h3> 23 24 <p> 25 An "else" block is now required to have braces except if the body of the "else" 26 is another "if". Since gofmt always puts those braces in anyway, 27 gofmt-formatted programs will not be affected. 28 To fix other programs, run gofmt. 29 </p> 30 31 <h3 id="r60.pkg">Packages</h3> 32 33 <p> 34 <a href="/pkg/http/">Package http</a>'s URL parsing and query escaping code 35 (such as <code>ParseURL</code> and <code>URLEscape</code>) has been moved to 36 the new <a href="/pkg/url/">url package</a>, with several simplifications to 37 the names. Client code can be updated automatically with gofix. 38 </p> 39 40 <p> 41 <a href="/pkg/image/">Package image</a> has had significant changes made to the 42 <code>Pix</code> field of struct types such as 43 <a href="/pkg/image/#RGBA">image.RGBA</a> and 44 <a href="/pkg/image/#NRGBA">image.NRGBA</a>. 45 The <a href="/pkg/image/#Image">image.Image</a> interface type has not changed, 46 though, and you should not need to change your code if you don't explicitly 47 refer to <code>Pix</code> fields. For example, if you decode a number of images 48 using the <a href="/pkg/image/jpeg/">image/jpeg</a> package, compose them using 49 <a href="/pkg/image/draw/">image/draw</a>, and then encode the result using 50 <a href="/pkg/img/png">image/png</a>, then your code should still work as 51 before. 52 If your code <i>does</i> refer to <code>Pix</code> fields see the 53 <a href="/doc/devel/weekly.html#2011-07-19">weekly.2011-07-19</a> 54 snapshot notes for how to update your code. 55 </p> 56 57 <p> 58 <a href="/pkg/template/">Package template</a> has been replaced with a new 59 templating package (formerly <code>exp/template</code>). The original template 60 package is still available as <a href="/pkg/old/template/">old/template</a>. 61 The <code>old/template</code> package is deprecated and will be removed. 62 The Go tree has been updated to use the new template package. We encourage 63 users of the old template package to switch to the new one. Code that uses 64 <code>template</code> or <code>exp/template</code> will need to change its 65 import lines to <code>"old/template"</code> or <code>"template"</code>, 66 respectively. 67 </p> 68 69 <h3 id="r60.cmd">Tools</h3> 70 71 <p> 72 <a href="/cmd/goinstall/">Goinstall</a> now uses a new tag selection scheme. 73 When downloading or updating, goinstall looks for a tag or branch with the 74 <code>"go."</code> prefix that corresponds to the local Go version. For Go 75 <code>release.r58</code> it looks for <code>go.r58</code>. For 76 <code>weekly.2011-06-03</code> it looks for <code>go.weekly.2011-06-03</code>. 77 If the specific <code>go.X</code> tag or branch is not found, it chooses the 78 closest earlier version. If an appropriate tag or branch is found, goinstall 79 uses that version of the code. Otherwise it uses the default version selected 80 by the version control system. Library authors are encouraged to use the 81 appropriate tag or branch names in their repositories to make their libraries 82 more accessible. 83 </p> 84 85 <h3 id="r60.minor">Minor revisions</h3> 86 87 <p> 88 r60.1 includes a 89 <a href="//golang.org/change/1824581bf62d">linker 90 fix</a>, a pair of 91 <a href="//golang.org/change/9ef4429c2c64">goplay</a> 92 <a href="//golang.org/change/d42ed8c3098e">fixes</a>, 93 and a <code>json</code> package 94 <a href="//golang.org/change/d5e97874fe84">fix</a> and 95 a new 96 <a href="//golang.org/change/4f0e6269213f">struct tag 97 option</a>. 98 </p> 99 100 <p> 101 r60.2 102 <a href="//golang.org/change/ff19536042ac">fixes</a> 103 a memory leak involving maps. 104 </p> 105 106 <p> 107 r60.3 fixes a 108 <a href="//golang.org/change/01fa62f5e4e5">reflect bug</a>. 109 </p> 110 111 <h2 id="r59">r59 (released 2011/08/01)</h2> 112 113 <p> 114 The r59 release corresponds to 115 <code><a href="weekly.html#2011-07-07">weekly.2011-07-07</a></code>. 116 This section highlights the most significant changes in this release. 117 For a more detailed summary, see the 118 <a href="weekly.html#2011-07-07">weekly release notes</a>. 119 For complete information, see the 120 <a href="//code.google.com/p/go/source/list?r=release-branch.r59">Mercurial change list</a>. 121 </p> 122 123 <h3 id="r59.lang">Language</h3> 124 125 <p> 126 This release includes a language change that restricts the use of 127 <code>goto</code>. In essence, a <code>goto</code> statement outside a block 128 cannot jump to a label inside that block. Your code may require changes if it 129 uses <code>goto</code>. 130 See <a href="//golang.org/change/dc6d3cf9279d">this 131 changeset</a> for how the new rule affected the Go tree. 132 </p> 133 134 <h3 id="r59.pkg">Packages</h3> 135 136 <p> 137 As usual, <a href="/cmd/gofix/">gofix</a> will handle the bulk of the rewrites 138 necessary for these changes to package APIs. 139 </p> 140 141 <p> 142 <a href="/pkg/http">Package http</a> has a new 143 <a href="/pkg/http/#FileSystem">FileSystem</a> interface that provides access 144 to files. The <a href="/pkg/http/#FileServer">FileServer</a> helper now takes a 145 <code>FileSystem</code> argument instead of an explicit file system root. By 146 implementing your own <code>FileSystem</code> you can use the 147 <code>FileServer</code> to serve arbitrary data. 148 </p> 149 150 <p> 151 <a href="/pkg/os/">Package os</a>'s <code>ErrorString</code> type has been 152 hidden. Most uses of <code>os.ErrorString</code> can be replaced with 153 <a href="/pkg/os/#NewError">os.NewError</a>. 154 </p> 155 156 <p> 157 <a href="/pkg/reflect/">Package reflect</a> supports a new struct tag scheme 158 that enables sharing of struct tags between multiple packages. 159 In this scheme, the tags must be of the form: 160 </p> 161 <pre> 162 `key:"value" key2:"value2"` 163 </pre> 164 <p> 165 The <a href="/pkg/reflect/#StructField">StructField</a> type's Tag field now 166 has type <a href="/pkg/reflect/#StructTag">StructTag</a>, which has a 167 <code>Get</code> method. Clients of <a href="/pkg/json">json</a> and 168 <a href="/pkg/xml">xml</a> will need to be updated. Code that says 169 </p> 170 <pre> 171 type T struct { 172 X int "name" 173 } 174 </pre> 175 <p> 176 should become 177 </p> 178 <pre> 179 type T struct { 180 X int `json:"name"` // or `xml:"name"` 181 } 182 </pre> 183 <p> 184 Use <a href="/cmd/govet/">govet</a> to identify struct tags that need to be 185 changed to use the new syntax. 186 </p> 187 188 <p> 189 <a href="/pkg/sort/">Package sort</a>'s <code>IntArray</code> type has been 190 renamed to <a href="/pkg/sort/#IntSlice">IntSlice</a>, and similarly for 191 <a href="/pkg/sort/#Float64Slice">Float64Slice</a> and 192 <a href="/pkg/sort/#StringSlice">StringSlice</a>. 193 </p> 194 195 <p> 196 <a href="/pkg/strings/">Package strings</a>'s <code>Split</code> function has 197 itself been split into <a href="/pkg/strings/#Split">Split</a> and 198 <a href="/pkg/strings/#SplitN">SplitN</a>. 199 <code>SplitN</code> is the same as the old <code>Split</code>. 200 The new <code>Split</code> is equivalent to <code>SplitN</code> with a final 201 argument of -1. 202 </p> 203 204 <a href="/pkg/image/draw/">Package image/draw</a>'s 205 <a href="/pkg/image/draw/#Draw">Draw</a> function now takes an additional 206 argument, a compositing operator. 207 If in doubt, use <a href="/pkg/image/draw/#Op">draw.Over</a>. 208 </p> 209 210 <h3 id="r59.cmd">Tools</h3> 211 212 <p> 213 <a href="/cmd/goinstall/">Goinstall</a> now installs packages and commands from 214 arbitrary remote repositories (not just Google Code, Github, and so on). 215 See the <a href="/cmd/goinstall/">goinstall documentation</a> for details. 216 </p> 217 218 <h2 id="r58">r58 (released 2011/06/29)</h2> 219 220 <p> 221 The r58 release corresponds to 222 <code><a href="weekly.html#2011-06-09">weekly.2011-06-09</a></code> 223 with additional bug fixes. 224 This section highlights the most significant changes in this release. 225 For a more detailed summary, see the 226 <a href="weekly.html#2011-06-09">weekly release notes</a>. 227 For complete information, see the 228 <a href="//code.google.com/p/go/source/list?r=release-branch.r58">Mercurial change list</a>. 229 </p> 230 231 <h3 id="r58.lang">Language</h3> 232 233 <p> 234 This release fixes a <a href="//golang.org/change/b720749486e1">use of uninitialized memory in programs that misuse <code>goto</code></a>. 235 </p> 236 237 <h3 id="r58.pkg">Packages</h3> 238 239 <p> 240 As usual, <a href="/cmd/gofix/">gofix</a> will handle the bulk of the rewrites 241 necessary for these changes to package APIs. 242 </p> 243 244 <p> 245 <a href="/pkg/http/">Package http</a> drops the <code>finalURL</code> return 246 value from the <a href="/pkg/http/#Client.Get">Client.Get</a> method. The value 247 is now available via the new <code>Request</code> field on <a 248 href="/pkg/http/#Response">http.Response</a>. 249 Most instances of the type map[string][]string in have been 250 replaced with the new <a href="/pkg/http/#Values">Values</a> type. 251 </p> 252 253 <p> 254 <a href="/pkg/exec/">Package exec</a> has been redesigned with a more 255 convenient and succinct API. 256 </p> 257 258 <p> 259 <a href="/pkg/strconv/">Package strconv</a>'s <a href="/pkg/strconv/#Quote">Quote</a> 260 function now escapes only those Unicode code points not classified as printable 261 by <a href="/pkg/unicode/#IsPrint">unicode.IsPrint</a>. 262 Previously Quote would escape all non-ASCII characters. 263 This also affects the <a href="/pkg/fmt/">fmt</a> package's <code>"%q"</code> 264 formatting directive. The previous quoting behavior is still available via 265 strconv's new <a href="/pkg/strconv/#QuoteToASCII">QuoteToASCII</a> function. 266 </p> 267 268 <p> 269 <a href="/pkg/os/signal/">Package os/signal</a>'s 270 <a href="/pkg/os/#Signal">Signal</a> and 271 <a href="/pkg/os/#UnixSignal">UnixSignal</a> types have been moved to the 272 <a href="/pkg/os/">os</a> package. 273 </p> 274 275 <p> 276 <a href="/pkg/image/draw/">Package image/draw</a> is the new name for 277 <code>exp/draw</code>. The GUI-related code from <code>exp/draw</code> is now 278 located in the <a href="/pkg/exp/gui/">exp/gui</a> package. 279 </p> 280 281 <h3 id="r58.cmd">Tools</h3> 282 283 <p> 284 <a href="/cmd/goinstall/">Goinstall</a> now observes the GOPATH environment 285 variable to build and install your own code and external libraries outside of 286 the Go tree (and avoid writing Makefiles). 287 </p> 288 289 290 <h3 id="r58.minor">Minor revisions</h3> 291 292 <p>r58.1 adds 293 <a href="//golang.org/change/293c25943586">build</a> and 294 <a href="//golang.org/change/bf17e96b6582">runtime</a> 295 changes to make Go run on OS X 10.7 Lion. 296 </p> 297 298 <h2 id="r57">r57 (released 2011/05/03)</h2> 299 300 <p> 301 The r57 release corresponds to 302 <code><a href="weekly.html#2011-04-27">weekly.2011-04-27</a></code> 303 with additional bug fixes. 304 This section highlights the most significant changes in this release. 305 For a more detailed summary, see the 306 <a href="weekly.html#2011-04-27">weekly release notes</a>. 307 For complete information, see the 308 <a href="//code.google.com/p/go/source/list?r=release-branch.r57">Mercurial change list</a>. 309 </p> 310 311 <p>The new <a href="/cmd/gofix">gofix</a> tool finds Go programs that use old APIs and rewrites them to use 312 newer ones. After you update to a new Go release, gofix helps make the 313 necessary changes to your programs. Gofix will handle the http, os, and syscall 314 package changes described below, and we will update the program to keep up with 315 future changes to the libraries. 316 Gofix cant 317 handle all situations perfectly, so read and test the changes it makes before 318 committing them. 319 See <a href="//blog.golang.org/2011/04/introducing-gofix.html">the gofix blog post</a> for more 320 information.</p> 321 322 <h3 id="r57.lang">Language</h3> 323 324 <p> 325 <a href="/doc/go_spec.html#Receive_operator">Multiple assignment syntax</a> replaces the <code>closed</code> function. 326 The syntax for channel 327 receives allows an optional second assigned value, a boolean value 328 indicating whether the channel is closed. This code: 329 </p> 330 331 <pre> 332 v := <-ch 333 if closed(ch) { 334 // channel is closed 335 } 336 </pre> 337 338 <p>should now be written as:</p> 339 340 <pre> 341 v, ok := <-ch 342 if !ok { 343 // channel is closed 344 } 345 </pre> 346 347 <p><a href="/doc/go_spec.html#Label_scopes">Unused labels are now illegal</a>, just as unused local variables are.</p> 348 349 <h3 id="r57.pkg">Packages</h3> 350 351 <p> 352 <a href="/pkg/gob/">Package gob</a> will now encode and decode values of types that implement the 353 <a href="/pkg/gob/#GobEncoder">GobEncoder</a> and 354 <a href="/pkg/gob/#GobDecoder">GobDecoder</a> interfaces. This allows types with unexported 355 fields to transmit self-consistent descriptions; examples include 356 <a href="/pkg/big/#Int.GobDecode">big.Int</a> and <a href="/pkg/big/#Rat.GobDecode">big.Rat</a>. 357 </p> 358 359 <p> 360 <a href="/pkg/http/">Package http</a> has been redesigned. 361 For clients, there are new 362 <a href="/pkg/http/#Client">Client</a> and <a href="/pkg/http/#Transport">Transport</a> 363 abstractions that give more control over HTTP details such as headers sent 364 and redirections followed. These abstractions make it easy to implement 365 custom clients that add functionality such as <a href="//code.google.com/p/goauth2/source/browse/oauth/oauth.go">OAuth2</a>. 366 For servers, <a href="/pkg/http/#ResponseWriter">ResponseWriter</a> 367 has dropped its non-essential methods. 368 The Hijack and Flush methods are no longer required; 369 code can test for them by checking whether a specific value implements 370 <a href="/pkg/http/#Hijacker">Hijacker</a> or <a href="/pkg/http/#Flusher">Flusher</a>. 371 The RemoteAddr and UsingTLS methods are replaced by <a href="/pkg/http/#Request">Request</a>'s 372 RemoteAddr and TLS fields. 373 The SetHeader method is replaced by a Header method; 374 its result, of type <a href="/pkg/http/#Header">Header</a>, 375 implements Set and other methods. 376 </p> 377 378 <p> 379 <a href="/pkg/net/">Package net</a> 380 drops the <code>laddr</code> argument from <a href="/pkg/net/#Conn.Dial">Dial</a> 381 and drops the <code>cname</code> return value 382 from <a href="/pkg/net/#LookupHost">LookupHost</a>. 383 The implementation now uses <a href="/cmd/cgo/">cgo</a> to implement 384 network name lookups using the C library getaddrinfo(3) 385 function when possible. This ensures that Go and C programs 386 resolve names the same way and also avoids the OS X 387 application-level firewall. 388 </p> 389 390 <p> 391 <a href="/pkg/os/">Package os</a> 392 introduces simplified <a href="/pkg/os/#File.Open">Open</a> 393 and <a href="/pkg/os/#File.Create">Create</a> functions. 394 The original Open is now available as <a href="/pkg/os/#File.OpenFile">OpenFile</a>. 395 The final three arguments to <a href="/pkg/os/#Process.StartProcess">StartProcess</a> 396 have been replaced by a pointer to a <a href="/pkg/os/#ProcAttr">ProcAttr</a>. 397 </p> 398 399 <p> 400 <a href="/pkg/reflect/">Package reflect</a> has been redesigned. 401 <a href="/pkg/reflect/#Type">Type</a> is now an interface that implements 402 all the possible type methods. 403 Instead of a type switch on a Type <code>t</code>, switch on <code>t.Kind()</code>. 404 <a href="/pkg/reflect/#Value">Value</a> is now a struct value that 405 implements all the possible value methods. 406 Instead of a type switch on a Value <code>v</code>, switch on <code>v.Kind()</code>. 407 Typeof and NewValue are now called <a href="/pkg/reflect/#Type.TypeOf">TypeOf</a> and <a href="/pkg/reflect/#Value.ValueOf">ValueOf</a> 408 To create a writable Value, use <code>New(t).Elem()</code> instead of <code>Zero(t)</code>. 409 See <a href="//golang.org/change/843855f3c026">the change description</a> 410 for the full details. 411 The new API allows a more efficient implementation of Value 412 that avoids many of the allocations required by the previous API. 413 </p> 414 415 <p> 416 Remember that gofix will handle the bulk of the rewrites 417 necessary for these changes to package APIs. 418 </p> 419 420 <h3 id="r57.cmd">Tools</h3> 421 422 <p><a href="/cmd/gofix/">Gofix</a>, a new command, is described above.</p> 423 424 <p> 425 <a href="/cmd/gotest/">Gotest</a> is now a Go program instead of a shell script. 426 The new <code>-test.short</code> flag in combination with package testing's Short function 427 allows you to write tests that can be run in normal or “short” mode; 428 all.bash runs tests in short mode to reduce installation time. 429 The Makefiles know about the flag: use <code>make testshort</code>. 430 </p> 431 432 <p> 433 The run-time support now implements CPU and memory profiling. 434 Gotest's new 435 <a href="/cmd/gotest/"><code>-test.cpuprofile</code> and 436 <code>-test.memprofile</code> flags</a> make it easy to 437 profile tests. 438 To add profiling to your web server, see the <a href="/pkg/http/pprof/">http/pprof</a> 439 documentation. 440 For other uses, see the <a href="/pkg/runtime/pprof/">runtime/pprof</a> documentation. 441 </p> 442 443 <h3 id="r57.minor">Minor revisions</h3> 444 445 <p>r57.1 fixes a <a href="//golang.org/change/ff2bc62726e7145eb2ecc1e0f076998e4a8f86f0">nil pointer dereference in http.FormFile</a>.</p> 446 <p>r57.2 fixes a <a href="//golang.org/change/063b0ff67d8277df03c956208abc068076818dae">use of uninitialized memory in programs that misuse <code>goto</code></a>.</p> 447 448 <h2 id="r56">r56 (released 2011/03/16)</h2> 449 450 <p> 451 The r56 release was the first stable release and corresponds to 452 <code><a href="weekly.html#2011-03-07">weekly.2011-03-07.1</a></code>. 453 The numbering starts at 56 because before this release, 454 what we now consider weekly snapshots were called releases. 455 </p> 456