github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/go1.slide (about)

     1  The Path to Go 1
     2  
     3  Rob Pike
     4  Google
     5  http://golang.org/s/plusrob
     6  @rob_pike
     7  http://golang.org
     8  
     9  Andrew Gerrand
    10  Google
    11  http://andrewgerrand.com
    12  @go_nuts
    13  http://golang.org
    14  
    15  
    16  * Introduction
    17  
    18  Go is a concurrent open source programming language developed at Google.
    19  
    20  Combines native compilation and static types with a lightweight dynamic feel.
    21  
    22  Fast, fun, and productive.
    23  
    24  
    25  * What is Go?
    26  
    27  Features:
    28  
    29  - Native code generation (compiled)
    30  - Statically typed
    31  - Composition via interfaces
    32  - Memory safe
    33  - Garbage collected
    34  - Native concurrency support
    35  - Excellent standard library
    36  - Great tools
    37  
    38  
    39  * History
    40  
    41  
    42  * History
    43  
    44  Began as a Google 20% project in late 2007.
    45  
    46  Released as an open source project in November 2009.
    47  
    48  Go 1 released in March 2012.
    49  
    50  
    51  * The Go project
    52  
    53  Planned from the start as an open source project.
    54  
    55  Publicly released under a BSD license.
    56  
    57  To date: 28 committers from Google and elsewhere.
    58  
    59  More than 200 other people have contributed to the project.
    60  
    61  9735 changes committed since release.
    62  
    63  
    64  * Development process
    65  
    66  Mercurial version control system with plugin for code review.
    67  
    68  No branches; linear history.
    69  
    70  Code review central to the project. All changes reviewed on golang-dev list using Rietveld (codereview.appspot.com).
    71  
    72  Custom continuous build system tests across all supported platforms.
    73  
    74  Contributions accepted on a "Discuss first, code later" basis.
    75  
    76  
    77  * Contributions over time
    78  
    79  The project moves fast:
    80  
    81  .image go1/changes.png
    82  
    83  Windows, FreeBSD, OpenBSD, NetBSD, and Plan 9 ports are community-driven.
    84  
    85  
    86  * Managing the project
    87  
    88  * Development cycle
    89  
    90  Changes are made continuously.
    91  
    92  Things break. Things get fixed.
    93  Some days are better than others.
    94  
    95  Continuous builders help, but don't reveal all issues.
    96  
    97  We needed to provide some stability for our users.
    98  
    99  
   100  * Weekly snapshots
   101  
   102  Attempt to keep everyone in sync.
   103  
   104  - Apply a Mercurial tag to a specific, stable revision.
   105  - Announce to user mailing list with detailed changelog.
   106  
   107  Great for early adopters and core developers.
   108  
   109  
   110  * Problems with weeklies
   111  
   112  Contributors work at tip; users sync to weeklies.
   113  
   114  Burden on users:
   115  
   116  - annoying to update weekly,
   117  - painful to update less often.
   118  
   119  Version skew results because users are at different weeklies.
   120  
   121  Skew fragments the community and slows adoption.
   122  
   123  
   124  * Formal release process
   125  
   126  March 2011: introduced releases every 1-2 months.
   127  
   128  - Pick the most stable of the past few snapshots and tag it.
   129  - Announce with abridged "must read" release notes.
   130  
   131  Keeps the community more in sync. Reduces churn.
   132  
   133  Popular with users.
   134  
   135  
   136  * Problem with releases
   137  
   138  Easy to make a few small changes once a week...
   139  
   140  \...but hard to make many small changes once a month.
   141  
   142  Skew still prevalent: adventurers and core devs still use weeklies (or tip!).
   143  
   144  
   145  * Introducing Gofix
   146  
   147  A tool to mechanically update code to accommodate language and library changes.
   148  
   149    gofix prog.go
   150  
   151  Announced in May 2011.
   152  Gofix automates updates for backward-incompatible changes.
   153  Eases the burden of staying current.
   154  
   155  Release notes now mostly say "run gofix."
   156  
   157  Not a sed script. Works on the AST.
   158  
   159  
   160  * Gofix
   161  
   162  Gofix enables sweeping changes without fear of breaking the code base.
   163  
   164  Gofix gave us the freedom to make widespread changes that would have been too daunting otherwise.
   165  
   166  Can even update foreign code:
   167  
   168  "Yesterday I gofixed some third-party packages without even reading their code and without waiting for the authors to update them." - Dmitry Chestnykh
   169  
   170  
   171  * Versioning issues persist
   172  
   173  Gofix is no panacea.
   174  
   175  As the root of the dependency graph, a programming language can suffer acutely from version skew.
   176  
   177  The fundamental issue remains:
   178  Code you write today may not compile tomorrow.
   179  
   180  Some companies unwilling to bet on Go as they saw it as unstable.
   181  
   182  
   183  * A need for stability
   184  
   185  Gofix makes changes very easy, and also makes it easy to experiment.
   186  But it can't do everything.
   187  
   188  Priorities: If change is easy, what change is important?
   189  
   190  Wanted to make major changes to the language and libraries but, even with gofix, some things are too disruptive without proper planning.
   191  
   192  Decision: design and implement a stable version of Go, its libraries, and its tools.
   193  
   194  
   195  * Go 1
   196  
   197  * What is Go 1?
   198  
   199  A specification of the language and libraries that will be supported for years.
   200  
   201  Available as downloadable binary packages.
   202  
   203  An opportunity to:
   204  
   205  - fix minor language irritations,
   206  - fix inconsistencies in the standard library,
   207  - focus on bug fixing and cleaning up TODOs,
   208  - design and build a strong build tool set (get rid of make),
   209  - bring Windows support up to par.
   210  
   211  Polish and refine, not redesign.
   212  
   213  
   214  * Planning Go 1
   215  
   216  Wrote a detailed proposal document.
   217  
   218  Implemented (but not committed) many of the proposed changes.
   219  
   220  Core team met for a week to discuss and refine the document (October 2011).
   221  
   222  Presented the document to the community for discussion.
   223  
   224  Community feedback essential in refining the proposal.
   225  
   226  
   227  * Preparing Go 1
   228  
   229  
   230  Create many new issues on the tracker.
   231  
   232  Categorize new and existing issues as either "Go 1" or "after Go 1".
   233  
   234  Contributors nominate themselves to address specific issues.
   235  
   236  Stop developing new features; prioritize stability.
   237  
   238  
   239  * Rolling it out
   240  
   241  Daily number of lines changed in the months leading up to Go 1:
   242  
   243  .image go1/go1lines.png
   244  
   245  
   246  * Gofix and Go 1
   247  
   248  The largest Go 1 edits were performed by gofix.
   249  
   250  Gofix made it easy to try out a change and refine it incrementally.
   251  
   252  Some significant changes were tried and abandoned.
   253  
   254  
   255  * Gofix work flow
   256  
   257  Scripted work flow allowed us to avoid branches and merging nightmares.
   258  #Total automation of edits makes it easy to do large changes without branching.
   259  
   260  Process:
   261  
   262    while !satisfied {
   263      in tree 1:
   264        refine gofix module in tree 1, build binary
   265      in tree 2:
   266        revert to tip (note: tip)
   267        apply gofix binary from tree 2
   268        build and test
   269    }
   270    commit tree 1
   271    commit tree 2
   272  
   273  Even as other changes are happening, this leads to no branching or skew.
   274  
   275  * Sample change
   276  
   277  .image go1/errordiff1.png
   278  .image go1/errordiff2.png
   279  
   280  * Go 1 release process
   281  
   282  Releases paused from r60 (August 2011).
   283  Weeklies continued as normal.
   284  
   285  Issued release candidates in the weeks leading up to launch.
   286  
   287  Release candidates included binary distributions for the supported operating systems (FreeBSD, Linux, Mac OS X, and Windows).
   288  
   289  
   290  * What is in Go 1?
   291  
   292  * Go 1
   293  
   294  Specification of the language.
   295  
   296  Specification of the libraries.
   297  
   298  Promise of long term compatibility.
   299  
   300  Windows as a first class citizen.
   301  
   302  New tool chain centered around the `go` tool.
   303  
   304  "Phase change" in the way the project runs.
   305  
   306  
   307  * Language changes
   308  
   309  A new `rune` type to represent a Unicode code point.
   310  (Important step in making `int` either 32 or 64 bits; currently just 32.)
   311  
   312  A new built-in `error` type to replace `os.Error`.
   313  This affected almost all Go code in existence.
   314  
   315  Equality defined on structs.
   316  
   317  Cleaned up some clumsy operations.
   318  
   319  
   320  * API changes
   321  
   322  A re-designed `time` package with a clean, simple interface.
   323  
   324  Regularization of `strconv`, breaking away from the old C-style API.
   325  
   326  Widespread package re-organization. Put things in more appropriate places.
   327  
   328  Dozens of lesser changes.
   329  
   330  
   331  * Time
   332  
   333  Old time package was based on the Unix epoch. Limited range, poor features,
   334  no type safety (just integer nanoseconds).
   335  
   336  Substantial redesign creates separate Time and Duration types.
   337  Time can represent huge range of times with nanosecond precision.
   338  
   339  Duration specifies intervals. Example:
   340  
   341    time.Sleep(2)             // Old API, unsafe: How long is this?
   342    time.Sleep(2*time.Second) // New API: type-safe, readable.
   343  
   344    fmt.Println(time.Now().Add(1e6*time.Hour))
   345  
   346  Also a new flag type!
   347  
   348    $ command -timeout 1m30s
   349  
   350  * Re-organization
   351  
   352  Rearranged the organically constructed tree to group related things together.
   353  Examples:
   354  
   355    Old         New
   356  
   357    "asn1"      "encoding/asn1"
   358    "csv"       "encoding/csv"
   359    "gob"       "encoding/gob"
   360    "json"      "encoding/json"
   361    "xml"       "encoding/xml"
   362    
   363    "unicode"   "unicode"
   364    "utf8"      "unicode/utf8"
   365    "utf16"     "unicode/utf16"
   366  
   367  All updated by gofix, of course.
   368  
   369  * Demoting immature packages and commands
   370  
   371  Parts of the tree deemed unready should not be part of Go 1.
   372  
   373  Working but immature packages were moved to sub-repositories of the main Go repository. (They remain installable.)
   374  
   375  Unfinished and old packages and tools were left out.
   376  
   377  
   378  * How to build
   379  
   380  Before Go 1, Go programs were built with make, but Makefiles are annoying to write and, for Go, redundant.
   381  
   382  From the beginning, a goal of Go was good dependency management.
   383  
   384  By design, Go source code contains all the information necessary to build.
   385  
   386  Go 1 includes a new "go tool" that eliminates the need for make.
   387  
   388  Given a Go tree (including remote dependencies), can build and install directly:
   389  
   390    $ go build file.go
   391  
   392  * The go tool
   393  
   394  A complete build, test, and install tool for Go programs.
   395  
   396  Some realistic examples:
   397  
   398    $ go run hello.go       # Compile-and-go. (Ha!).
   399    $ go build package      # Build everything in directory (and deps).
   400    $ go install            # Install everything in dir and (and deps).
   401    $ go test archive/zip   # Compile and run unit tests for package.
   402  
   403  The go tool also wraps `gofmt`, `gofix`, etc.:
   404  
   405    $ go fmt                # Run gofmt on package in current dir.
   406    $ go fix                # Run gofix on package in current dir.
   407  
   408  * The go tool and remote repositories
   409  
   410  The go tool automates installation of remote packages.
   411  
   412  Packages are addressed by import strings.
   413  Import strings are just source repository URLs.
   414  Go tool downloads and installs all dependencies, transitively.
   415  
   416    $ go get code.google.com/p/myrepo/mypackage
   417  
   418  Installs my package, plus any remote dependencies it may have.
   419  And to use the package in Go source:
   420  
   421  	import "code.google.com/p/myrepo/mypackage"
   422  
   423  The tool can even run gofix as it installs:
   424  
   425    $ go get -fix code.google.com/p/myrepo/mypackage
   426  
   427  
   428  * Documentation
   429  
   430  Complete reworking:
   431  
   432  - updated,
   433  - unified,
   434  - added new documents,
   435  - added new (executable) examples,
   436  - redesigned web site.
   437  
   438  
   439  * API compatibility tool
   440  
   441  Scans the entire standard library and checks it against a master list (`go1.txt`).
   442  
   443  Helps guarantee compatibility as development continues.
   444  
   445  Part of our build process in the lead up to Go 1 (and continues today).
   446  
   447  
   448  * Today and tomorrow
   449  
   450  * What are we working on?
   451  
   452  The goal for Go 1 was a stable, productive environment.
   453  
   454  Now that Go 1 is out, we are shifting our focus to using Go more than just developing it.
   455  
   456  Only through using Go extensively can we learn what might be needed in a future version, say Go 2.
   457  
   458  * There is still active development
   459  
   460  The design is locked down but work continues.
   461  
   462  Stability: bug fixes.
   463  
   464  Efficiency:
   465  
   466  - code generation,
   467  - garbage collection,
   468  - scheduling,
   469  - hot spots in standard libraries.
   470  
   471  Portability: NetBSD, OpenBSD, and Plan 9 ports in progress.
   472  
   473  New libraries: HTML parsing and Unicode collation packages, for example.
   474  
   475  * Releases after Go 1
   476  
   477  Two minor point releases (`go1.0.1` and `go1.0.2`) have been issued to fix bugs.
   478  
   479  The next major point release (`go1.1`) is planned for the end of 2012.
   480  It will include:
   481  
   482  - code generation improvements to the `gc` compiler,
   483  - performance and accuracy improvements to the garbage collector,
   484  - (possibly) an improved scheduler,
   485  - a slew of bug fixes.
   486  
   487  Go 2 is likely years away.
   488  
   489  
   490  * Learn more
   491  
   492  The Go web site has a huge amount of documentation:
   493  
   494  .link http://golang.org
   495  
   496  Learn Go from a web browser:
   497  
   498  .link http://tour.golang.org
   499  
   500  "Meet the Go team" panel from Google I/O 2012:
   501  
   502  .link http://golang.org/s/meet-the-go-team
   503  
   504  Google Code project:
   505  
   506  .link http://code.google.com/p/go
   507