github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/doc/go1compat.html (about) 1 <!--{ 2 "Title": "Go 1 and the Future of Go Programs", 3 "Path": "/doc/go1compat" 4 }--> 5 6 <h2 id="introduction">Introduction</h2> 7 <p> 8 The release of Go version 1, Go 1 for short, is a major milestone 9 in the development of the language. Go 1 is a stable platform for 10 the growth of programs and projects written in Go. 11 </p> 12 13 <p> 14 Go 1 defines two things: first, the specification of the language; 15 and second, the specification of a set of core APIs, the "standard 16 packages" of the Go library. The Go 1 release includes their 17 implementation in the form of two compiler suites (gc and gccgo), 18 and the core libraries themselves. 19 </p> 20 21 <p> 22 It is intended that programs written to the Go 1 specification will 23 continue to compile and run correctly, unchanged, over the lifetime 24 of that specification. At some indefinite point, a Go 2 specification 25 may arise, but until that time, Go programs that work today should 26 continue to work even as future "point" releases of Go 1 arise (Go 27 1.1, Go 1.2, etc.). 28 </p> 29 30 <p> 31 Compatibility is at the source level. Binary compatibility for 32 compiled packages is not guaranteed between releases. After a point 33 release, Go source will need to be recompiled to link against the 34 new release. 35 </p> 36 37 <p> 38 The APIs may grow, acquiring new packages and features, but not in 39 a way that breaks existing Go 1 code. 40 </p> 41 42 <h2 id="expectations">Expectations</h2> 43 44 <p> 45 Although we expect that the vast majority of programs will maintain 46 this compatibility over time, it is impossible to guarantee that 47 no future change will break any program. This document is an attempt 48 to set expectations for the compatibility of Go 1 software in the 49 future. There are a number of ways in which a program that compiles 50 and runs today may fail to do so after a future point release. They 51 are all unlikely but worth recording. 52 </p> 53 54 <ul> 55 <li> 56 Security. A security issue in the specification or implementation 57 may come to light whose resolution requires breaking compatibility. 58 We reserve the right to address such security issues. 59 </li> 60 61 <li> 62 Unspecified behavior. The Go specification tries to be explicit 63 about most properties of the language, but there are some aspects 64 that are undefined. Programs that depend on such unspecified behavior 65 may break in future releases. 66 </li> 67 68 <li> 69 Specification errors. If it becomes necessary to address an 70 inconsistency or incompleteness in the specification, resolving the 71 issue could affect the meaning or legality of existing programs. 72 We reserve the right to address such issues, including updating the 73 implementations. Except for security issues, no incompatible changes 74 to the specification would be made. 75 </li> 76 77 <li> 78 Bugs. If a compiler or library has a bug that violates the 79 specification, a program that depends on the buggy behavior may 80 break if the bug is fixed. We reserve the right to fix such bugs. 81 </li> 82 83 <li> 84 Struct literals. For the addition of features in later point 85 releases, it may be necessary to add fields to exported structs in 86 the API. Code that uses unkeyed struct literals (such as pkg.T{3, 87 "x"}) to create values of these types would fail to compile after 88 such a change. However, code that uses keyed literals (pkg.T{A: 89 3, B: "x"}) will continue to compile after such a change. We will 90 update such data structures in a way that allows keyed struct 91 literals to remain compatible, although unkeyed literals may fail 92 to compile. (There are also more intricate cases involving nested 93 data structures or interfaces, but they have the same resolution.) 94 We therefore recommend that composite literals whose type is defined 95 in a separate package should use the keyed notation. 96 </li> 97 98 <li> 99 Dot imports. If a program imports a standard package 100 using <code>import . "path"</code>, additional names defined in the 101 imported package in future releases may conflict with other names 102 defined in the program. We do not recommend the use of <code>import .</code> 103 outside of tests, and using it may cause a program to fail 104 to compile in future releases. 105 </li> 106 107 <li> 108 Use of package <code>unsafe</code>. Packages that import 109 <a href="/pkg/unsafe/"><code>unsafe</code></a> 110 may depend on internal properties of the Go implementation. 111 We reserve the right to make changes to the implementation 112 that may break such programs. 113 </li> 114 115 </ul> 116 117 <p> 118 Of course, for all of these possibilities, should they arise, we 119 would endeavor whenever feasible to update the specification, 120 compilers, or libraries without affecting existing code. 121 </p> 122 123 <p> 124 These same considerations apply to successive point releases. For 125 instance, code that runs under Go 1.2 should be compatible with Go 126 1.2.1, Go 1.3, Go 1.4, etc., although not necessarily with Go 1.1 127 since it may use features added only in Go 1.2 128 </p> 129 130 <p> 131 Features added between releases, available in the source repository 132 but not part of the numbered binary releases, are under active 133 development. No promise of compatibility is made for software using 134 such features until they have been released. 135 </p> 136 137 <p> 138 Finally, although it is not a correctness issue, it is possible 139 that the performance of a program may be affected by 140 changes in the implementation of the compilers or libraries upon 141 which it depends. 142 No guarantee can be made about the performance of a 143 given program between releases. 144 </p> 145 146 <p> 147 Although these expectations apply to Go 1 itself, we hope similar 148 considerations would be made for the development of externally 149 developed software based on Go 1. 150 </p> 151 152 <h2 id="subrepos">Sub-repositories</h2> 153 154 <p> 155 Code in sub-repositories of the main go tree, such as 156 <a href="//golang.org/x/net">golang.org/x/net</a>, 157 may be developed under 158 looser compatibility requirements. However, the sub-repositories 159 will be tagged as appropriate to identify versions that are compatible 160 with the Go 1 point releases. 161 </p> 162 163 <h2 id="operating_systems">Operating systems</h2> 164 165 <p> 166 It is impossible to guarantee long-term compatibility with operating 167 system interfaces, which are changed by outside parties. 168 The <a href="/pkg/syscall/"><code>syscall</code></a> package 169 is therefore outside the purview of the guarantees made here. 170 As of Go version 1.4, the <code>syscall</code> package is frozen. 171 Any evolution of the system call interface must be supported elsewhere, 172 such as in the 173 <a href="//golang.org/x/sys">go.sys</a> subrepository. 174 For details and background, see 175 <a href="//golang.org/s/go1.4-syscall">this document</a>. 176 </p> 177 178 <h2 id="tools">Tools</h2> 179 180 <p> 181 Finally, the Go tool chain (compilers, linkers, build tools, and so 182 on) are under active development and may change behavior. This 183 means, for instance, that scripts that depend on the location and 184 properties of the tools may be broken by a point release. 185 </p> 186 187 <p> 188 These caveats aside, we believe that Go 1 will be a firm foundation 189 for the development of Go and its ecosystem. 190 </p>