diff options
53 files changed, 219 insertions, 386 deletions
diff --git a/content/6years.article b/content/6years.article index 662ce74..a5d3ec1 100644 --- a/content/6years.article +++ b/content/6years.article @@ -36,7 +36,7 @@ We are also working on an [[https://groups.google.com/forum/#!topic/Golang-nuts/8oCSjAiKXUQ][official Go plugin for Sublime Text]], with better support for other editors in the pipeline. -Early next year we will release more improvements in Go 1.6, including +Early next year we will release more improvements in Go 1.6, including HTTP/2 support for [[https://golang.org/pkg/net/http/][net/http]] servers and clients, an official package vendoring mechanism, support for blocks in text and HTML templates, a memory sanitizer that checks both Go and C/C++ code, and diff --git a/content/7years.article b/content/7years.article index ffc43e7..0957e85 100644 --- a/content/7years.article +++ b/content/7years.article @@ -6,7 +6,6 @@ rsc@golang.org * Seven years of Go - .html gopherbelly.html Today marks seven years since we open-sourced our preliminary sketch of Go. diff --git a/content/8years.article b/content/8years.article index 78876ca..617193c 100644 --- a/content/8years.article +++ b/content/8years.article @@ -23,7 +23,7 @@ Source: [[https://trends.google.com/trends/explore?date=2009-10-01%202017-10-30& ** Developers love Go Go has been embraced by developers all over the world with approximately one -million users worldwide. In the [[https://octoverse.github.com/][freshly published 2017 Octoverse]] +million users worldwide. In the [[https://octoverse.github.com/][freshly published 2017 Octoverse]] by GitHub, *Go*has*become*the*#9*most*popular*language*, surpassing C. *Go*is*the*fastest*growing*language*on*GitHub*in*2017* in the top 10 with *52%*growth*over*the*previous*year*. In growth, Go swapped places with @@ -34,20 +34,19 @@ Javascript, which fell to the second spot with 44%. Source: [[https://octoverse.github.com/][octoverse.github.com]] In [[https://insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted][Stack Overflow's 2017 developer survey]] -, Go was the only language that was both on the *top*5*most*loved*and*top*5*most*wanted* languages. +, Go was the only language that was both on the *top*5*most*loved*and*top*5*most*wanted* languages. People who use Go, love it, and the people who aren’t using Go, want to be. .image 8years/image3.png - .image 8years/image4.png Source: [[https://insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted][insights.stackoverflow.com/survey/2017]] ** Go: The language of Cloud Infrastructure -In 2014, analyst Donnie Berkholz called Go +In 2014, analyst Donnie Berkholz called Go [[http://redmonk.com/dberkholz/2014/03/18/go-the-emerging-language-of-cloud-infrastructure/][the emerging language of cloud infrastructure]]. -*By*2017,*Go*has*emerged*as*the*language*of*cloud*infrastructure*. +*By*2017,*Go*has*emerged*as*the*language*of*cloud*infrastructure*. Today, *every*single*cloud*company*has*critical*components*of*their*cloud*infrastructure*implemented*in*Go* including Google Cloud, AWS, Microsoft Azure, Digital Ocean, Heroku and many others. Go is a key part of cloud companies like Alibaba, Cloudflare, and Dropbox. Go is @@ -74,14 +73,14 @@ This year we had two significant firsts for the Go project. We had our first [[https://blog.golang.org/contributors-summit][contributor summit]] where people from across the Go community came together to discuss the needs and future of the Go project. Shortly after, we had the -first [[https://blog.golang.org/contributor-workshop][Go contributor workshop]] +first [[https://blog.golang.org/contributor-workshop][Go contributor workshop]] where hundreds of people came to make their first Go contribution. .image 8years/photo.jpg Photo by Sameer Ajmani -** Go’s impact on open source +** Go’s impact on open source Go has become a major force in the world of open source powering some of the most popular projects and enabling innovations across many industries. Find @@ -113,7 +112,7 @@ just a handful of the most popular: feature-rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB. -- [[https://getlantern.org/][Lantern]] delivers fast, reliable and secure access to blocked websites and apps. +- [[https://getlantern.org/][Lantern]] delivers fast, reliable and secure access to blocked websites and apps. - [[https://syncthing.net/][Syncthing]] is an open-source cross platform peer-to-peer continuous file synchronization application @@ -155,6 +154,6 @@ expertise in design discussions, writing blog posts or books, running events, attending or speaking at events, helping others learn or improve, open sourcing Go packages you wrote, contributing artwork, introducing Go to someone, or being part of the Go community. Without you, Go would not be as -complete, useful, or successful as it is today. +complete, useful, or successful as it is today. Thank you, and here’s to eight more years! diff --git a/content/conduct-2018.article b/content/conduct-2018.article index 64edcf2..7fbda8c 100644 --- a/content/conduct-2018.article +++ b/content/conduct-2018.article @@ -12,27 +12,27 @@ the Go team members at Google and the Go community. I was fortunate to be one of the community members invited to participate in both drafting and then enforcing the Go Code of Conduct. -Since then, we have learned two lessons about -limitations in our code of conduct that restricted us from +Since then, we have learned two lessons about +limitations in our code of conduct that restricted us from being able to cultivate the safe culture -essential to Go’s success. +essential to Go’s success. The first lesson we learned is that toxic behaviors by -project participants in non-project spaces can have a +project participants in non-project spaces can have a negative impact on the project affecting the security and safety of community members. There were a few reported incidents where actions took place outside of project spaces -but the impact was felt inside our community. The specific -language in our code of conduct restricted our ability to -respond only to actions happening “in the official -forums operated by the Go project”. We needed a way -to protect our community members wherever they are. +but the impact was felt inside our community. The specific +language in our code of conduct restricted our ability to +respond only to actions happening “in the official +forums operated by the Go project”. We needed a way +to protect our community members wherever they are. -The second lesson we learned is that the demands required +The second lesson we learned is that the demands required to enforce the code -of conduct place too heavy of a burden on volunteers. -The initial version of the code of conduct presented the -working group as disciplinarians. It was soon clear +of conduct place too heavy of a burden on volunteers. +The initial version of the code of conduct presented the +working group as disciplinarians. It was soon clear that this was too much, so in early 2017 [[https://golang.org/cl/37014][we changed the group’s role]] to that of advisors and mediators. Still, working group community members @@ -40,14 +40,14 @@ reported feeling overwhelmed, untrained, and vulnerable. This well-intentioned shift left us without an enforcement mechanism without solving the issue with overburdened volunteers. -In mid-2017, I represented the Go project in a meeting with -Google’s Open Source Programs Office and Open Source Strategy Team +In mid-2017, I represented the Go project in a meeting with +Google’s Open Source Programs Office and Open Source Strategy Team to address the shortcomings in our respective codes of conduct, particularly in their enforcement. It quickly became clear that our problems had a lot in common, and that working together on a single code of conduct for all -of Google’s open source projects made sense. -We started with the text from the +of Google’s open source projects made sense. +We started with the text from the Contributor Covenant Code of Conduct v1.4 and then made changes, influenced by our experiences in Go community and our collective experiences in open source. @@ -55,26 +55,26 @@ This resulted in the Google [[https://opensource.google.com/docs/releasing/templ Today the Go project is adopting this new code of conduct, and we’ve updated [[https://golang.org/conduct][golang.org/conduct]]. -This revised code of conduct retains much of the intent, structure and -language of the original Go code of conduct while making two critical -changes that address the shortcomings identified above. +This revised code of conduct retains much of the intent, structure and +language of the original Go code of conduct while making two critical +changes that address the shortcomings identified above. First, [[https://golang.org/conduct/#scope][the new code of conduct makes clear]] that people who participate in any kind of harassment or inappropriate behavior, -even outside our project spaces, are not welcome in our project spaces. -This means that the Code of Conduct applies outside -the project spaces when there is a reasonable belief that +even outside our project spaces, are not welcome in our project spaces. +This means that the Code of Conduct applies outside +the project spaces when there is a reasonable belief that an individual’s behavior may have a negative impact on the project or its community. Second, in the place of the working group, -[[https://golang.org/conduct/#reporting][the new code of conduct introduces a single Project Steward]] +[[https://golang.org/conduct/#reporting][the new code of conduct introduces a single Project Steward]] who will have explicit training and support for this role. The Project Steward will receive reported violations and then work with a committee, consisting of representatives from the Open Source Programs Office and the Google Open Source Strategy team, -to find a resolution. +to find a resolution. Our first Project Steward will be [[https://twitter.com/cassandraoid][Cassandra Salisbury]]. She is well known to the Go community as a member of Go Bridge, @@ -83,8 +83,8 @@ and as a lead of the Go community outreach working group. Cassandra now works on the Go team at Google with a focus on advocating for and supporting the Go community. -We are grateful to everyone who served on the original Code of -Conduct Working Group. Your efforts were essential in creating an +We are grateful to everyone who served on the original Code of +Conduct Working Group. Your efforts were essential in creating an inclusive and safe community. We believe the code of conduct has contributed to the diff --git a/content/constants.article b/content/constants.article index 36c4edc..5148cf1 100644 --- a/content/constants.article +++ b/content/constants.article @@ -264,7 +264,7 @@ Floating-point values are a good place to introduce the concept of overflow, or Numeric constants live in an arbitrary-precision numeric space; they are just regular numbers. But when they are assigned to a variable the value must be able to fit in the destination. We can declare a constant with a very large value: - + .code constants/float3.go /Huge/ —that's just a number, after all—but we can't assign it or even print it. This statement won't even compile: @@ -512,5 +512,3 @@ or and have the results mean what you expect. Because in Go, numeric constants work as you expect: like numbers. - - diff --git a/content/contributors-summit-2019.article b/content/contributors-summit-2019.article index 052e7ef..ae43178 100644 --- a/content/contributors-summit-2019.article +++ b/content/contributors-summit-2019.article @@ -390,5 +390,3 @@ please email Carmen Andoh candoh@google.com.) Thanks to all the attendees for the excellent discussions on contributor day, and thanks especially to Lynn, Paul, Daniel, Andy, and Ronna for taking the time to write these reports. - - diff --git a/content/contributors-summit.article b/content/contributors-summit.article index 815c090..a213674 100644 --- a/content/contributors-summit.article +++ b/content/contributors-summit.article @@ -42,7 +42,6 @@ this for me was one of the more interesting sessions of the day. I learned a lot about the current state of the world, the problems, and where people want to go from here. - ** Dependency management After a quick update from the [[https://github.com/golang/dep][dep]] team on the diff --git a/content/cover.article b/content/cover.article index 3abd67d..40ed1d9 100644 --- a/content/cover.article +++ b/content/cover.article @@ -113,7 +113,7 @@ we run the test with coverage enabled by providing the `-cover` flag to `go` `te PASS coverage: 42.9% of statements ok size 0.026s - % + % Notice that the coverage is 42.9%, which isn't very good. Before we ask how to raise that number, let's see how that was computed. @@ -142,11 +142,11 @@ To discover why, we ask `go` `test` to write a "coverage profile" for us, a file the collected statistics so we can study them in more detail. That's easy to do: use the `-coverprofile` flag to specify a file for the output: - % go test -coverprofile=coverage.out + % go test -coverprofile=coverage.out PASS coverage: 42.9% of statements ok size 0.030s - % + % (The `-coverprofile` flag automatically sets `-cover` to enable coverage analysis.) The test runs just as before, but the results are saved in a file. @@ -158,7 +158,7 @@ only one function: % go tool cover -func=coverage.out size.go: Size 42.9% total: (statements) 42.9% - % + % A much more interesting way to see the data is to get an HTML presentation of the source code decorated with coverage information. @@ -203,7 +203,7 @@ Let's try counting statement execution for a standard package, the `fmt` formatt We run the test and write out a coverage profile so we can present the information nicely afterwards. - % go test -covermode=count -coverprofile=count.out fmt + % go test -covermode=count -coverprofile=count.out fmt ok fmt 0.056s coverage: 91.7% of statements % diff --git a/content/debugging-what-you-deploy.article b/content/debugging-what-you-deploy.article index 9d1fde8..4685715 100644 --- a/content/debugging-what-you-deploy.article +++ b/content/debugging-what-you-deploy.article @@ -83,7 +83,6 @@ Function call support in Delve is still under development, but simple cases work Values returned: ~r1: 8 - * The path forward Go 1.12 is a step toward a better debugging experience for optimized binaries diff --git a/content/defer-panic-and-recover.article b/content/defer-panic-and-recover.article index 8bea0ab..2c95aa3 100644 --- a/content/defer-panic-and-recover.article +++ b/content/defer-panic-and-recover.article @@ -12,15 +12,12 @@ It also has the go statement to run code in a separate goroutine. Here I'd like to discuss some of the less common ones: defer, panic, and recover. - A *defer*statement* pushes a function call onto a list. The list of saved calls is executed after the surrounding function returns. Defer is commonly used to simplify functions that perform various clean-up actions. - For example, let's look at a function that opens two files and copies the contents of one file to the other: - func CopyFile(dstName, srcName string) (written int64, err error) { src, err := os.Open(srcName) if err != nil { @@ -45,7 +42,6 @@ but if the function were more complex the problem might not be so easily noticed and resolved. By introducing defer statements we can ensure that the files are always closed: - func CopyFile(dstName, srcName string) (written int64, err error) { src, err := os.Open(srcName) if err != nil { @@ -67,13 +63,12 @@ guaranteeing that, regardless of the number of return statements in the function the files _will_ be closed. The behavior of defer statements is straightforward and predictable. There are three simple rules: - + 1. _A_deferred_function's_arguments_are_evaluated_when_the_defer_statement_is_evaluated._ - + In this example, the expression "i" is evaluated when the Println call is deferred. The deferred call will print "0" after the function returns. - func a() { i := 0 defer fmt.Println(i) @@ -82,7 +77,7 @@ The deferred call will print "0" after the function returns. } 2. _Deferred_function_calls_are_executed_in_Last_In_First_Out_order_after_the_surrounding_function_returns._ - + This function prints "3210": func b() { @@ -91,9 +86,8 @@ This function prints "3210": } } - 3. _Deferred_functions_may_read_and_assign_to_the_returning_function's_named_return_values._ - + In this example, a deferred function increments the return value i _after_ the surrounding function returns. Thus, this function returns 2: @@ -103,10 +97,8 @@ Thus, this function returns 2: return 1 } - This is convenient for modifying the error return value of a function; we will see an example of this shortly. - *Panic* is a built-in function that stops the ordinary flow of control and begins _panicking_. When the function F calls panic, execution of F stops, any deferred functions in F are executed normally, @@ -118,14 +110,12 @@ Panics can be initiated by invoking panic directly. They can also be caused by runtime errors, such as out-of-bounds array accesses. - *Recover* is a built-in function that regains control of a panicking goroutine. Recover is only useful inside deferred functions. During normal execution, a call to recover will return nil and have no other effect. If the current goroutine is panicking, a call to recover will capture the value given to panic and resume normal execution. - Here's an example program that demonstrates the mechanics of panic and defer: package main @@ -158,17 +148,14 @@ Here's an example program that demonstrates the mechanics of panic and defer: g(i + 1) } - The function g takes the int i, and panics if i is greater than 3, or else it calls itself with the argument i+1. The function f defers a function that calls recover and prints the recovered value (if it is non-nil). Try to picture what the output of this program might be before reading on. - The program will output: - Calling g. Printing in g 0 Printing in g 1 @@ -182,14 +169,11 @@ The program will output: Recovered in f 4 Returned normally from f. - - If we remove the deferred function from f the panic is not recovered and reaches the top of the goroutine's call stack, terminating the program. This modified program will output: - Calling g. Printing in g 0 Printing in g 1 @@ -201,12 +185,10 @@ This modified program will output: Defer in g 1 Defer in g 0 panic: 4 - + panic PC=0x2a9cd8 [stack trace omitted] - - For a real-world example of *panic* and *recover*, see the [[https://golang.org/pkg/encoding/json/][json package]] from the Go standard library. @@ -219,25 +201,18 @@ the 'error' and 'marshal' methods of the encodeState type in [[https://golang.or The convention in the Go libraries is that even when a package uses panic internally, its external API still presents explicit error return values. - Other uses of *defer* (beyond the file.Close example given earlier) include releasing a mutex: mu.Lock() defer mu.Unlock() - - printing a footer: - printHeader() defer printFooter() - - and more. - In summary, the defer statement (with or without panic and recover) provides an unusual and powerful mechanism for control flow. It can be used to model a number of features implemented by special-purpose diff --git a/content/examples.article b/content/examples.article index a8d5aba..dc24423 100644 --- a/content/examples.article +++ b/content/examples.article @@ -107,10 +107,9 @@ then the example function is compiled but not executed: ok github.com/golang/example/stringutil 0.009s Examples without output comments are useful for demonstrating code that cannot -run as unit tests, such as that which accesses the network, +run as unit tests, such as that which accesses the network, while guaranteeing the example at least compiles. - * Example function names Godoc uses a naming convention to associate an example function with a @@ -131,13 +130,12 @@ Each of these examples documents the `Reverse` function: func ExampleReverse_second() func ExampleReverse_third() - * Larger examples Sometimes we need more than just a function to write a good example. For instance, to demonstrate the [[https://golang.org/pkg/sort/][`sort` package]] -we should show an implementation of `sort.Interface`. +we should show an implementation of `sort.Interface`. Since methods cannot be declared inside a function body, the example must include some context in addition to the example function. diff --git a/content/first-go-program.article b/content/first-go-program.article index 59e46e8..7554e03 100644 --- a/content/first-go-program.article +++ b/content/first-go-program.article @@ -41,7 +41,6 @@ Rob sent mail to the "Go team": here's the code. some ugly hackery to get around the lack of strings. - (The `icounter` line in the program output is the number of executed statements, printed for debugging.) @@ -50,7 +49,7 @@ statements, printed for debugging.) The program parses and prints an [[https://en.wikipedia.org/wiki/S-expression][S-expression]]. It takes no user input and has no imports, relying only on the built-in -`print` facility for output. +`print` facility for output. It was written literally the first day there was a [[https://golang.org/change/8b8615138da3][working but rudimentary compiler]]. Much of the language wasn't implemented and some of it wasn't even specified. @@ -117,7 +116,6 @@ For instance, Rob called his method receivers `this`, but now we use shorter context-specific names. There are hundreds of more significant examples and to this day we're still discovering better ways to write Go code. (Check out the [[https://github.com/golang/glog][glog package]]'s clever trick for -[[https://github.com/golang/glog/blob/c6f9652c7179652e2fd8ed7002330db089f4c9db/glog.go#L893][handling verbosity levels]].) +[[https://github.com/golang/glog/blob/c6f9652c7179652e2fd8ed7002330db089f4c9db/glog.go#L893][handling verbosity levels]].) I wonder what we'll learn tomorrow. - diff --git a/content/fosdem14.article b/content/fosdem14.article index 107ce4e..dd73c87 100644 --- a/content/fosdem14.article +++ b/content/fosdem14.article @@ -21,7 +21,7 @@ The complete series of talks is available * Scaling with Go: YouTube's Vitess Google Engineer Sugu Sougoumarane described how he and his -team built [[https://github.com/youtube/vitess][Vitess]] in Go to help scale +team built [[https://github.com/youtube/vitess][Vitess]] in Go to help scale [[https://youtube.com][YouTube]]. Vitess is a set of servers and tools primarily developed in Go. @@ -63,11 +63,10 @@ your own." * More -There were many more great talks, so please check out the complete series +There were many more great talks, so please check out the complete series [[http://www.youtube.com/playlist?list=PLtLJO5JKE5YDKG4WcaNts3IVZqhDmmuBH][as a YouTube playlist]]. In particular, the [[http://www.youtube.com/watch?v=cwpI5ONWGxc&list=PLtLJO5JKE5YDKG4WcaNts3IVZqhDmmuBH&index=7][lightning talks]] were a lot of fun. I would like to give my personal thanks to the excellent speakers, Mathieu Lonjaret for managing the video gear, and to the FOSDEM staff for making all this possible. - diff --git a/content/from-zero-to-go-launching-on-google.article b/content/from-zero-to-go-launching-on-google.article index fc47fd9..c0ef417 100644 --- a/content/from-zero-to-go-launching-on-google.article +++ b/content/from-zero-to-go-launching-on-google.article @@ -132,7 +132,7 @@ global variables upon receipt of the first request. // backgroundImage contains the background image data. backgroundImage *image.RGBA - // defaultImage is the image that is served if an error occurs. + // defaultImage is the image that is served if an error occurs. defaultImage *image.RGBA // loadOnce is used to call the load function only on the first request. diff --git a/content/generate.article b/content/generate.article index e848880..a1fa9fd 100644 --- a/content/generate.article +++ b/content/generate.article @@ -151,15 +151,15 @@ Let's run it: $ go generate $ cat pill_string.go // Code generated by stringer -type Pill pill.go; DO NOT EDIT. - + package painkiller - + import "fmt" - + const _Pill_name = "PlaceboAspirinIbuprofenParacetamol" - + var _Pill_index = [...]uint8{0, 7, 14, 23, 34} - + func (i Pill) String() string { if i < 0 || i+1 >= Pill(len(_Pill_index)) { return fmt.Sprintf("Pill(%d)", i) @@ -210,7 +210,6 @@ Here's a trivial example based on a constant set representing powers of two: return fmt.Sprintf("Power(%d)", i) } - In short, generating the method automatically allows us to do a better job than we would expect a human to do. There are lots of other uses of `go` `generate` already installed in the Go tree. diff --git a/content/go-at-io-frequently-asked-questions.article b/content/go-at-io-frequently-asked-questions.article index 9b7d009..37a09c3 100644 --- a/content/go-at-io-frequently-asked-questions.article +++ b/content/go-at-io-frequently-asked-questions.article @@ -33,7 +33,7 @@ Additionally, the more Go code we write (and thus the better we learn how to write Go code ourselves), the less we feel the need for such a language feature. -Do you have any plans to support GPU programming? +Do you have any plans to support GPU programming? We don't have any immediate plans to do this, but as Go is architecture-agnostic it's quite possible. The ability to launch a goroutine that runs on a different processor architecture, diff --git a/content/go-fonts.article b/content/go-fonts.article index 8996237..f5e0aca 100644 --- a/content/go-fonts.article +++ b/content/go-fonts.article @@ -14,7 +14,7 @@ The experimental user interface toolkit being built at includes several text elements, but there is a problem with testing them: What font should be used? Answering this question led us to today's announcement, -the release of a family of high-quality [[https://en.wikipedia.org/wiki/Windows_Glyph_List_4][WGL4]] TrueType fonts, +the release of a family of high-quality [[https://en.wikipedia.org/wiki/Windows_Glyph_List_4][WGL4]] TrueType fonts, created by the [[http://bigelowandholmes.typepad.com/][Bigelow & Holmes]] type foundry specifically for the Go project. The font family, called Go (naturally), includes proportional- and fixed-width faces in normal, @@ -42,21 +42,18 @@ and monospaced fonts: If you just want the TTF files, run git clone https://go.googlesource.com/image - + and copy them from the subsequent `image/font/gofont/ttfs` directory. If you want to use Go (the fonts) with Go (the software), each font is provided by a separate package. To use the Go Regular font in a program, import `golang.org/x/image/font/gofont/goregular`, and write: - font, err := truetype.Parse(goregular.TTF) - The [[https://godoc.org/github.com/golang/freetype/truetype][`github.com/golang/freetype/truetype`]] package provides the [[https://godoc.org/github.com/golang/freetype/truetype#Parse][`truetype.Parse`]] function today. There is also work underway to add a TrueType package under `golang.org/x` again licensed under the same open source license as the rest of the Go project's software. - We leave it to you to find some of the other unusual properties the fonts have, but for an overview of the fonts' design we asked Chuck Bigelow to provide some background. The remainder of this blog post is his response. @@ -66,49 +63,43 @@ The remainder of this blog post is his response. The Go fonts are divided into two sets, Go proportional, which is sans-serif, and Go Mono, which is slab-serif. - * Go proportional fonts - ** Sans-serif Go proportional fonts are sans-serif, like several popular fonts -for screen displays. There is some evidence that some sans-serif -faces at small sizes and low resolutions on screens are slightly -more legible than their seriffed counterparts, while at large sizes, -there is not a significant difference in legibility between sans and +for screen displays. There is some evidence that some sans-serif +faces at small sizes and low resolutions on screens are slightly +more legible than their seriffed counterparts, while at large sizes, +there is not a significant difference in legibility between sans and seriffed faces, at least in the pair tested. [1] (The bracketed numbers refer to the references listed at the end of this article.) - ** Style Go sans-serif fonts are "humanist" rather than "grotesque" in -style. This is an historical distinction, not an aesthetic judgment. -Widely used sans-serif fonts like Helvetica and Arial are called -grotesque because an early 19th century sans-serif typeface -was named "Grotesque," and the name became generic. - - -The shapes of modern grotesque fonts like Helvetica are sculpted, -with smooth, assimilated forms. +style. This is an historical distinction, not an aesthetic judgment. +Widely used sans-serif fonts like Helvetica and Arial are called +grotesque because an early 19th century sans-serif typeface +was named "Grotesque," and the name became generic. +The shapes of modern grotesque fonts like Helvetica are sculpted, +with smooth, assimilated forms. -Humanist sans-serifs are derived from Humanist handwriting -and early fonts of the Italian Renaissance and still show subtle +Humanist sans-serifs are derived from Humanist handwriting +and early fonts of the Italian Renaissance and still show subtle traces of pen-written calligraphy. There is some evidence that -humanist fonts are more legible than grotesque fonts. [2] - +humanist fonts are more legible than grotesque fonts. [2] ** Italics -Go proportional italics have the same width metrics as the roman +Go proportional italics have the same width metrics as the roman fonts. Go italics are oblique versions of the romans, with one -noticeable exception: the italic lowercase 'a' is redesigned as a -cursive single-story form to harmonize with the bowl shapes of +noticeable exception: the italic lowercase 'a' is redesigned as a +cursive single-story form to harmonize with the bowl shapes of the b d g p q set, in which the upright forms also adapt well to -slanting, The addition of cursive 'a' makes the italics appear more -lively than a simply slanted roman. Some typographers believe that +slanting, The addition of cursive 'a' makes the italics appear more +lively than a simply slanted roman. Some typographers believe that slanted roman sans-serif italics are preferable to truly "cursive" sans Italics, in part because of history and design. [3] @@ -116,101 +107,92 @@ Italics, in part because of history and design. [3] ** The x-height -The x-height of a typeface is the height of the lowercase 'x' relative +The x-height of a typeface is the height of the lowercase 'x' relative to the body size. The x-height of Go fonts is 53.0% of body size, a bit larger than the x-heights of Helvetica (52.3%) or Arial (51.9%), -but the difference is usually unnoticeable at normal reading sizes. -Typographers believe that larger x-heights contribute to greater +but the difference is usually unnoticeable at normal reading sizes. +Typographers believe that larger x-heights contribute to greater legibility in small sizes and on screens. A study of "print size" -(particularly x-height) and reading noted that types for reading on +(particularly x-height) and reading noted that types for reading on screens and for small sizes tend to have large x-heights. [4] - ** DIN Legibility Standard The recent German DIN 1450 legibility standard recommends several features for font legibility, including differentiation of -letter shapes to reduce confusion. The Go fonts conform to the +letter shapes to reduce confusion. The Go fonts conform to the 1450 standard by carefully differentiating zero from capital O; -numeral 1 from capital I (eye) and lowercase l (ell); numeral 5 from +numeral 1 from capital I (eye) and lowercase l (ell); numeral 5 from capital S; and numeral 8 from capital B. The shapes of bowls of -b d p q follow the natural asymmetries of legible Renaissance +b d p q follow the natural asymmetries of legible Renaissance handwriting, aiding differentiation to reduce confusion. [5] - ** Weights -The Go proportional fonts come in three weights: Normal, Medium, -and Bold. The Normal weight is strong enough that it maintains -clarity on backlit screens, which often tend to erode letter features -and thickness. The Medium weight has stem thickness 1.25 times +The Go proportional fonts come in three weights: Normal, Medium, +and Bold. The Normal weight is strong enough that it maintains +clarity on backlit screens, which often tend to erode letter features +and thickness. The Medium weight has stem thickness 1.25 times the Normal, for greater sturdiness on bright screens or for users -who prefer a sturdy font. The Bold weight has stem thickness +who prefer a sturdy font. The Bold weight has stem thickness 1.5 times the Normal, bold enough to be distinct from the normal -weight. These Go fonts have CSS numerical weights of 400, 500, -and 600. Although CSS specifies "Bold" as a 700 weight and 600 -as Semibold or Demibold, the Go numerical weights match the -actual progression of the ratios of stem thicknesses: +weight. These Go fonts have CSS numerical weights of 400, 500, +and 600. Although CSS specifies "Bold" as a 700 weight and 600 +as Semibold or Demibold, the Go numerical weights match the +actual progression of the ratios of stem thicknesses: Normal:Medium = 400:500; Normal:Bold = 400:600. The Bold weight name matches the use of “Bold” as the usual corresponding bold weight of a normal font. More discussion of the relationship of stem thicknesses, weight names, and CSS numbering is in [6]. - ** WGL4 character set The WGL4 character set, originally developed by Microsoft, is often -used as an informal standard character set. WGL4 includes Western -and Eastern European Latin characters plus Modern Greek and +used as an informal standard character set. WGL4 includes Western +and Eastern European Latin characters plus Modern Greek and Cyrillic, with additional symbols, signs, and graphical characters, -totalling more than 650 characters in all. The Go WGL4 fonts can +totalling more than 650 characters in all. The Go WGL4 fonts can be used to compose a wide range of languages. [7] - ** Metric compatibility with Arial and Helvetica -The Go sans-serif fonts are nearly metrically compatible with +The Go sans-serif fonts are nearly metrically compatible with standard Helvetica or Arial characters. Texts set in Go occupy -nearly the same space as texts in Helvetica or Arial (at the same +nearly the same space as texts in Helvetica or Arial (at the same size), but Go has a different look and texture because of its -humanist style. Some Go letters with DIN legibility features are -wider than corresponding letters in Helvetica or Arial, so some -texts set in Go may take slightly more space. - +humanist style. Some Go letters with DIN legibility features are +wider than corresponding letters in Helvetica or Arial, so some +texts set in Go may take slightly more space. * Go Mono fonts - ** Monospaced Go Mono fonts are monospaced—each letter has the same width as -the other letters. Monospaced fonts have been used in programming +the other letters. Monospaced fonts have been used in programming since the beginning of computing and are still widely used because the -typewriter regularity of their spacing makes text align in columns and -rows, a style also found in Greek inscriptions of the 5th century BC. -(The ancient Greeks didn't have typewriters or computer keyboards, +typewriter regularity of their spacing makes text align in columns and +rows, a style also found in Greek inscriptions of the 5th century BC. +(The ancient Greeks didn't have typewriters or computer keyboards, but they did have great mathematicians and a great sense of symmetry and pattern that shaped their alphabet.) - ** Slab-serif -The Go Mono fonts have slab-shaped serifs, giving them a sturdy -appearance. - +The Go Mono fonts have slab-shaped serifs, giving them a sturdy +appearance. ** Style -The underlying letter shapes of Go Mono are, like the Go sans-serif fonts, -derived from humanist handwriting, but the monospacing and slab serifs -tend to obscure the historical and stylistic connections. - +The underlying letter shapes of Go Mono are, like the Go sans-serif fonts, +derived from humanist handwriting, but the monospacing and slab serifs +tend to obscure the historical and stylistic connections. ** Italics Go Mono Italics are oblique versions of the romans, with the exception -that the italic lowercase 'a' is redesigned as a cursive single-story form -to harmonize with the bowl shapes of the b d g p q. The cursive 'a' makes +that the italic lowercase 'a' is redesigned as a cursive single-story form +to harmonize with the bowl shapes of the b d g p q. The cursive 'a' makes the italics appear more lively than a simply slanted roman. As with many sans-serif fonts, it is believed that slanted roman slab-serifs fonts may be more legible than truly "cursive" italics. @@ -220,88 +202,74 @@ be more legible than truly "cursive" italics. ** The x-height Go Mono fonts have the same x-height as Go sans-serif fonts, 53% of -the body size. Go Mono looks almost 18% bigger than Courier, which +the body size. Go Mono looks almost 18% bigger than Courier, which has an x-height 45% of body size. Yet Go Mono has the same width as Courier, so the bigger look is gained with no loss of economy in -characters per line. - +characters per line. ** DIN Legibility Standard -Go Mono fonts conform to the DIN 1450 standard by differentiating -zero from capital O; numeral 1 from capital I (eye) and lowercase l (ell); -numeral 5 from capital S; and numeral 8 from capital B. The shapes of -bowls of b d p q follow the natural asymmetries of legible Renaissance -handwriting, aiding differentiation and reducing confusion. - +Go Mono fonts conform to the DIN 1450 standard by differentiating +zero from capital O; numeral 1 from capital I (eye) and lowercase l (ell); +numeral 5 from capital S; and numeral 8 from capital B. The shapes of +bowls of b d p q follow the natural asymmetries of legible Renaissance +handwriting, aiding differentiation and reducing confusion. ** Weights -Go Mono fonts have two weights: Normal and Bold. The normal weight -stem is the same as in Go Normal and thus maintains clarity on backlit +Go Mono fonts have two weights: Normal and Bold. The normal weight +stem is the same as in Go Normal and thus maintains clarity on backlit screens, which tend to erode letter features and stem thickness. The bold stem thickness is 1.5 times thicker than the normal weight, hence -the Bold Mono has the same stem thickness as Bold Go proportional. -Because the letter width of monospaced bold is identical to the width of -monospaced normal, the bold Mono appears slightly bolder than the +the Bold Mono has the same stem thickness as Bold Go proportional. +Because the letter width of monospaced bold is identical to the width of +monospaced normal, the bold Mono appears slightly bolder than the proportional Go Bold, as more black pixels are put into the same area.) - ** Metric compatibility with popular monospaced fonts Go Mono is metrically compatible with Courier and other monospaced -fonts that match the "Pica" typewriter type widths of 10 characters per -linear inch at 12 point. At 10 point, Go Mono fonts set 12 characters +fonts that match the "Pica" typewriter type widths of 10 characters per +linear inch at 12 point. At 10 point, Go Mono fonts set 12 characters per inch. The TrueType fonts are scalable, of course, so Go Mono can -be set at any size. - +be set at any size. ** WGL4 character set The Go Mono fonts offer the WGL4 character set often used as an -informal standard character set. WGL4 includes Western and Eastern -European Latin characters plus Modern Greek and Cyrillic, with -additional symbols, signs, and graphical characters. The 650+ characters +informal standard character set. WGL4 includes Western and Eastern +European Latin characters plus Modern Greek and Cyrillic, with +additional symbols, signs, and graphical characters. The 650+ characters of the Go WGL4 sets can be used for a wide range of languages. - - - * References - [1] Morris, R. A., Aquilante, K., Yager, D., & Bigelow, C. (2002, May). P‐13: Serifs Slow RSVP Reading at Very Small Sizes, but Don't Matter at Larger Sizes. In SID Symposium Digest of Technical Papers (Vol. 33, No. 1, pp. 244-247). Blackwell Publishing Ltd. - [2] Bryan Reimer et al. (2014) “Assessing the impact of typeface design in a text-rich automotive user interface”, Ergonomics, 57:11, 1643-1658. http://www.tandfonline.com/doi/abs/10.1080/00140139.2014.940000 - [3] Adrian Frutiger - Typefaces: The Complete Works. H. Osterer and P. Stamm, editors. Birkhäuser, Basel, 2009, page 257. - [4] Legge, G. E., & Bigelow, C. A. (2011). Does print size matter for reading? A review of findings from vision science and typography. Journal of Vision, 11(5), 8-8. http://jov.arvojournals.org/article.aspx?articleid=2191906 - -[5] Charles Bigelow. "Oh, oh, zero!" TUGboat, Volume 34 (2013), No. 2. +[5] Charles Bigelow. "Oh, oh, zero!" TUGboat, Volume 34 (2013), No. 2. https://tug.org/TUGboat/tb34-2/tb107bigelow-zero.pdf https://tug.org/TUGboat/tb34-2/tb107bigelow-wang.pdf - [6] "Lucida Basic Font Weights" Bigelow & Holmes. http://lucidafonts.com/pages/facts - [7] WGL4 language coverage: Afrikaans, Albanian, Asu, Basque, Belarusian, Bemba, Bena, Bosnian, Bulgarian, Catalan, Chiga, Colognian, Cornish, Croatian, Czech, Danish, Embu, English, Esperanto, diff --git a/content/go-imagedraw-package.article b/content/go-imagedraw-package.article index 2e9dade..a28bc5d 100644 --- a/content/go-imagedraw-package.article +++ b/content/go-imagedraw-package.article @@ -77,7 +77,6 @@ a [[https://golang.org/pkg/image/draw/#Image][`draw.Image`]] interface which has Set(x, y int, c color.Color) } - * Filling a Rectangle To fill a rectangle with a solid color, use an `image.Uniform` source. @@ -102,10 +101,8 @@ use `image.Transparent`, which is an `image.Uniform`: draw.Draw(m, m.Bounds(), image.Transparent, image.ZP, draw.Src) - .image go-imagedraw-package_2a.png - * Copying an Image To copy from a rectangle `sr` in the source image to a rectangle starting @@ -115,19 +112,15 @@ convert the source rectangle into the destination image's co-ordinate space: r := image.Rectangle{dp, dp.Add(sr.Size())} draw.Draw(dst, r, src, sr.Min, draw.Src) - Alternatively: r := sr.Sub(sr.Min).Add(dp) draw.Draw(dst, r, src, sr.Min, draw.Src) - To copy the entire source image, use `sr`=`src.Bounds()`. - .image go-imagedraw-package_2b.png - * Scrolling an Image Scrolling an image is just copying an image to itself, @@ -143,10 +136,8 @@ To scroll an image m by 20 pixels: draw.Draw(m, b, m, b.Min.Add(p), draw.Src) dirtyRect := b.Intersect(image.Rect(b.Min.X, b.Max.Y-20, b.Max.X, b.Max.Y)) - .image go-imagedraw-package_2c.png - * Converting an Image to RGBA The result of decoding an image format might not be an `image.RGBA`: @@ -159,7 +150,6 @@ To convert any image to an `image.RGBA`: m := image.NewRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) draw.Draw(m, m.Bounds(), src, b.Min, draw.Src) - .image go-imagedraw-package_2d.png * Drawing Through a Mask @@ -189,7 +179,6 @@ To draw an image through a circular mask with center `p` and radius `r`: draw.DrawMask(dst, dst.Bounds(), src, image.ZP, &circle{p, r}, image.ZP, draw.Over) - .image go-imagedraw-package_2e.png * Drawing Font Glyphs @@ -206,7 +195,6 @@ or correcting for a font's height above a baseline. .image go-imagedraw-package_2f.png - * Performance The image/draw package implementation demonstrates how to provide an image diff --git a/content/go-maps-in-action.article b/content/go-maps-in-action.article index 70fbb8d..9298c0d 100644 --- a/content/go-maps-in-action.article +++ b/content/go-maps-in-action.article @@ -211,7 +211,6 @@ containing a map and an embedded `sync.RWMutex`. To read from the counter, take the read lock: - counter.RLock() n := counter.m["some_key"] counter.RUnlock() diff --git a/content/go-one-year-ago-today.article b/content/go-one-year-ago-today.article index 9391919..5282a5c 100644 --- a/content/go-one-year-ago-today.article +++ b/content/go-one-year-ago-today.article @@ -129,7 +129,7 @@ many of which were driven by feedback from the community. [[https://golang.org/doc/go_spec.html#Function_Types][spec]], [[https://golang.org/doc/go_spec.html#Passing_arguments_to_..._parameters][ spec]], [[https://golang.org/doc/devel/release.html#2010-09-29][release.2010-09-29]] - + Go is certainly ready for production use, but there is still room for improvement. Our focus for the immediate future is making Go programs faster and more diff --git a/content/go-slices-usage-and-internals.article b/content/go-slices-usage-and-internals.article index 5a9b890..f200f54 100644 --- a/content/go-slices-usage-and-internals.article +++ b/content/go-slices-usage-and-internals.article @@ -148,7 +148,7 @@ Therefore, modifying the _elements_ (not the slice itself) of a re-slice modifies the elements of the original slice: d := []byte{'r', 'o', 'a', 'd'} - e := d[2:] + e := d[2:] // e == []byte{'a', 'd'} e[1] = 'm' // e == []byte{'a', 'm'} @@ -233,7 +233,7 @@ But most programs don't need complete control, so Go provides a built-in `append` function that's good for most purposes; it has the signature - func append(s []T, x ...T) []T + func append(s []T, x ...T) []T The `append` function appends the elements `x` to the end of the slice `s`, and grows the slice if a greater capacity is needed. diff --git a/content/go-version-1-is-released.article b/content/go-version-1-is-released.article index c415f87..7267bf3 100644 --- a/content/go-version-1-is-released.article +++ b/content/go-version-1-is-released.article @@ -7,6 +7,7 @@ Andrew Gerrand * Introduction .image go-version-1-is-released_gophermega.jpg + Today marks a major milestone in the development of the Go programming language. We're announcing Go version 1, or Go 1 for short, which defines a language and a set of core libraries to provide a stable diff --git a/content/go-whats-new-in-march-2010.article b/content/go-whats-new-in-march-2010.article index 572a58f..ad019e5 100644 --- a/content/go-whats-new-in-march-2010.article +++ b/content/go-whats-new-in-march-2010.article @@ -8,10 +8,10 @@ Andrew Gerrand Welcome to the official Go Blog. We, the Go team, hope to use this blog to keep the world up-to-date on the development of the Go programming language and the growing ecosystem of libraries and applications surrounding it. - + It's been a few months since we launched (November last year), so let's talk about what's been happening in Go World since then. - + The core team at Google has continued to develop the language, compilers, packages, tools, and documentation. The compilers now produce code that is in some cases between 2x and an order @@ -19,7 +19,7 @@ of magnitude faster than at release. We have put together some graphs of a selection of [[http://godashboard.appspot.com/benchmarks][Benchmarks]], and the [[http://godashboard.appspot.com/][Build Status]] page tracks the reliability of each changeset submitted to the repository. - + We have made syntax changes to make the language more concise, regular, and flexible. Semicolons have been [[http://groups.google.com/group/golang-nuts/t/5ee32b588d10f2e9][almost entirely removed]] from the language. @@ -28,7 +28,7 @@ makes it simpler to handle an arbitrary number of typed function parameters. The syntax x[lo:] is now shorthand for x[lo:len(x)]. Go also now natively supports complex numbers. See the [[https://golang.org/doc/devel/release.html][release notes]] for more. - + [[https://golang.org/cmd/godoc/][Godoc]] now provides better support for third-party libraries, and a new tool - [[https://golang.org/cmd/goinstall][goinstall]] - has been @@ -36,10 +36,10 @@ released to make it easy to install them. Additionally, we've started working on a package tracking system to make it easier to find what you need. You can view the beginnings of this on the [[http://godashboard.appspot.com/package][Packages page]]. - + More than 40,000 lines of code have been added to [[https://golang.org/pkg/][the standard library]], including many entirely new packages, a sizable portion written by external contributors. - + Speaking of third parties, since launch a vibrant community has flourished on our [[http://groups.google.com/group/golang-nuts/][mailing list]] and irc channel (#go-nuts on freenode). @@ -48,7 +48,7 @@ Their contributions range from bug fixes and documentation corrections to core packages and support for additional operating systems (Go is now supported under FreeBSD, and a [[http://code.google.com/p/go/wiki/WindowsPort][Windows port]] is underway). We regard these community contributions our greatest success so far. - + We've received some good reviews, too. This [[http://www.pcworld.idg.com.au/article/337773/google_go_captures_developers_imaginations/][recent article in PC World]] summarized the enthusiasm surrounding the project. Several bloggers have begun documenting their experiences in the language @@ -57,7 +57,7 @@ Several bloggers have begun documenting their experiences in the language and [[http://freecella.blogspot.com/2010/01/gospecify-basic-setup-of-projects.html][here]] for example) The general reaction of our users has been very positive; one first-timer remarked [[https://groups.google.com/group/golang-nuts/browse_thread/thread/5fabdd59f8562ed2]["I came away extremely impressed. Go walks an elegant line between simplicity and power."]] - + As to the future: we have listened to the myriad voices telling us what they need, and are now focused on getting Go ready for the prime time. We are improving the garbage collector, runtime scheduler, diff --git a/content/go1.13-errors.article b/content/go1.13-errors.article index 8c8c029..a3aa755 100644 --- a/content/go1.13-errors.article +++ b/content/go1.13-errors.article @@ -13,7 +13,6 @@ which produce errors that contain only a message—the built-in `error` interfac allows Go programmers to add whatever information they desire. All it requires is a type that implements an `Error` method: - type QueryError struct { Query string Err error @@ -68,7 +67,6 @@ value as a more specific type. // e.Name wasn't found } - ** Adding information Frequently a function passes an error up the call stack while adding information @@ -85,7 +83,6 @@ error except the text. As we saw above with `QueryError`, we may sometimes want to define a new error type that contains the underlying error, preserving it for inspection by code. Here is `QueryError` again: - type QueryError struct { Query string Err error @@ -99,7 +96,6 @@ error. // query failed because of a permission problem } - The `os.PathError` type in the standard library is another example of one error which contains another. * Errors in Go 1.13 @@ -123,7 +119,7 @@ the sequence of errors produced by repeated unwrapping the _error_chain_. ** Examining errors with Is and As -The Go 1.13 `errors` package includes two new functions for examining errors: `Is` and `As`. +The Go 1.13 `errors` package includes two new functions for examining errors: `Is` and `As`. The `errors.Is` function compares an error to a value. @@ -158,7 +154,6 @@ Using the `errors.Is` function, we can write this as: // err, or some error that it wraps, is a permission problem } - The `errors` package also includes a new `Unwrap` function which returns the result of calling an error's `Unwrap` method, or `nil` when the error has no `Unwrap` method. It is usually better to use `errors.Is` or `errors.As`, @@ -188,7 +183,6 @@ Wrapping an error with `%w` makes it available to `errors.Is` and `errors.As`: ... if errors.Is(err, ErrPermission) ... - ** Whether to Wrap When adding additional context to an error, either with `fmt.Errorf` or by diff --git a/content/go2draft.article b/content/go2draft.article index 97ace9a..e1e4715 100644 --- a/content/go2draft.article +++ b/content/go2draft.article @@ -15,4 +15,4 @@ For a quick overview, watch this short message we just played at Gophercon 2018: We invite everyone in the Go community to [[https://go.googlesource.com/proposal/+/master/design/go2draft.md][learn more about the designs]] -and help us improve them. +and help us improve them. diff --git a/content/gopherchina.article b/content/gopherchina.article index 31587c8..bae456e 100644 --- a/content/gopherchina.article +++ b/content/gopherchina.article @@ -152,4 +152,3 @@ successor conference in Beijing. It appears that we have found the Go users in China: They are everywhere! _Some_of_the_GopherChina_materials,_including_videos,_are_now_available_alongside_Go_coursework_on_a_ [[http://www.imooc.com/view/407][_3rd_party_site_]]. - diff --git a/content/gophercon2015.article b/content/gophercon2015.article index 9dae87b..e41bd70 100644 --- a/content/gophercon2015.article +++ b/content/gophercon2015.article @@ -12,7 +12,6 @@ more than 1,250 attendees—nearly double last year's number—and featured 22 talks presented by Go community members. .image gophercon2015.jpg _ 550 - .html gophercon2015.caption Today the organizers have posted the videos online so you can now enjoy the diff --git a/content/gouk15.article b/content/gouk15.article index 513c500..a780e45 100644 --- a/content/gouk15.article +++ b/content/gouk15.article @@ -10,7 +10,7 @@ On August 21st the Go community gathered in London for the first edition of [[https://golanguk.com][Golang UK]]. The conference featured two parallel tracks and nearly 400 gophers attended. -.image gouk15/gouk.jpg 300 _ +.image gouk15/gouk.jpg 300 _ The conference started with the opening keynote by [[https://twitter.com/calavera][David Calavera]] called Crossing the Language Chasm ([[https://www.youtube.com/watch?v=JPVRnEZ4v_w&list=PLDWZ5uzn69ezRJYeWxYNRMYebvf8DerHd][video]]) diff --git a/content/h2push.article b/content/h2push.article index 519eb92..87e3649 100644 --- a/content/h2push.article +++ b/content/h2push.article @@ -60,7 +60,6 @@ A fully working example is available at: $ go get golang.org/x/blog/content/h2push/server - If you run the server and load [[https://localhost:8080][https://localhost:8080]], your browser's developer tools should show that `app.js` and `style.css` were pushed by the server. @@ -74,12 +73,10 @@ of the response. Otherwise it is possible to accidentally generate duplicate responses. For example, suppose you write part of an HTML response: - <html> <head> <link rel="stylesheet" href="a.css">... - Then you call Push("a.css", nil). The browser may parse this fragment of HTML before it receives your PUSH_PROMISE, in which case the browser will send a request for `a.css` in addition to receiving your diff --git a/content/introducing-go-playground.article b/content/introducing-go-playground.article index 34fdcca..41087da 100644 --- a/content/introducing-go-playground.article +++ b/content/introducing-go-playground.article @@ -12,6 +12,7 @@ make it easier to find. These changes are also reflected in the web interface of [[https://golang.org/cmd/godoc/][godoc]], the Go documentation tool. But the real news is a prominent new feature: the [[https://golang.org/][Go Playground]]. + .image introducing-go-playground_Untitled.png The Playground allows anyone with a web browser to write Go code that we diff --git a/content/introducing-gofix.article b/content/introducing-gofix.article index ebe4e55..93c6853 100644 --- a/content/introducing-gofix.article +++ b/content/introducing-gofix.article @@ -70,7 +70,7 @@ As an example, gofix can rewrite code like [[http://codereview.appspot.com/43530 // Byte slices are special. if f.Type().(reflect.ArrayOrSliceType).Elem().Kind() == reflect.Uint8 { // ... - } + } // ... } @@ -86,7 +86,7 @@ to adapt it to the new reflect API: // Byte slices are special. if f.Type().Elem().Kind() == reflect.Uint8 { // ... - } + } // ... } diff --git a/content/io2014.article b/content/io2014.article index c0b945d..d3dded7 100644 --- a/content/io2014.article +++ b/content/io2014.article @@ -60,7 +60,6 @@ soon. - SourceGraph: a Code Search Engine in Go, by Quinn Slack. ([[https://youtu.be/-DpKaoPz8l8][video]] and [[https://go-talks.appspot.com/github.com/sourcegraph/talks/google-io-2014/gio2014.slide#1][slides]]) - We also organized Q&A sessions and lightning talks by members of the Go community: @@ -84,4 +83,4 @@ to anyone through the Google I/O extended brand. You can try it yourself at * Conclusion Thanks to the organizers, speakers, and attendees who helped make these events a -great success. See you next year. (Or at [[http://dotgo.eu][dotGo]] this week!)
\ No newline at end of file +great success. See you next year. (Or at [[http://dotgo.eu][dotGo]] this week!) diff --git a/content/ismmkeynote.article b/content/ismmkeynote.article index 2e1f91d..33b2227 100644 --- a/content/ismmkeynote.article +++ b/content/ismmkeynote.article @@ -5,6 +5,7 @@ Rick Hudson rlh@golang.org * Abstract + This is the transcript from the keynote I gave at the International Symposium on Memory Management (ISMM) on June 18, 2018. For the past 25 years ISMM has been the premier venue for publishing memory @@ -12,6 +13,7 @@ management and garbage collection papers and it was an honor to have been invited to give the keynote. ** Abstract + The Go language features, goals, and use cases have forced us to rethink the entire garbage collection stack and have led us to a surprising place. The journey has been exhilarating. This talk describes our journey. @@ -21,6 +23,7 @@ This talk will provide insight into the how and the why of our journey, where we are in 2018, and Go's preparation for the next part of the journey. ** Bio + Richard L. Hudson (Rick) is best known for his work in memory management including the invention of the Train, Sapphire, and Mississippi Delta algorithms as well as GC stack maps which @@ -546,6 +549,7 @@ So how do you do promoting. If you find something marked with a 1 pointing to something marked with a 0 then you promote the referent simply by setting that zero to a one. .image ismmkeynote/image49.png + You have to do a transitive walk to make sure all reachable objects are promoted. .image ismmkeynote/image69.png @@ -734,7 +738,6 @@ In other words a DRAM memory cell. Put another way, we think that doubling memory is going to be a better value than doubling cores. - [[http://www.kurzweilai.net/ask-ray-the-future-of-moores-law][Original graph]] at www.kurzweilai.net/ask-ray-the-future-of-moores-law. @@ -749,8 +752,6 @@ using drum memory and that capacity and Moore's law were chugging along together so this graph has been going on for a long time, certainly longer than probably anybody in this room has been alive. - - If we compare this graph to CPU frequency or the various Moore's-law-is-dead graphs, we are led to the conclusion that memory, or at least chip capacity, will follow Moore's law longer than CPUs. diff --git a/content/normalization.article b/content/normalization.article index fd80e9c..636eac8 100644 --- a/content/normalization.article +++ b/content/normalization.article @@ -280,4 +280,3 @@ This article briefly mentioned the existence of other go.text packages as well as multilingual text processing and it may have raised more questions than it has given answers. The discussion of these topics, however, will have to wait until another day. - diff --git a/content/open-source.article b/content/open-source.article index 2fa797a..9ee5324 100644 --- a/content/open-source.article +++ b/content/open-source.article @@ -95,7 +95,7 @@ in the software industry. Other people have made similar observations. Here are two. Last year, on RedMonk.com, Donnie Berkholz -wrote about +wrote about “[[http://redmonk.com/dberkholz/2014/03/18/go-the-emerging-language-of-cloud-infrastructure/][Go as the emerging language of cloud infrastructure]],” observing that “[Go's] marquee projects ... are cloud-centric or otherwise @@ -125,7 +125,7 @@ but I think there is a broader idea behind them. I think of that idea as Go's balance. There are competing concerns in any software design, -and there is a very natural tendency to try to solve +and there is a very natural tendency to try to solve all the problems you foresee. In Go, we have explicitly tried not to solve everything. Instead, we've tried to do just enough that you can build @@ -141,7 +141,7 @@ But if we work at it, Go can probably do a few things well. If we select those things carefully, -we can lay a foundation +we can lay a foundation on which developers can _easily_ build the solutions and tools they need, and ideally can interoperate with @@ -275,7 +275,7 @@ to build in directly. But we knew one thing that we had to do. In our experience attempting automated program changes in other settings, -the most significant barrier we hit +the most significant barrier we hit was actually writing the modified program out in a format that developers can accept. @@ -307,7 +307,7 @@ I believe the work here is only just getting started. Even more can be done. Last, building and sharing software. -In the run up to Go 1, we built goinstall, +In the run up to Go 1, we built goinstall, which became what we all know as "go get". That tool defined a standard zero-configuration way to resolve import paths on sites like github.com, @@ -375,7 +375,7 @@ worked on open source projects before Go, and we naturally wanted Go to be part of that open source world. But our preferences are not a business justification. -The business justification is that +The business justification is that Go is open source because that's the only way that Go can succeed. @@ -445,7 +445,7 @@ But we also opened our development process: since announcing Go, we've done all our development in public, on public mailing lists open to all. -We accept and review +We accept and review source code contributions from anyone. The process is the same whether you work for Google or not. @@ -515,7 +515,7 @@ In the very early days, before Go was known to the public, the Go team at Google was obviously working by itself. -We wrote the first draft of everything: +We wrote the first draft of everything: the specification, the compiler, the runtime, @@ -633,7 +633,7 @@ should have the opportunity to be heard. I want to share some evidence for this claim that, over time, the original Go team at Google -is focusing more on +is focusing more on coordination than direct development. First, the sources of funding @@ -739,7 +739,7 @@ with this vendoring problem, we left it to users outside Google to develop solutions. Over the past five years, people have built a series of tools. -The main ones in use today are +The main ones in use today are Keith Rarick's godep, Owen Ou's nut, and the gb-vendor plugin for Dave Cheney's gb, @@ -816,7 +816,7 @@ is that at the next Gophercon we should have broad interoperability between vendoring tools and the go command, and the design to make that happen -was done entirely by contributors +was done entirely by contributors outside the original Go team. Not only that, @@ -845,7 +845,7 @@ coming from the broader Go community is important for Go. You, the broader Go community, know what is working -and what is not +and what is not in the environments where you use Go. We at Google don't. More and more, @@ -903,7 +903,7 @@ it's important to understand that this kind of spec cannot be as precise as a language spec. We must start with the assumption -that we will all be reasonable in applying it. +that we will all be reasonable in applying it. This kind of spec is often referred to as diff --git a/content/playground.article b/content/playground.article index c1eb6e5..657624d 100644 --- a/content/playground.article +++ b/content/playground.article @@ -27,7 +27,6 @@ The implementation involves a variant operating system environment and runtime and our description here assumes you have some familiarity with systems programming using Go. - * Overview .image playground/overview.png @@ -43,7 +42,6 @@ The playground service has three parts: It also does some caching. - A JavaScript client that implements the user interface and makes HTTP requests to the front end. - * The back end The back end program itself is trivial, so we won't discuss its implementation @@ -82,7 +80,6 @@ fake file system, making the playground's tool chain similar to a normal Go tool chain. These facilities are described in the following sections. - ** Faking time Playground programs are limited in the amount of CPU time and memory they can @@ -182,7 +179,6 @@ The JavaScript client (running in the user's web browser) then plays back the events using the provided delay intervals. To the user it appears that the program is running in real time. - ** Faking the file system Programs built with the Go's NaCl tool chain cannot access the local machine's @@ -245,7 +241,6 @@ There are several implementations of the interface: program's only way to interact with the outside world), - network sockets have their own implementation, discussed in the next section. - ** Faking the network Like the file system, the playground's network stack is an in-process fake @@ -268,7 +263,6 @@ The implementation can be found in [[https://github.com/golang/go/blob/master/sr A good place to start reading is [[https://github.com/golang/go/blob/master/src/syscall/net_nacl.go#L461][`netFile`]], the network socket implementation of the `fileImpl` interface. - * The front end The playground front end is another simple program (shorter than 100 lines). @@ -290,7 +284,6 @@ If there is no cached response, the front end makes an RPC request to the back end, stores the response in memcache, parses the playback events, and returns a JSON object to the client as the HTTP response (as described above). - * The client The various sites that use the playground each share some common JavaScript @@ -324,7 +317,6 @@ the various web servers (godoc, for instance) proxy requests to The common [[https://godoc.org/golang.org/x/tools/playground][`golang.org/x/tools/playground`]] package does this proxying. - * Playing offline Both the [[https://tour.golang.org][Go Tour]] and the @@ -342,7 +334,6 @@ The WebSocket back end implementation can be found in the [[https://godoc.org/golang.org/x/tools/playground/socket][`golang.org/x/tools/playground/socket`]] package. The [[https://talks.golang.org/2012/insidepresent.slide#1][Inside Present]] talk discusses this code in detail. - * Other clients The playground service is used by more than just the official Go project @@ -352,7 +343,6 @@ you [[mailto:golang-dev@googlegroups.com][contact us first]], use a unique user agent in your requests (so we can identify you), and that your service is of benefit to the Go community. - * Conclusion From godoc to the tour to this very blog, the playground has become an diff --git a/content/profiling-go-programs.article b/content/profiling-go-programs.article index e7c90a7..9959076 100644 --- a/content/profiling-go-programs.article +++ b/content/profiling-go-programs.article @@ -263,7 +263,7 @@ and cut its run time by nearly a factor of two: $ ./xtime ./havlak2 # of loops: 76000 (including 1 artificial root node) 16.55u 0.11s 16.69r 1321008kB ./havlak2 - $ + $ (See the [[https://github.com/rsc/benchgraffiti/commit/58ac27bcac3ffb553c29d0b3fb64745c91c95948][diff between `havlak1` and `havlak2`]]) @@ -315,7 +315,8 @@ We invoke the program with `-memprofile` flag to write a profile: $ make havlak3.mprof go build havlak3.go ./havlak3 -memprofile=havlak3.mprof - $ + $ + (See the [[https://github.com/rsc/benchgraffiti/commit/b78dac106bea1eb3be6bb3ca5dba57c130268232][diff from havlak2]]) We use `go tool pprof` exactly the same way. Now the samples we are examining are @@ -372,7 +373,6 @@ simpler data structures suffice. As an aside, if we run `go tool pprof` with the `--inuse_objects` flag, it will report allocation counts instead of sizes: - $ go tool pprof --inuse_objects havlak3 havlak3.mprof Adjusting heap profiles for 1-in-524288 sampling rate Welcome to pprof! For help, type 'help'. @@ -424,7 +424,8 @@ of maps requires changing just a few lines of code. $ ./xtime ./havlak4 # of loops: 76000 (including 1 artificial root node) 11.84u 0.08s 11.94r 810416kB ./havlak4 - $ + $ + (See the [[https://github.com/rsc/benchgraffiti/commit/245d899f7b1a33b0c8148a4cd147cb3de5228c8a][diff from havlak3]]) We're now at 2.11x faster than when we started. Let's look at a CPU profile again. @@ -566,6 +567,7 @@ track this memory, restoring the possibility of concurrent use. # of loops: 76000 (including 1 artificial root node) 8.03u 0.06s 8.11r 770352kB ./havlak5 $ + (See the [[https://github.com/rsc/benchgraffiti/commit/2d41d6d16286b8146a3f697dd4074deac60d12a4][diff from havlak4]]) There's more we can do to clean up the program and make it faster, but none of @@ -587,7 +589,7 @@ The final version runs in 2.29 seconds and uses 351 MB of memory: $ ./xtime ./havlak6 # of loops: 76000 (including 1 artificial root node) 2.26u 0.02s 2.29r 360224kB ./havlak6 - $ + $ That's 11 times faster than the program we started with. Even if we disable reuse of the generated loop graph, so that the only cached memory @@ -620,6 +622,7 @@ cache, the C++ program a bit shorter and easier to write, but not dramatically s 401 1220 9040 havlak6.cc 461 1441 9467 havlak6.go $ + (See [[https://github.com/rsc/benchgraffiti/blob/master/havlak/havlak6.cc][havlak6.cc]] and [[https://github.com/rsc/benchgraffiti/blob/master/havlak/havlak6.go][havlak6.go]]) diff --git a/content/qihoo.article b/content/qihoo.article index ccd16bc..7f90ed8 100644 --- a/content/qihoo.article +++ b/content/qihoo.article @@ -89,7 +89,6 @@ status, pinning down any potential risks. Here is a screen shot of the system in action: .image qihoo/image02.png - .image qihoo/image03.png The great thing about this platform is that we can actually simulate the diff --git a/content/race-detector.article b/content/race-detector.article index ef61a5c..1a284f2 100644 --- a/content/race-detector.article +++ b/content/race-detector.article @@ -139,7 +139,7 @@ A simpler but less efficient approach is to The second example is more subtle. The `ioutil` package's -[[https://golang.org/pkg/io/ioutil/#Discard][`Discard`]] object implements +[[https://golang.org/pkg/io/ioutil/#Discard][`Discard`]] object implements [[https://golang.org/pkg/io/#Writer][`io.Writer`]], but discards all the data written to it. Think of it like `/dev/null`: a place to send data that you need to read but diff --git a/content/spotlight-on-external-go-libraries.article b/content/spotlight-on-external-go-libraries.article index ef7c810..75500cc 100644 --- a/content/spotlight-on-external-go-libraries.article +++ b/content/spotlight-on-external-go-libraries.article @@ -9,7 +9,7 @@ Andrew Gerrand While the Go authors have been working hard at improving Go's standard library, the greater community has created a growing ecosystem of external libraries. In this post we look at some popular Go libraries and how they can be used. - + [[http://labix.org/mgo][Mgo]] (pronounced "mango") is a MongoDB database driver. [[http://www.mongodb.org/][MongoDB]] is a [[http://en.wikipedia.org/wiki/Document-oriented_database][document-oriented database]] with a long list of features suitable for [[http://www.mongodb.org/display/DOCS/Use%2BCases][a broad range of uses]]. @@ -22,7 +22,7 @@ result pre-fetching - see the [[http://labix.org/mgo][mgo homepage]] for details and example code. For working with large data sets Go, MongoDB, and mgo are a powerful combination. - + [[https://github.com/dchest/authcookie][Authcookie]] is a web library for generating and verifying user authentication cookies. It allows web servers to hand out cryptographically secure tokens tied to @@ -31,14 +31,14 @@ It has a simple API that makes it straightforward to add authentication to existing web applications. See the [[https://github.com/dchest/authcookie/blob/master/README.md][README file]] for details and example code. - + [[http://code.google.com/p/go-charset][Go-charset]] provides support for converting between Go's standard UTF-8 encoding and a variety of character sets. The go-charset package implements a translating io.Reader and io.Writer so you can wrap existing Readers and Writers (such as network connections or file descriptors), making it easy to communicate with systems that use other character encodings. - + [[https://github.com/madari/go-socket.io][Go-socket.io]] is a Go implementation of [[http://socket.io/][Socket.IO]], a client/server API that allows web servers to push messages to web browsers. @@ -49,19 +49,18 @@ or some [[http://socket.io/#transports][other mechanism]]. Go-socket.io bridges the gap between Go servers and rich JavaScript clients for a wide range of browsers. To get a feel for go-socket.io see the [[https://github.com/madari/go-socket.io/blob/master/example/example.go][chat server example]]. - + It's worth mentioning that these packages are [[https://golang.org/cmd/goinstall/][goinstallable]]. With an up-to-date Go [[https://golang.org/doc/install.html][installation]] you can install them all with a single command: - + goinstall launchpad.net/mgo \ github.com/dchest/authcookie \ go-charset.googlecode.com/hg/charset \ github.com/madari/go-socket.io - Once goinstalled, the packages can be imported using those same paths: - + import ( "launchpad.net/mgo" "github.com/dchest/authcookie" @@ -69,12 +68,11 @@ Once goinstalled, the packages can be imported using those same paths: "github.com/madari/go-socket.io" ) - Also, as they are now a part of the local Go system, we can inspect their documentation with [[https://golang.org/cmd/godoc/][godoc]]: - + godoc launchpad.net/mgo Database # see docs for Database type - + Of course, this is just the tip of the iceberg; there are more great Go libraries listed on the [[http://godashboard.appspot.com/package][package dashboard]] and many more to come. diff --git a/content/store.article b/content/store.article index 2138079..f295fa4 100644 --- a/content/store.article +++ b/content/store.article @@ -23,4 +23,3 @@ If we are out of stock when you go to place an order, check back again soon. Follow the [[https://twitter.com/golang][Twitter account]] for updates, we plan on adding new goodies for all our Go fans out there, so keep an eye out! Happy shopping! - diff --git a/content/strings.article b/content/strings.article index be58013..0a9bd8f 100644 --- a/content/strings.article +++ b/content/strings.article @@ -72,7 +72,7 @@ characters. We'll return to that topic in detail below. For now, let's stick with just the bytes. This is the output from the byte-by-byte loop: - bd b2 3d bc 20 e2 8c 98 + bd b2 3d bc 20 e2 8c 98 Notice how the individual bytes match the hexadecimal escapes that defined the string. @@ -166,7 +166,7 @@ The output is: plain string: ⌘ quoted string: "\u2318" - hex bytes: e2 8c 98 + hex bytes: e2 8c 98 which reminds us that the Unicode character value U+2318, the "Place of Interest" symbol ⌘, is represented by the bytes `e2` `8c` `98`, and @@ -262,7 +262,6 @@ To summarize, here are the salient points: - Those sequences represent Unicode code points, called runes. - No guarantee is made in Go that characters in strings are normalized. - * Range loops Besides the axiomatic detail that Go source code is UTF-8, diff --git a/content/subtests.article b/content/subtests.article index 7edbc78..e3c212d 100644 --- a/content/subtests.article +++ b/content/subtests.article @@ -111,8 +111,6 @@ and consistent with the table-driven approach commonly used for testing. Moreover, common setup code is now shared between runs while eliminating the need to reset the timer. - - * Table-driven tests using subtests Go 1.7 also introduces a `Run` method for creating subtests. @@ -169,7 +167,6 @@ identify the test again within the error messages. There are several other benefits to using subtests or sub-benchmarks, as clarified by the following sections. - * Running specific tests or benchmarks Both subtests and sub-benchmarks can be singled out on the command line using @@ -306,7 +303,6 @@ As a result, no other parallel tests can run in parallel to these parallel tests Note that we need to capture the range variable to ensure that `tc` gets bound to the correct instance. - ** Cleaning up after a group of parallel tests In the previous example we used the semantics to wait on a group of parallel diff --git a/content/survey2016-results.article b/content/survey2016-results.article index b4092c4..b5756cf 100644 --- a/content/survey2016-results.article +++ b/content/survey2016-results.article @@ -24,7 +24,6 @@ We also asked about the kinds of programs people write in Go. Like in the previous question, most made multiple choices, with 85% choosing two or more and 72% choosing three or more. - We asked about people’s expertise and preference among programming languages. Unsurprisingly, Go ranked highest among respondents’ first choices in both expertise (26%) and preference (62%). With Go excluded, the top five first choices for language expertise were @@ -33,7 +32,6 @@ and the top five first choices for language preference were Python (22%), JavaScript (10%), C (9%), Java (9%), and Ruby (7%). Go is clearly attracting many programmers from dynamic languages. - .html survey2016/background.html * Go usage @@ -76,10 +74,8 @@ with multiple choices allowed and 49% of respondents developing on multiple syst The 51% of responses choosing a single system split into 29% on Linux, 17% on MacOS, 5% on Windows, and 0.2% on other systems. - Go deployment is roughly evenly split between privately managed servers and hosted cloud servers. - .html survey2016/dev.html * Working Effectively @@ -91,7 +87,6 @@ and that they are able to effectively use Go’s concurrency features (14:1). On the other hand, users least agreed that they are able to effectively debug uses of Go’s concurrency features (2.7:1). - Users mostly agreed that they were able to quickly find libraries they need (7.5:1). When asked what libraries are still missing, the most common request by far was a library for writing GUIs. Another popular topic was requests around data processing, analytics, and numerical and scientific computing. @@ -121,7 +116,7 @@ but they agree much less that the project leadership understands their needs (2. and they agree even less that they feel comfortable approaching project leadership with questions and feedback (2.2:1). In fact, these were the only questions in the survey for which more than half of respondents did not mark “somewhat agree”, “agree”, or “strongly agree” (many were neutral or did not answer). - + We hope that the survey and this blog post convey to those of you who are aren’t comfortable reaching out that the Go project leadership is listening. Throughout 2017 we will be exploring new ways to engage with users to better understand their needs. diff --git a/content/survey2017-results.article b/content/survey2017-results.article index c64cf07..59ebc9a 100644 --- a/content/survey2017-results.article +++ b/content/survey2017-results.article @@ -74,7 +74,6 @@ identified "Go lacks critical features" as the reason they don't use Go more and a decreased percentage who identified "Go not being an appropriate fit". Other than these changes, the list remains consistent with last year. - .html survey2017/usage.html * Development and deployment @@ -189,4 +188,4 @@ keyword? Perhaps unsurprisingly, the most popular response was `go`, followed by Finally, on behalf of the entire Go project, we are grateful for everyone who has contributed to our project, whether by being a part of our great community, -by taking this survey or by taking an interest in Go.
\ No newline at end of file +by taking this survey or by taking an interest in Go. diff --git a/content/survey2018-results.article b/content/survey2018-results.article index 5ba4a1f..f8ff4f5 100644 --- a/content/survey2018-results.article +++ b/content/survey2018-results.article @@ -6,6 +6,7 @@ Todd Kulesza, Steve Francia tkulesza@google.com, spf@golang.org * Thank you + .html survey2018/style.html This post summarizes the results of our 2018 user survey and draws comparisons @@ -54,18 +55,8 @@ These findings suggests companies are continuing to embrace Go for professional software development at a consistent pace, and that Go's general popularity with developers remains strong. -#This year we saw an 8-point increase in the number of respondents who program in other languages at work. The majority of these developers (55%) still program in Go as part of their daily routine, and an additional 31% program in Go weekly. This suggests there is a sizable (and growing) audience of Go developers whose work involves switching between multiple languages; , and may be dealing with a difficult mental context switch due to syntactic and semantic language differences. Indeed, participants reported that one of their challenges to using Go was "differences from familiar languages/ecosystems", as we'll discuss in the _Attitudes_towards_Go_ section below. - -#.html survey2018/fig1-3.html - .image survey2018/fig1.svg _ 600 -#.caption Figure 1 - .image survey2018/fig2.svg _ 600 -#.caption Figure 2 - -#.image survey2018/fig3.svg _ 600 -#.caption Figure 3 To better understand where developers use Go, we broke responses down into three groups: @@ -85,7 +76,6 @@ see section _Attitudes_towards_Go_ below) Go is the top language they'd prefer to use for these non-work-related projects. .image survey2018/fig4.svg _ 600 -#.caption Figure 4 When asked how long they've been using Go, participants' answers are strongly trending upward over time, @@ -98,7 +88,6 @@ as this suggests that developers are not dropping out of the ecosystem after initially learning the language. .image survey2018/fig5.svg _ 600 -#.caption Figure 5 As in prior years, Go ranks at the top of respondents' preferred languages and languages in which they have expertise. @@ -130,10 +119,7 @@ which highlights three interesting bits: which also found Rust, Kotlin, and Go to be among the most-preferred programming languages. .image survey2018/fig6.svg _ 600 -#.caption Figure 6 - .image survey2018/fig7.svg _ 600 -#.caption Figure 7 .html survey2018/reading.html * Development domains @@ -151,7 +137,6 @@ suggesting that respondents are adopting Go for a wider variety of projects, rather than shifting usage from one domain to another. .image survey2018/fig8.svg _ 600 -#.caption Figure 8 Since 2016, the top two uses of Go have been writing API/RPC services and developing CLI applications. @@ -167,7 +152,6 @@ Another year-over-year trend suggests that automation is also a growing area for with 38% of respondents now using Go for scripts and automation tasks (up from 31% in 2016). .image survey2018/fig9.svg _ 600 -#.caption Figure 9 To better understand the contexts in which developers are using Go, we added a question about Go adoption across different industries. @@ -182,7 +166,6 @@ adoption across industries to better understand developer needs outside of technology companies. .image survey2018/fig10.svg _ 600 -#.caption Figure 10 * Attitudes towards Go @@ -196,7 +179,6 @@ Our 2018 score is 61 (68% promoters - 7% detractors) and will serve as a baseline to help us gauge community sentiment towards the Go ecosystem over time. .image survey2018/fig11.svg _ 600 -#.caption Figure 11 In addition to NPS, we asked several questions about developer satisfaction with Go. Overall, survey respondents indicated a high level of satisfaction, @@ -211,10 +193,7 @@ they remained mostly stable this year. to "_Overall,_I'm_happy_with_Go_", so those results are not directly comparable.) -#We also looked at only the respondents who _strongly_ agreed with each statement and found the same pattern: increases in 2017, stabilizing in 2018. - .image survey2018/fig12.svg _ 600 -#.caption Figure 12 Given the strong sentiment towards preferring Go for future development, we want to understand what prevents developers from doing so. @@ -242,10 +221,7 @@ The top three major challenges we identified are: "Hard to build richer abstractions (want generics)") .image survey2018/fig13.svg _ 600 -#.caption Figure 13 - .image survey2018/fig14.svg _ 600 -#.caption Figure 14 This year we added several questions about developer satisfaction with different aspects of Go. Survey respondents were very satisfied with Go applications' CPU performance (46:1, @@ -274,10 +250,7 @@ We plan to investigate how developers debug Go applications in more depth this y with a goal of improving the overall debugging experience for Go developers. .image survey2018/fig15.svg _ 600 -#.caption Figure 15 - .image survey2018/fig29.svg _ 600 -#.caption Figure 29 * Development environments @@ -292,7 +265,6 @@ Overall, 41% of respondents use multiple operating systems for Go development, highlighting the cross-platform nature of Go. .image survey2018/fig16.svg _ 600 -#.caption Figure 16 Last year, VS Code edged out Vim as the most popular Go editor among survey respondents. This year it significantly expanded its lead to become the preferred editor @@ -319,10 +291,7 @@ Other requests include better integration with Go's CLI toolchain, better support for modules/packages, and general performance improvements. .image survey2018/fig17.svg _ 600 -#.caption Figure 17 - .image survey2018/fig18.svg _ 600 -#.caption Figure 18 This year we also added a question asking which deployment architectures are most important to Go developers. @@ -336,7 +305,6 @@ there is significant interest in ARM64 (45%), WebAssembly (30%), and ARM (22%), but very little interest in other platforms. .image survey2018/fig19.svg _ 600 -#.caption Figure 19 * Deployments and services @@ -358,7 +326,6 @@ We also see steady growth in Go deployments to GCP since 2016, increasing from 12% → 19% of respondents. .image survey2018/fig20.svg _ 600 -#.caption Figure 20 Perhaps correlated with the decrease in on-prem deployments, this year we saw cloud storage become the second-most used service by survey respondents, @@ -370,7 +337,6 @@ which ticked up from 61% → 65% of respondents. As the below chart shows, service usage increased across the board. .image survey2018/fig21.svg _ 600 -#.caption Figure 21 * Go community @@ -388,10 +354,7 @@ In the two charts below, we've grouped sources used by less than < 5% of respondents into the "Other" category. .image survey2018/fig24.svg _ 600 -#.caption Figure 24 - .image survey2018/fig25.svg _ 600 -#.caption Figure 25 This year, 55% of survey respondents said they have or are interested in contributing to the Go community, @@ -404,10 +367,7 @@ leadership with questions and feedback" (30% → 25%) and "I am confident in the leadership of Go (54% → 46%). .image survey2018/fig26.svg _ 600 -#.caption Figure 26 - .image survey2018/fig27.svg _ 600 -#.caption Figure 27 An important aspect of community is helping everyone feel welcome, especially people from traditionally under-represented demographics. @@ -425,7 +385,6 @@ is at least retaining the same proportions of under-represented members, and may even be increasing. .image survey2018/fig28.svg _ 600 -#.caption Figure 28 Maintaining a healthy community is extremely important to the Go project, so for the past three years we've been measuring the extent to which developers @@ -447,7 +406,6 @@ This interpretation of the data is supported by responses to the question "What changes would make the Go community more welcoming?". Respondents' comments can be broadly grouped into four categories: - - Reduce a perception of elitism, especially for newcomers to Go (e.g., "less dismissiveness", "Less defensiveness and hubris") - Increase transparency at the leadership level (e.g., @@ -464,10 +422,7 @@ While it doesn't represent a large percentage of our user base, we take this feedback very seriously and are working on improving each area. .image survey2018/fig22.svg _ 600 -#.caption Figure 22 - .image survey2018/fig23.svg _ 600 -#.caption Figure 23 * Conclusion diff --git a/content/the-app-engine-sdk-and-workspaces-gopath.article b/content/the-app-engine-sdk-and-workspaces-gopath.article index 0bf3fbf..73ae7d9 100644 --- a/content/the-app-engine-sdk-and-workspaces-gopath.article +++ b/content/the-app-engine-sdk-and-workspaces-gopath.article @@ -88,17 +88,17 @@ is a slower version that avoids unsafe by using the [[https://golang.org/pkg/ref Let's take a simple Go web server and turn it into a hybrid app. This is main.go: package main - + import ( "fmt" "net/http" ) - + func main() { http.HandleFunc("/", handler) http.ListenAndServe("localhost:8080", nil) } - + func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello!") } @@ -111,16 +111,16 @@ To convert main.go to an App Engine app, drop the call to ListenAndServe and register the handler in an init function (which runs before main). This is app.go: package main - + import ( "fmt" "net/http" ) - + func init() { http.HandleFunc("/", handler) } - + func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello!") } @@ -138,13 +138,13 @@ main.go runs the web server. It includes the "!appengine" build constraint, as it must only included when building the stand-alone binary. // +build !appengine - + package main - + import "net/http" - + func main() { - http.ListenAndServe("localhost:8080", nil) + http.ListenAndServe("localhost:8080", nil) } To see a more complex hybrid app, take a look at the [[https://godoc.org/golang.org/x/tools/present][present tool]]. diff --git a/content/third-party-libraries-goprotobuf-and.article b/content/third-party-libraries-goprotobuf-and.article index afdd586..b356e81 100644 --- a/content/third-party-libraries-goprotobuf-and.article +++ b/content/third-party-libraries-goprotobuf-and.article @@ -28,7 +28,7 @@ You can then install the 'proto' package with [[https://golang.org/cmd/goinstall And then install the protobuf compiler plugin: cd $GOROOT/src/pkg/goprotobuf.googlecode.com/hg/compiler - make install + make install For more detail see the project's [[http://code.google.com/p/goprotobuf/source/browse/README][README]] file. diff --git a/content/toward-go2.article b/content/toward-go2.article index e98f083..584883e 100644 --- a/content/toward-go2.article +++ b/content/toward-go2.article @@ -276,7 +276,7 @@ minus a small measurement error. start := time.Now() // 3:04:05.000 event() end := time.Now() // 3:04:05.010 - + elapsed := end.Sub(start) // 10 ms This obvious procedure can fail during a [[https://en.wikipedia.org/wiki/Leap_second][leap second]]. When our clocks @@ -294,7 +294,7 @@ taking negative 990 milliseconds. start := time.Now() // 11:59:59.995 event() end := time.Now() // 11:59:59.005 (really 11:59:60.005) - + elapsed := end.Sub(start) // –990 ms Because the time-of-day clock is inaccurate for timing events across @@ -398,7 +398,7 @@ handling leap second time resets correctly, we did not effectively convey to the broader Go community the significance of handling gradual code migration and repair during large-scale changes. -In the fall we started over. I gave a [[https://www.youtube.com/watch?v=h6Cw9iCDVcU][talk]] and wrote +In the fall we started over. I gave a [[https://www.youtube.com/watch?v=h6Cw9iCDVcU][talk]] and wrote [[https://talks.golang.org/2016/refactor.article][an article presenting the problem]] using multiple concrete examples drawn from open source codebases, showing how this problem arises everywhere, not @@ -415,7 +415,7 @@ environment can understand. To discuss major changes to Go as a community, we will need to pay particular attention to describing the significance of any problem we want to solve. The clearest way to do that is by showing how the problem affects real programs and real -production systems, like in +production systems, like in [[https://blog.cloudflare.com/how-and-why-the-leap-second-affected-cloudflare-dns/][Cloudflare's blog post]] and in [[https://talks.golang.org/2016/refactor.article][my refactoring article]]. @@ -481,7 +481,7 @@ More recently, we designed for Go 1.9 a [[https://beta.golang.org/doc/go1.9#math contains various bit manipulation functions: package bits // import "math/bits" - + func LeadingZeros32(x uint32) int func Len32(x uint32) int func OnesCount32(x uint32) int diff --git a/content/using-go-modules.article b/content/using-go-modules.article index ea13545..8d2774a 100644 --- a/content/using-go-modules.article +++ b/content/using-go-modules.article @@ -48,7 +48,6 @@ Starting in Go 1.13, module mode will be the default for all development. This post walks through a sequence of common operations that arise when developing Go code with modules: - - Creating a new module. - Adding a dependency. - Upgrading dependencies. @@ -161,7 +160,6 @@ Now let’s run the test again: ok example.com/hello 0.023s $ - The `go` command resolves imports by using the specific dependency module versions listed in `go.mod`. When it encounters an `import` of a package not provided @@ -195,7 +193,6 @@ modules are cached locally (in `$GOPATH/pkg/mod`): ok example.com/hello 0.020s $ - Note that while the `go` command makes adding a new dependency quick and easy, it is not without cost. Your module now literally _depends_ on the new dependency @@ -377,7 +374,6 @@ Then we can test our code: ok example.com/hello 0.024s $ - Note that our module now depends on both `rsc.io/quote` and `rsc.io/quote/v3`: $ go list -m rsc.io/q... @@ -468,7 +464,6 @@ so we can undo that: return quote.Concurrency() } - Let's re-run the tests to make sure everything is working: $ go test diff --git a/content/v2-go-modules.article b/content/v2-go-modules.article index 54b7e5a..cb8b7be 100644 --- a/content/v2-go-modules.article +++ b/content/v2-go-modules.article @@ -96,9 +96,9 @@ This post uses `github.com/googleapis/gax-go` as an example: header.go $ cat go.mod module github.com/googleapis/gax-go - + go 1.9 - + require ( github.com/golang/protobuf v1.3.1 golang.org/x/exp v0.0.0-20190221220918-438050ddec5e @@ -120,7 +120,7 @@ new `v2/` directory and copy our package into it. header.go invoke.go tools.go - + sent 10588 bytes received 130 bytes 21436.00 bytes/sec total size is 10208 speedup is 0.95 $ diff --git a/content/versioning-proposal.article b/content/versioning-proposal.article index 0b95a77..92c8f54 100644 --- a/content/versioning-proposal.article +++ b/content/versioning-proposal.article @@ -38,11 +38,11 @@ The most important new feature of [[https://blog.golang.org/preview-of-go-version-1][Go 1]] was not a language feature. It was Go 1’s emphasis on backwards compatibility. -Until that point we’d issued stable release +Until that point we’d issued stable release snapshots approximately monthly, each with significant incompatible changes. We observed significant acceleration in interest and adoption -immediately after the release of Go 1. +immediately after the release of Go 1. We believe that the [[https://golang.org/doc/go1compat.html][promise of compatibility]] made developers feel much more comfortable relying on @@ -84,7 +84,7 @@ semantic import versioning. When I realized this, the logical necessity surprised me. I was also surprised to realize that -there is a second, independent logical route to +there is a second, independent logical route to semantic import versioning: [[https://talks.golang.org/2016/refactor.article][gradual code repair]] or partial code upgrades. @@ -130,7 +130,7 @@ I was also surprised to discover how much import compatibility simplifies version selection, which is the problem of deciding which package versions to use for a given build. The constraints of Cargo and Dep make version selection -equivalent to +equivalent to [[https://research.swtch.com/version-sat][solving Boolean satisfiability]], meaning it can be very expensive to determine whether a valid version configuration even exists. @@ -140,7 +140,7 @@ Relying on import compatibility can instead let Go use a trivial, linear-time algorithm to find the single best configuration, which always exists. This algorithm, -which I call +which I call [[https://research.swtch.com/vgo-mvs][_minimal_version_selection_]], in turn eliminates the need for separate lock and manifest files. It replaces them with a single, short configuration file, @@ -227,7 +227,7 @@ I spent the first three weeks of February turning the wrapper into a full versioned `go` command, `vgo`; writing drafts of a [[https://research.swtch.com/vgo][blog post series introducing `vgo`]]; -and discussing them with +and discussing them with Sam Boyer, the package management working group, and the Go team. And then I spent the last week of February finally @@ -275,7 +275,7 @@ updated as feedback arrives. For this proposal to succeed, the Go ecosystem as a whole—and in particular today’s major Go projects—will need to adopt the import compatibility rule and semantic import versioning. -To make sure that can happen smoothly, +To make sure that can happen smoothly, we will also be conducting user feedback sessions by video conference with projects that have questions about how to incorporate the new versioning proposal into their code bases diff --git a/content/why-generics.article b/content/why-generics.article index c972550..44e9e1e 100644 --- a/content/why-generics.article +++ b/content/why-generics.article @@ -642,7 +642,6 @@ or to the location in the tree where it should go. return pn } - The details here don't really matter, especially since I haven't tested this code. I'm just trying to show what it looks like to write a simple generic |