_content/talks: fix many stale or broken links

Change to not use https://go.dev/ directly in the link,
preferring relative links. Also fix many stale or broken links.

Makes talks safe for upcoming link-checking test.

Change-Id: I9c19e052b4df842561c3c153be630c99102a790c
Reviewed-on: https://go-review.googlesource.com/c/website/+/548061
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2023-12-07 14:37:39 -05:00 коммит произвёл Gopher Robot
Родитель 2d2fc5b9cb
Коммит 94530e9339
61 изменённых файлов: 471 добавлений и 475 удалений

Просмотреть файл

@ -24,7 +24,7 @@
<div class="slide titlepage">
<div style="height: 135px; width: 480px; overflow: hidden; position: fixed; top: auto; bottom: 10px; left: auto; right: 0; ">
<img src="support/gordon/bumper480x270.png" style="margin: -135px 0 0 0;"/>
<img src="support/bumper480x270.png" style="margin: -135px 0 0 0;"/>
</div>
<br/>
<img src="support/go-logo-white.png">

Просмотреть файл

@ -344,8 +344,8 @@ Go is fun.
* For more information
Go: [[http://golang.org]]
Go: [[/][go.dev]]
New templates: http://golang.org/pkg/exp/template/
New templates: https://golang.org/pkg/exp/template/
(Next release will move them out of experimental.)

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Gopher
https://plus.google.com/106356964679457436995
@enneff
http://golang.org
https://go.dev
* 1. Anonymous structs
@ -64,7 +64,7 @@ http://golang.org
{"data": {"children": [
{"data": {
"title": "The Go homepage",
"url": "http://golang.org/"
"url": "https://go.dev/"
}},
...
]}}

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Google Sydney
http://andrewgerrand.com
@enneff
http://golang.org
https://go.dev
* Video
@ -173,7 +173,7 @@ It's important to clean up when the conversation is over. To do this we send the
* Demo
* Taking it to the web
* Taking it to the web
"Cute program," you say, "But who wants to chat over a raw TCP connection?"
@ -217,7 +217,7 @@ Go supports a kind of "mix-in" functionality with a feature known as "struct emb
* Embedding the websocket connection
By embedding the `*websocket.Conn` as an `io.ReadWriter`, we can drop the explicit `socket` `Read` and `Write` methods.
By embedding the `*websocket.Conn` as an `io.ReadWriter`, we can drop the explicit `socket` `Read` and `Write` methods.
.code chat/http/chat.go /type.socket/,/END/
@ -239,7 +239,7 @@ Let's do it.
Fortunately, the Go docs include a markov chain implementation:
.link http://golang.org/doc/codewalk/markov
.link /doc/codewalk/markov go.dev/doc/codewalk/markov
We'll use a version that has been modified to be safe for concurrent use.
@ -289,12 +289,12 @@ The `chat` function remains untouched.
All about Go:
.link http://golang.org
.link / go.dev
The slides for this talk:
.link http://go.dev/talks/2012/chat.slide
.link /talks/2012/chat.slide go.dev/talks/2012/chat.slide
"Go Concurrency Patterns" by Rob Pike:
.link http://golang.org/s/concurrency-patterns
.link /s/concurrency-patterns go.dev/s/concurrency-patterns

Просмотреть файл

@ -2,9 +2,7 @@ Go Concurrency Patterns
Rob Pike
Google
http://golang.org/s/plusrob
@rob_pike
http://golang.org
https://go.dev
* Video
@ -54,7 +52,7 @@ On the other hand, a well-written concurrent program might run efficiently in pa
For more on that distinction, see the link below. Too much to discuss here.
.link http://golang.org/s/concurrency-is-not-parallelism
.link /s/concurrency-is-not-parallelism go.dev/s/concurrency-is-not-parallelism
* A model for software construction
@ -318,7 +316,7 @@ Go was designed for writing systems software.
Let's see how the concurrency features come into play.
* Example: Google Search
Q: What does Google search do?
A: Given a query, return a page of search results (and some ads).
@ -404,19 +402,19 @@ There are endless ways to use these tools, many presented elsewhere.
Chatroulette toy:
.link http://golang.org/s/chat-roulette
.link /s/chat-roulette go.dev/s/chat-roulette
Load balancer:
.link http://golang.org/s/load-balancer
.link /s/load-balancer go.dev/s/load-balancer
Concurrent prime sieve:
.link http://golang.org/s/prime-sieve
.link /s/prime-sieve go.dev/s/prime-sieve
Concurrent power series (by McIlroy):
.link http://golang.org/s/power-series
.link /s/power-series go.dev/s/power-series
* Don't overdo it
@ -448,20 +446,20 @@ And they're fun to use.
Go Home Page:
.link http://golang.org
.link / go.dev
Go Tour (learn Go in your browser)
.link http://tour.golang.org
.link /tour/ go.dev/tour
Package documentation:
.link http://golang.org/pkg
.link /pkg go.dev/pkg
Articles galore:
.link http://golang.org/doc
.link /doc go.dev/doc
Concurrency is not parallelism:
.link http://golang.org/s/concurrency-is-not-parallelism
.link /s/concurrency-is-not-parallelism go.dev/s/concurrency-is-not-parallelism

Просмотреть файл

@ -3,9 +3,7 @@ Golang-Syd, Oct 17, 2012
Rob Pike
Google, Inc.
@rob_pike
http://golang.org/s/plusrob
http://golang.org
https://go.dev
* Documentation
@ -39,7 +37,7 @@ There are many ways to show documentation as text
* Godoc
.link http://golang.org/pkg/utf16
.link /pkg/utf16 go.dev/pkg/utf16
* blog.golang.org
@ -53,7 +51,7 @@ There are many ways to show documentation as text
* Go wiki
.link http://golang.org/wiki
.link /wiki go.dev/wiki
.image go-docs/gowiki.png
@ -109,7 +107,7 @@ Docs:
.code go-docs.slide /^\*.*previous/,/^\.code/
* Revenge of the input for the the previous slide
* Revenge of the input for the the previous slide
.code go-docs.slide /^\*.*redux/,/^\.code/
@ -140,7 +138,7 @@ Want to edit and play.
* Can run code from the browser
.link http://tour.golang.org
.link /tour/ go.dev/tour
* Use this technology
@ -187,7 +185,7 @@ Input for the previous slide:
fmt.Println("You're both boring; I'm leaving.")
}
// STOP1 OMIT
* faninboring.go (II)
// START2 OMIT
@ -239,4 +237,4 @@ Deploy executable examples throughout:
- Go By Example
- wiki
.link http://golang.org/pkg/strings/#example_Contains
.link /pkg/strings/#example_Contains go.dev/pkg/strings/#example_Contains

Просмотреть файл

@ -2,15 +2,13 @@ The Path to Go 1
Rob Pike
Google
http://golang.org/s/plusrob
@rob_pike
http://golang.org
https://go.dev
Andrew Gerrand
Google
http://andrewgerrand.com
@go_nuts
http://golang.org
https://go.dev
* Introduction
@ -359,7 +357,7 @@ Examples:
"gob" "encoding/gob"
"json" "encoding/json"
"xml" "encoding/xml"
"unicode" "unicode"
"utf8" "unicode/utf8"
"utf16" "unicode/utf16"
@ -491,15 +489,15 @@ Go 2 is likely years away.
The Go web site has a huge amount of documentation:
.link http://golang.org
.link / go.dev
Learn Go from a web browser:
.link http://tour.golang.org
.link /tour/ go.dev/tour
"Meet the Go team" panel from Google I/O 2012:
.link http://golang.org/s/meet-the-go-team
.link /s/meet-the-go-team go.dev/s/meet-the-go-team
Google Code project:

Просмотреть файл

@ -425,7 +425,7 @@ Selected commands:
test test packages
vet run go tool vet on packages
.link http://golang.org/cmd/go/
.link /cmd/go/ go.dev/cmd/go/
* Break
@ -564,7 +564,7 @@ On the other hand, a well-written concurrent program might run efficiently in pa
For more on that distinction, see the link below. Too much to discuss here.
.link http://golang.org/s/concurrency-is-not-parallelism
.link /s/concurrency-is-not-parallelism go.dev/s/concurrency-is-not-parallelism
* A model for software construction
@ -711,16 +711,16 @@ Don't communicate by sharing memory, share memory by communicating.
Go Home Page:
.link http://golang.org
.link / go.dev
Go Tour (learn Go in your browser)
.link http://tour.golang.org
.link /tour/ go.dev/tour
Package documentation:
.link http://golang.org/pkg
.link /pkg go.dev/pkg
Articles galore:
.link http://golang.org/doc
.link /doc go.dev/doc

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Google
@enneff
adg@golang.org
http://golang.org
https://go.dev
* The Playground API

Просмотреть файл

@ -6,7 +6,7 @@ Go: a simple programming environment
# statically typed languages and productive dynamic language. But its not just
# the language that makes Go special – Go has broad and consistent standard
# libraries and powerful but simple tools.
#
#
# This talk gives an introduction to Go, followed by a tour of some real
# programs that demonstrate the power, scope, and simplicity of the Go
# programming environment.
@ -15,7 +15,7 @@ Andrew Gerrand
Google Inc.
@enneff
adg@golang.org
http://golang.org
https://go.dev
* Video
@ -242,11 +242,11 @@ To run the tests for all my projects:
* Tests: benchmarks
The `testing` package also supports benchmarks.
A sample benchmark function:
.code simple/test/string_test.go /func BenchmarkIndex/,/^}/
The benchmark package will vary `b.N` until the benchmark function lasts long enough to be timed reliably.
$ go test -test.bench=Index
@ -268,7 +268,7 @@ Examples and built and run as part of the normal test suite:
The example is displayed in `godoc` alongside the thing it demonstrates:
.link http://golang.org/pkg/strings/#Index
.link /pkg/strings/#Index go.dev/pkg/strings/#Index
* And there's more
@ -372,11 +372,11 @@ For each test case, construct an `http.Request` for the url and an `httptest.Res
All about Go:
.link http://golang.org
.link / go.dev
The slides for this talk:
.link http://go.dev/talks/2012/simple.slide
.link /talks/2012/simple.slide go.dev/talks/2012/simple.slide
webfront:

Просмотреть файл

@ -2,9 +2,7 @@ Go at Google: Language Design in the Service of Software Engineering
Rob Pike
Google, Inc.
@rob_pike
http://golang.org/s/plusrob
http://golang.org
https://go.dev
* Abstract
@ -395,7 +393,7 @@ One may always tell whether a name is local to package from its syntax: `Name` v
(More on this later.)
For our example, the package path is `"encoding/json"` while the package name is `json`.
Outside the standard repository, the convention is to place the
Outside the standard repository, the convention is to place the
project or company name at the root of the name space:
import "google/base/go/log"
@ -490,7 +488,7 @@ the second is shorter and idiomatic:
var buf *bytes.Buffer = bytes.NewBuffer(x) // explicit
buf := bytes.NewBuffer(x) // derived
There is a blog post at [[http://golang.org/s/decl-syntax][golang.org/s/decl-syntax]] with more detail about the syntax of declarations in Go and
There is a blog post at [[/s/decl-syntax][go.dev/s/decl-syntax]] with more detail about the syntax of declarations in Go and
why it is so different from C.
Function syntax is straightforward for simple functions.
@ -510,7 +508,7 @@ And here is a variable (closure) with a type `T` argument; Go has first-class
functions and closures:
negAbs := func(x T) float64 { return -Abs(x) }
Finally, in Go functions can return multiple values. A common case is to
return the function result and an `error` value as a pair, like this:
@ -654,7 +652,7 @@ The following sections provide brief discussions of two of these topics in Go,
concurrency and garbage collection,
mostly from a software engineering perspective.
For a full discussion of the language semantics and uses see the many
resources on the [[http://golang.org]] web site.
resources on the [[/][go.dev]] web site.
* Concurrency
@ -718,7 +716,7 @@ Go has no explicit memory-freeing operation: the only way allocated
memory returns to the pool is through the garbage collector.
It was an easy decision to make because memory management
has a profound effect on the way a language works in practice.
has a profound effect on the way a language works in practice.
In C and C++, too much programming effort is spent on memory allocation
and freeing.
The resulting designs tend to expose details of memory management
@ -1110,7 +1108,7 @@ Go's use is growing inside Google.
Several big user-facing services use it, including `youtube.com` and `dl.google.com`
(the download server that delivers Chrome, Android and other downloads),
as well as our own [[http://golang.org][golang.org]].
as well as our own [[/][go.dev]].
And of course many small ones do, mostly
built using Google App Engine's native support for Go.
@ -1174,7 +1172,7 @@ The properties that led to that include:
If you haven't tried Go already, we suggest you do.
.link http://golang.org http://golang.org
.link / go.dev
.image splash/appenginegophercolor.jpg

Просмотреть файл

@ -3,9 +3,7 @@ SPLASH, Tucson, Oct 25, 2012
Rob Pike
Google, Inc.
@rob_pike
http://golang.org/s/plusrob
http://golang.org
https://go.dev
* Preamble
@ -22,7 +20,7 @@ Go is:
- fun
- boring (to some)
.link http://golang.org http://golang.org
.link / go.dev
* History
@ -184,7 +182,7 @@ To build a large Google binary on a single computer is impractical.
In 2007, instrumented the build of a major Google binary:
- 2000 files
- 4.2 megabytes
- 4.2 megabytes
- 8 gigabytes delivered to compiler
- 2000 bytes sent to compiler for every C++ source byte
- it's real work too: `<string>` for example
@ -276,7 +274,7 @@ Circular imports are illegal in Go.
The big picture in a nutshell:
- occasional minor pain,
- but great reduction in annoyance overall
- but great reduction in annoyance overall
- structural typing makes it less important than with type hierarchies
- keeps us honest!
@ -388,7 +386,7 @@ One nice effect: can drop `var` and derive type of variable from expression:
For more information:
.link http://golang.org/s/decl-syntax
.link /s/decl-syntax go.dev/s/decl-syntax
* Function syntax
@ -403,7 +401,7 @@ Method of type `T`:
Variable (closure) of type `T`:
negAbs := func(t T) float64 { return -Abs(t) }
In Go, functions can return multiple values. Common case: `error`.
func ReadByte() (c byte, err error)
@ -826,7 +824,7 @@ Easy tooling (the `go` tool, `gofmt`, `godoc`, `gofix`)
* Try it!
.link http://golang.org http://golang.org
.link / go.dev
.image splash/appenginegophercolor.jpg

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Google
https://plus.google.com/106356964679457436995
@enneff
http://golang.org
https://go.dev
* Background
@ -33,20 +33,20 @@ Go is a new, general-purpose programming language.
# Go was originally built by a team at Google, led by Robert Griesemer, Rob Pike, and Ken Thompson. In November 2010, Go was launched publicly as an open source project. Since then, a team at Google and more than 250 contributors from the open source community continued to improve the Go language, libraries, and tools.
# In March 2012, we announced Go 1, a version of the language and libraries that will be supported for years to come.
# In March 2012, we announced Go 1, a version of the language and libraries that will be supported for years to come.
* Getting started
* Install Go
.link http://golang.org/doc/install
.link /doc/install go.dev/doc/install
- Install from binary distributions or build from source
- 32- and 64-bit x86 and ARM processors
- Windows, Mac OS X, Linux, and FreeBSD
- Other platforms may be supported by `gccgo`
# Go is available in binary form for Windows, Mac OS X, Linux, and FreeBSD running under 32 and 64-bit x86 processor architectures. To install Go on these systems, download the appropriate file from golang.org and either open the package installer (Windows or OS X) or extract the archive to /usr/local/go (Linux and FreeBSD).
# Go is available in binary form for Windows, Mac OS X, Linux, and FreeBSD running under 32 and 64-bit x86 processor architectures. To install Go on these systems, download the appropriate file from golang.org and either open the package installer (Windows or OS X) or extract the archive to /usr/local/go (Linux and FreeBSD).
# If you use a different operating system or processor architecture, you may still be able to use Go by building it from source or using gccgo (an alternate Go compiler based on the GNU C Compiler). See the installation instructions on golang.org for how to do this.
@ -84,7 +84,7 @@ Build and format the files in the current directory:
Fetch and install `websocket`:
$ go get code.google.com/p/go.net/websocket
$ go get code.google.com/p/go.net/websocket
* Workspaces
@ -136,7 +136,7 @@ I use `"github.com/nf"`, the root of my GitHub account (useful with `go get`).
$ mkdir -p $GOPATH/src/github.com/nf
Create a `hello` directory in your namespace and copy `hello.go` there:
$ mkdir $GOPATH/src/github.com/nf/hello
$ cp hello.go $GOPATH/src/github.com/nf/hello
@ -165,7 +165,7 @@ The program will:
To get started, create directory inside your namespace called `reddit`:
$ mkdir $GOPATH/src/github.com/nf/reddit
This is where you will put your Go source files.
@ -177,7 +177,7 @@ This program makes an HTTP request to the Reddit API and copies its response to
# If you run it you should see a blob of JSON data, or an error message if something goes wrong.
# There's a lot going on here, so let's break it down.
# There's a lot going on here, so let's break it down.
* Make an HTTP request: package statement
@ -261,7 +261,7 @@ The Reddit API returns JSON data like this:
{"data": {"children": [
{"data": {
"title": "The Go homepage",
"url": "http://golang.org/",
"url": "https://go.dev/",
...
}},
...
@ -402,7 +402,7 @@ To print the item we just pass it to Println, which uses the provided `String` m
Let's go a step further. One way to judge how interesting a link might be is by the discussion surrounding it. Let's display the number of comments for each `Item` as well.
{ "title": "The Go homepage",
"url": "http://golang.org/",
"url": "https://go.dev/",
"num_comments": 10 }
Update the `Item` type to include a `Comments` field:
@ -468,23 +468,23 @@ Also remove the `main` function from `reddit.go`, and any unused package imports
The `reddit.go` file now looks like this:
package reddit
import (
// omitted
)
type Response struct {
// omitted
}
type Item struct {
// omitted
}
func (i Item) String() string {
// omitted
}
func Get(reddit string) ([]Item, error) {
// omitted
}
@ -507,22 +507,22 @@ Here's our reddit package when viewed from `godoc`:
$ godoc github.com/nf/reddit
PACKAGE
package reddit
import "github.com/nf/reddit"
FUNCTIONS
func Get(reddit string) ([]Item, error)
TYPES
type Item struct {
Title string
URL string
Comments int `json:"num_comments"`
}
func (i Item) String() string
type Response struct {
@ -557,26 +557,26 @@ Don't worry about documenting the `String` method, as all Go programmers should
The `godoc` output for our revised package:
PACKAGE
package reddit
import "github.com/nf/reddit"
Package reddit implements a basic client for the Reddit API.
FUNCTIONS
func Get(reddit string) ([]Item, error)
Get fetches the most recent Items posted to the specified subreddit.
TYPES
type Item struct {
Title string
URL string
Comments int `json:"num_comments"`
}
Item describes a Reddit item.
func (i Item) String() string
# You can also see how it will look on the web by running a local godoc instance
@ -630,13 +630,13 @@ Some ideas:
Learn Go:
.link http://tour.golang.org
.link /tour/ go.dev/tour
Documentation and articles:
.link http://golang.org/doc
.link /doc go.dev/doc
Standard library reference:
.link http://golang.org/pkg
.link /pkg go.dev/pkg

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Gopher
http://andrewgerrand.com/
@enneff
http://golang.org
https://go.dev
* What is Go?
@ -76,7 +76,7 @@ Some names that I could fit on one slide:
* Go and me
I (adg) joined the Go team at Google in February 2010.
I (adg) joined the Go team at Google in February 2010.
Before then, Python had been my day-to-day language for many years.
@ -89,7 +89,7 @@ I am obviously biased, but IMO: if you love Python, you'll love Go.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
@ -138,7 +138,7 @@ I think it's beautiful. I've certainly seen some beautiful Go code.
But beauty, as they say, is in the eye of the beholder. So enough about that.
* "Simple is better than complex."
* "Simple is better than complex."
Methods are just functions (no special location)
@ -153,7 +153,7 @@ There's no `this` or `self` - the receiver is like any other function argument
}
* "Simple is better than complex."
* "Simple is better than complex."
Methods can be declared on any named type (no classes)
@ -167,7 +167,7 @@ Methods can be declared on any named type (no classes)
}
* "Simple is better than complex."
* "Simple is better than complex."
Interfaces are just methods (no data)
@ -181,7 +181,7 @@ Interfaces are implicit (no `implements` declaration)
even though they don't know that `Abser` exists.)
* "Simple is better than complex."
* "Simple is better than complex."
No constructors or destructors.
@ -190,7 +190,7 @@ A constructor is just a function:
type Database struct {
client *rpc.Client
}
func NewDatabase(addr string) (*Database, error) {
client, err := rpc.Dial("tcp", addr)
if err != nil {
@ -200,7 +200,7 @@ A constructor is just a function:
}
* "Simple is better than complex."
* "Simple is better than complex."
Identifier case sets visibility.
@ -211,15 +211,15 @@ If a name begins with a capital, it is visible outside its package:
type Foo struct { // exported type
bar int // unexported field
}
func (f Foo) Bar() {} // exported method
func (f Foo) quux() {} // unexported method
Only code inside the package can see unexported ("private") names.
* "Simple is better than complex."
* "Simple is better than complex."
- Garbage collection (only)
- Regular scoping (and name shadowing) rules
@ -342,8 +342,8 @@ My rule of thumb:
References, articles, tutorials, and more:
.link http://golang.org
.link / go.dev
An interactive web-based tour of Go:
.link http://tour.golang.org
.link /tour/ go.dev/tour

Просмотреть файл

@ -4,7 +4,7 @@ Sameer Ajmani
Google
http://profiles.google.com/ajmani
@Sajma
http://golang.org
https://go.dev
* Video
@ -35,7 +35,7 @@ Channels are typed values that allow goroutines to synchronize and exchange info
go func() { c <- 3 }()
n := <-c
For more on the basics, watch [[http://go.dev/talks/2012/concurrency.slide#1][Go Concurrency Patterns (Pike, 2012)]].
For more on the basics, watch [[/talks/2012/concurrency.slide#1][Go Concurrency Patterns (Pike, 2012)]].
* Example: ping-pong
@ -74,7 +74,7 @@ Where do we start?
* Find an RSS client
Searching [[http://godoc.org][godoc.org]] for *"rss"* turns up several hits, including one that provides:
Searching [[https://pkg.go.dev][pkg.go.dev]] for *"rss"* turns up several hits, including one that provides:
// Fetch fetches Items for uri and returns the time when the next
// fetch should be attempted. On failure, Fetch returns an error.
@ -363,16 +363,16 @@ Go makes it easier:
Go Concurrency Patterns (2012)
.link http://go.dev/talks/2012/concurrency.slide
.link /talks/2012/concurrency.slide go.dev/talks/2012/concurrency.slide
Concurrency is not parallelism
.link http://golang.org/s/concurrency-is-not-parallelism
.link /s/concurrency-is-not-parallelism go.dev/s/concurrency-is-not-parallelism
Share memory by communicating
.link http://golang.org/doc/codewalk/sharemem
.link /doc/codewalk/sharemem go.dev/doc/codewalk/sharemem
Go Tour (learn Go in your browser)
.link http://tour.golang.org
.link /tour/ go.dev/tour

Просмотреть файл

@ -5,7 +5,7 @@ Gopher at Google
@francesc
http://campoy.cat/+
http://golang.org
https://go.dev
* Best practices
@ -20,7 +20,7 @@ Techniques to write Go code that is
- readable,
- maintainable.
.image http://golang.org/doc/gopher/gopherbw.png 200 200
.image /doc/gopher/gopherbw.png 200 200
* Some code
@ -117,9 +117,9 @@ Exported identifiers appear in `godoc`, they should be documented correctly.
// without the contact details.
func (p *Author) TextElem() (elems []Elem) {
[[http://godoc.org/code.google.com/p/go.talks/pkg/present#Author][Generated documentation]]
[[https://pkg.go.dev/code.google.com/p/go.talks/pkg/present#Author][Generated documentation]]
[[http://blog.golang.org/godoc-documenting-go-code][Gocode: documenting Go code]]
[[/blog/godoc-documenting-go-code][Gocode: documenting Go code]]
* Shorter is better
@ -265,7 +265,7 @@ Use a chan or a struct with a chan to communicate with a goroutine
3. Important code goes first
4. Document your code
5. Shorter is better
6. Packages with multiple files
6. Packages with multiple files
7. Make your packages "go get"-able
8. Ask for what you need
9. Keep independent packages independent
@ -277,8 +277,8 @@ Use a chan or a struct with a chan to communicate with a goroutine
Resources
- Go homepage [[http://golang.org]]
- Go interactive tour [[http://tour.golang.org]]
- Go homepage [[/][go.dev]]
- Go interactive tour [[/tour/][go.dev/tour]]
Other talks

Просмотреть файл

@ -47,7 +47,7 @@ A simple but powerful and fun language.
For more background on design:
- [[http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html][Less is exponentially more]]
- [[http://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
- [[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
* This Talk
@ -433,7 +433,7 @@ groupcache
* More information and related talks
http://golang.org/
https://go.dev/
rsc@golang.org

Просмотреть файл

@ -84,26 +84,26 @@ reliable, and efficient software." -- golang.org
* Why Go for Ops and SRE? Standard library examples
.link http://golang.org/pkg/fmt fmt
.link /pkg/fmt fmt
.link http://golang.org/pkg/io/ioutil io/ioutil
.link /pkg/io/ioutil io/ioutil
.link http://golang.org/pkg/net/http net/http
.link /pkg/net/http net/http
.link http://golang.org/pkg/os/exec os/exec
.link /pkg/os/exec os/exec
.link http://golang.org/pkg/path/filepath path/filepath
.link /pkg/path/filepath path/filepath
.link http://golang.org/pkg/regexp regexp
.link /pkg/regexp regexp
.link http://golang.org/pkg/strings strings
.link /pkg/strings strings
.link http://golang.org/pkg/text/tabwriter text/tabwriter
.link /pkg/text/tabwriter text/tabwriter
.link http://golang.org/pkg/time time
.link /pkg/time time
[[https://pkg.go.dev/][pkg.go.dev]] to your needs beyond the standard library
[[godoc.org]] to your needs beyond the standard library
* Why Go for Ops and SRE? Concurrency via Goroutines
.play go-sreops/goroutines.go
@ -158,7 +158,7 @@ via App Engine
Inter host Goroutines
.link http://juju.ubuntu.com Juju
.link http://juju.ubuntu.com Juju
Service orchestration management tool
@ -166,7 +166,7 @@ via App Engine
Containers management tool
.link http://www.packer.io Packer
.link http://www.packer.io Packer
Tool for creating identical machine images for multiple platforms

Просмотреть файл

@ -4,7 +4,7 @@ Andrew Gerrand
Gopher
http://andrewgerrand.com
@enneff
http://golang.org
https://go.dev
* Go 1.1

Просмотреть файл

@ -95,7 +95,7 @@ You should watch [[http://youtu.be/ph374fJqFPE][Mindblowing Python GIL]], by Dav
* Things I like about Python
- The Zen of Python. ([[http://go.dev/talks/2012/zen.slide#1][Go and the Zen of Python]])
- The Zen of Python. ([[/talks/2012/zen.slide#1][Go and the Zen of Python]])
- Hashes and arrays are part of the language.
@ -176,7 +176,7 @@ Given the function `prime`:
Use the Go playground:
.link http://golang.org/s/go4py-ex1
.link /s/go4py-ex1 go.dev/s/go4py-ex1
* Solution: generating prime numbers
@ -194,7 +194,7 @@ sent into the output channel.
Complete this code snippet:
.link http://golang.org/s/go4py-ex2
.link /s/go4py-ex2 go.dev/s/go4py-ex2
* Solution: Fibonacci primes
@ -209,9 +209,9 @@ all kinds of concurrent systems.
To learn more:
- [[http://go.dev/talks/2012/concurrency.slide#1][Concurrency patterns]], by Rob Pike
- [[/talks/2012/concurrency.slide#1][Concurrency patterns]], by Rob Pike
- [[http://go.dev/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
- [[/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
* Object-oriented Go
@ -363,7 +363,7 @@ We want to use it as follows.
Implement `handleError` using the playground.
.link http://golang.org/s/go4py-ex3
.link /s/go4py-ex3 go.dev/s/go4py-ex3
* Solution: errors in HTTP handlers
@ -441,11 +441,11 @@ _Disclaimer_:_
Next steps
.link http://golang.org
.link / go.dev
Learn Go from your browser
.link http://tour.golang.org
.link /tour/ go.dev/tour
The community: golang-nuts

Просмотреть файл

@ -46,7 +46,7 @@ This talk was presented at Google I/O in May 2013.
- Half the latency of a Python 2.7 version
- Launched on google.com front page
[[http://golang.org/s/turkey-doodle][golang.org/s/turkey-doodle]]
[[/s/turkey-doodle][go.dev/s/turkey-doodle]]
* Santa Tracker (Dec 2012)
@ -219,9 +219,9 @@ Batching:
* Finally...
- [[http://golang.org][golang.org]]
- [[/][go.dev]]
- [[http://developers.google.com/appengine/docs/go/][developers.google.com/appengine/docs/go/]]
- [[http://golang.org/s/io13-ae-talk][golang.org/s/io13-ae-talk]] (this talk, plus gophermart app)
- [[/s/io13-ae-talk][go.dev/s/io13-ae-talk]] (this talk, plus gophermart app)
- [[http://github.com/mjibson/appstats][github.com/mjibson/appstats]]
More Go things:

Просмотреть файл

@ -7,7 +7,7 @@ Gopher, Google
@bradfitz
bradfitz@golang.org
http://bradfitz.com/
http://golang.org/
https://go.dev/
https://github.com/golang/groupcache/
* Overview / tl;dw:
@ -264,7 +264,7 @@ each "payload" (~URL) described by a protobuf:
- net/http
- io
- [[http://golang.org/pkg/net/http/#ServeContent][http.ServeContent]]
- [[/pkg/net/http/#ServeContent][http.ServeContent]]
* Hello World

Просмотреть файл

@ -6,7 +6,7 @@ GopherCon
Russ Cox
Google
http://golang.org/
https://go.dev/
* Video

Просмотреть файл

@ -122,8 +122,8 @@ on:
- App Engine APIs require context plumbing.
- Ugly hacks avoid context plumbing, but don't.
.link https://developers.google.com/appengine/docs/go/reference#Context
.link http://godoc.org/camlistore.org/pkg/context
.link http://godoc.org/code.google.com/p/go.net/context
.link https://pkg.go.dev/camlistore.org/pkg/context
.link https://pkg.go.dev/code.google.com/p/go.net/context
- Restructure code to not assume long-running goroutines; handlers only
- No unsafe, syscall, etc: use build tags on files:

Просмотреть файл

@ -20,7 +20,7 @@ Born out of frustration with C++ and Java:
Go is fast and simple.
More at: [[https://go.dev/talks/2012/splash.article]]
More at: [[/talks/2012/splash.article]]
* Five years later
@ -94,7 +94,7 @@ So, no JNI.
Instead, we have a tool for that: `gobind`
It generates Java interfaces for you.
[[http://golang.org/s/gobind]]
[[/s/gobind]]
* gobind basics
@ -201,4 +201,4 @@ Sprite will be ready for 2D games.
- focus on functions, simplicity
- native binaries
More at: [[https://go.dev/talks/2014/go4java.slide]]
More at: [[/talks/2014/go4java.slide]]

Просмотреть файл

@ -4,7 +4,7 @@ Toward Go 1.3
Andrew Gerrand
Gopher
@enneff
http://golang.org
https://go.dev
* Go 1.3
@ -20,7 +20,7 @@ Release is June 1, 2014.
After Go 1.2 the Go contributors compiled a to-do list:
.link http://golang.org/s/go13todo
.link /s/go13todo go.dev/s/go13todo
The list is aspirational; not all of it will get done.
@ -34,7 +34,7 @@ Finally!
* Copying stacks (1/2)
.link http://golang.org/s/contigstacks
.link /s/contigstacks go.dev/s/contigstacks
Go 1.2's stack split mechanism has a "hot split" problem.
@ -67,7 +67,7 @@ And many more to come...
* Channel rewrite
.link http://golang.org/s/go13chan
.link /s/go13chan go.dev/s/go13chan
Goals:
@ -131,7 +131,7 @@ This is an experimental type and might not be released.
* Native Client port
.link http://golang.org/s/go13nacl
.link /s/go13nacl go.dev/s/go13nacl
Native Client (NaCl) is a restricted execution environment for x86 binaries.
@ -159,7 +159,7 @@ darwin/arm, android/arm: a contributor is working on these, some way to go.
* The go command and fsnotify
.link http://golang.org/s/go13fsnotify
.link /s/go13fsnotify go.dev/s/go13fsnotify
In Go 1.2, `go` `build` stats every dependent source file to see whether they have changed.
@ -173,7 +173,7 @@ A new `os/fsnotify` package will be added to the standard library to support the
A proposed interface is discussed here:
.link http://golang.org/cl/48310043
.link /cl/48310043 go.dev/cl/48310043
* Support for linking against Objective C code
@ -187,7 +187,7 @@ This will make it easier to write native OS X applications.
* Address binary bloat
.link http://golang.org/issue/6853
.link /issue/6853 go.dev/issue/6853
Go binaries are getting pretty big. Rob ran an experiment:
@ -207,7 +207,7 @@ Speaking of which...
* Linker overhaul (1/3)
.link http://golang.org/s/go13linker
.link /s/go13linker go.dev/s/go13linker
The `gc` tool chain is a bit unconventional.
@ -241,7 +241,7 @@ And because the linker is much simpler now, we can rewrite it in Go.
* Compiler overhaul
.link http://golang.org/s/go13compiler
.link /s/go13compiler go.dev/s/go13compiler
The "gc" tool chain is based on the Plan 9 C compilers.

Просмотреть файл

@ -197,7 +197,7 @@ Audio is generated by a chain of `Processors`:
* Interfaces: Roshi
Roshi is a time-series event store written by Peter Bourgon. It provides this API:
Insert(key, timestamp, value)
Delete(key, timestamp, value)
Select(key, offset, limit) []TimestampValue
@ -674,7 +674,7 @@ This leads to good names and simpler interfaces.
With the source as the single source of truth,
there are no makefiles to get out of sync.
(This design enables great tools like [[http://godoc.org][godoc.org]] and goimports.)
(This design enables great tools like [[https://pkg.go.dev][pkg.go.dev]] and goimports.)
Predictable semantics make packages easy to read, understand, and use.

Просмотреть файл

@ -32,7 +32,7 @@ Others:
- Mozilla
- ...
[[http://golang.org/wiki/GoUsers][golang.org/wiki/GoUsers]]
[[/wiki/GoUsers][go.dev/wiki/GoUsers]]
* Who uses Go?
@ -61,7 +61,7 @@ Orthogonal features
“The ratio of time spent reading (code) versus writing is well over 10 to 1 ... (therefore) making it easy to read makes it easier to write.”
― Robert C. Martin
.image go4java/img/piet.png 500 600
.image go4java/img/piet.png 500 600
* Safety
@ -122,7 +122,7 @@ Go is Object Oriented, but doesn't have the keywords:
}
- slices and arrays
[]int, [3]string, []struct{ Name string }
- maps
@ -629,9 +629,9 @@ Ok, I'm just bragging here
And there's lots to learn!
- [[http://go.dev/talks/2012/concurrency.slide#1][Go Concurrency Patterns]], by Rob Pike
- [[http://go.dev/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
- [[http://go.dev/talks/2012/waza.slide#1][Concurrency is not Parallelism]], by Rob Pike
- [[/talks/2012/concurrency.slide#1][Go Concurrency Patterns]], by Rob Pike
- [[/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
- [[/talks/2012/waza.slide#1][Concurrency is not Parallelism]], by Rob Pike
.image go4java/img/busy.jpg
@ -658,10 +658,10 @@ Concurrency is awesome, and you should check it out.
* What to do next?
Learn Go on your browser with [[http://tour.golang.org][tour.golang.org]]
Learn Go on your browser with [[/tour/][go.dev/tour]]
Find more about Go on [[http://golang.org][golang.org]]
Find more about Go on [[/][go.dev]]
Join the community at [[https://groups.google.com/forum/#!forum/Golang-nuts][golang-nuts]]
Link to the slides [[http://go.dev/talks/2014/go4java.slide]]
Link to the slides [[/talks/2014/go4java.slide]]

Просмотреть файл

@ -121,7 +121,7 @@ A `Context` carries a cancellation signal and request-scoped values to all funct
// If ctx.Done is closed, ReadFile returns ctx.Err immediately.
func ReadFile(ctx context.Context, name string) ([]byte, error)
Examples and discussion in [[http://blog.golang.org/context][blog.golang.org/context]].
Examples and discussion in [[/blog/context][blog.golang.org/context]].
* Contexts are hierarchical
@ -149,7 +149,7 @@ _After_the_last_value_has_been_received_from_a_closed_channel_c,_any_receive_fro
Any number of goroutines can `select` on `<-ctx.Done()`.
Examples and discussion in in [[http://blog.golang.org/pipelines][blog.golang.org/pipelines]].
Examples and discussion in in [[/blog/pipelines][blog.golang.org/pipelines]].
Using `close` requires care.
@ -175,7 +175,7 @@ RPC servers decode them into a new `Context` for the handler function.
* Replicated Search
Example from [[https://go.dev/talks/2012/concurrency.slide][Go Concurrency Patterns]].
Example from [[/talks/2012/concurrency.slide][Go Concurrency Patterns]].
.code gotham-context/first.go /START1/,/STOP1/
@ -251,7 +251,7 @@ Repeat until `context.TODO()` is gone.
* Finding relevant functions
The [[http://godoc.org/golang.org/x/tools/cmd/callgraph][golang.org/x/tools/cmd/callgraph]] tool constructs the call graph of a Go program.
The [[https://pkg.go.dev/golang.org/x/tools/cmd/callgraph][golang.org/x/tools/cmd/callgraph]] tool constructs the call graph of a Go program.
It uses whole-program pointer analysis to find dynamic calls (via interfaces or function values).
@ -283,7 +283,7 @@ We want to restrict the transformation to specific method signatures.
* The eg tool
The [[http://godoc.org/golang.org/x/tools/cmd/eg][golang.org/x/tools/cmd/eg]] tool performs precise example-based refactoring.
The [[https://pkg.go.dev/golang.org/x/tools/cmd/eg][golang.org/x/tools/cmd/eg]] tool performs precise example-based refactoring.
The `before` expression specifies a pattern and the `after` expression its replacement.
@ -299,7 +299,7 @@ If `M` called via interface `I`, then `I.M` also needs to change. The eg tool c
When we change `I`, we need to update all of its implementations.
Find types assignable to `I` using [[http://godoc.org/golang.org/x/tools/go/types][golang.org/x/tools/go/types]].
Find types assignable to `I` using [[https://pkg.go.dev/golang.org/x/tools/go/types][golang.org/x/tools/go/types]].
More to do here.
@ -330,6 +330,6 @@ New code should use `Context`.
Links:
- [[http://golang.org/x/net/context][golang.org/x/net/context]] - package
- [[http://blog.golang.org/context][blog.golang.org/context]] - blog post
- [[http://golang.org/x/tools/cmd/eg][golang.org/x/tools/cmd/eg]] - eg tool
- [[https://pkg.go.dev/golang.org/x/net/context][golang.org/x/net/context]] - package
- [[/blog/context][blog.golang.org/context]] - blog post
- [[https://pkg.go.dev/golang.org/x/tools/cmd/eg][golang.org/x/tools/cmd/eg]] - eg tool

Просмотреть файл

@ -38,17 +38,17 @@ With the `mobile` subrepository and the Android SDK/NDK, it can:
- JDK / runtime hooks
- The `gobind` tool, for calling Go from Java: [[http://golang.org/s/gobind]]
- The `gobind` tool, for calling Go from Java: [[/s/gobind]]
Packages for cross-device apps:
- [[https://godoc.org/golang.org/x/mobile/app][App control]]
- [[https://pkg.go.dev/golang.org/x/mobile/app][App control]]
- [[https://godoc.org/golang.org/x/mobile/gl][OpenGL ES 2]]
- [[https://pkg.go.dev/golang.org/x/mobile/gl][OpenGL ES 2]]
- [[https://godoc.org/golang.org/x/mobile/event][Touch events]]
- [[https://pkg.go.dev/golang.org/x/mobile/event][Touch events]]
- [[https://godoc.org/golang.org/x/mobile/geom][Screen geometry]]
- [[https://pkg.go.dev/golang.org/x/mobile/geom][Screen geometry]]
* What's missing — a good build system
@ -77,7 +77,7 @@ Share the Go using interfaces generated by `gobind`.
Games.
Use OpenGL or the coming 2D [[http://godoc.org/golang.org/x/mobile/sprite][sprite]] package to write to the screen.
Use OpenGL or the coming 2D [[https://pkg.go.dev/golang.org/x/mobile/sprite][sprite]] package to write to the screen.
Everything is written in Go.
* Hello, World!

Просмотреть файл

@ -104,7 +104,7 @@ to
strings/reader.go: Seek 90.9%
strings/reader.go: WriteTo 83.3%
...
$ go tool cover -html=c.out
# opens a browser window, shows line-by-line coverage

Просмотреть файл

@ -4,9 +4,7 @@ Gophercon Opening Keynote
Rob Pike
Google, Inc.
@rob_pike
http://golang.org/s/plusrob
http://golang.org
https://go.dev
* Video
@ -208,7 +206,7 @@ No subpackages.
Separation of package name and package path.
Visibility is package-level, not type-level.
Within a package, you have the whole language, outside only what you permit.
* main
One place where C legacy shows through.
@ -313,7 +311,7 @@ UTF-8 input source, so strings as literals are UTF-8 automatically.
But what is a string?
One of the first things written in the specification, hardly changed today.
.link http://blog.golang.org/strings
.link /blog/strings go.dev/blog/strings
* )
@ -362,11 +360,11 @@ Now watch similar evolution of a second program.
Problem specification from
_Communicating_Sequential_Processes_, by C. A. R. Hoare, 1978
"Problem: To print in ascending order all primes less than
10000. Use an array of processes, SIEVE, in which each
process inputs a prime from its predecessor and prints it.
The process then inputs an ascending stream of numbers
from its predecessor and passes them on to its successor,
"Problem: To print in ascending order all primes less than
10000. Use an array of processes, SIEVE, in which each
process inputs a prime from its predecessor and prints it.
The process then inputs an ascending stream of numbers
from its predecessor and passes them on to its successor,
suppressing any that are multiples of the original prime. "
* Solution
@ -520,7 +518,7 @@ coupled to a language designed for today's world.
* Fitness to purpose
From _Go:_the_emerging_language_of_cloud_infrastructure_ by Donnie Berkholz, March 2014.
[[http://golang.org/s/emerging]]
[[/s/emerging]]
.image hellogophers/emerging.png

Просмотреть файл

@ -5,7 +5,7 @@ Andrew Gerrand
Google Inc.
adg@golang.org
@enneff
https://golang.org/
https://go.dev/
* Names matter
@ -133,7 +133,7 @@ By convention, they are one or two characters that reflect the receiver type,
because they typically appear on almost every line:
func (b *Buffer) Read(p []byte) (n int, err error)
func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request)
func (r Rectangle) Size() Point

Просмотреть файл

@ -326,8 +326,8 @@ Package docs go above the package declaration:
// Package fmt…
package fmt
Read the world's Go docs on [[godoc.org]]. E.g.
Read the world's Go docs on [[https://pkg.go.dev]]. E.g.
[[http://godoc.org/code.google.com/p/go.tools/cmd/vet]]
[[https://pkg.go.dev/golang.org/x/tools/txtar]]
* Questions?

Просмотреть файл

@ -29,17 +29,17 @@ http://campoy.cat
* The Go tour
.image playground/img/tour.png 500 _
.caption [[http://tour.golang.org][tour.golang.org]]
.caption [[/tour/][go.dev/tour]]
* Executable examples on documentation
.image playground/img/examples.png 500 _
.caption [[http://golang.org/pkg/strings/#example_Fields][golang.org/pkg/strings]]
.caption [[/pkg/strings/#example_Fields][go.dev/pkg/strings]]
* Executable code on blog posts
.image playground/img/blog.png 500 _
.caption [[http://blog.golang.org/slices]]
.caption [[/blog/slices][go.dev/blog/slices]]
* Executable slides
@ -305,16 +305,16 @@ Returns directly
* References
These slides: [[http://go.dev/talks/2014/playground.slide]]
These slides: [[/talks/2014/playground.slide]]
More about the Go tour:
- Inside the Go playground: [[http://blog.golang.org/playground]]
- Inside the Go playground: [[/blog/playground][go.dev/blog/playground]]
- The Go tour: [[http://tour.golang.org]]
- The Go tour: [[/tour/][go.dev/tour]]
More about Go on NaCl:
- Running Go under Native Client: [[https://code.google.com/p/go-wiki/wiki/NativeClient]]
- Go 1.3 Native Client Support: [[http://golang.org/s/go13nacl]]
- Go 1.3 Native Client Support: [[/s/go13nacl]]

Просмотреть файл

@ -52,10 +52,10 @@ _"_Want_to_understand_something_in_google_servers?_Read_the_Go_implementation!_"
* Good tools
[[https://golang.org/cmd/gofmt/][go fmt]] - format Go programs.
[[https://godoc.org/golang.org/x/tools/cmd/vet][go vet]] - report suspicious code
[[/cmd/gofmt/][go fmt]] - format Go programs.
[[/cmd/vet][go vet]] - report suspicious code
[[https://github.com/golang/lint][golint]] - report coding style errors.
[[http://blog.golang.org/godoc-documenting-go-code][godoc]] - browse documentation
[[/blog/godoc-documenting-go-code][godoc]] - browse documentation
# Go code is easy to read for tools too.
@ -68,7 +68,7 @@ _"_Want_to_understand_something_in_google_servers?_Read_the_Go_implementation!_"
Readable code == easy to recognize, less burden for brain.
Both writer and reader should have readability skills.
Go is very simple ([[https://golang.org/ref/spec][lang spec]] is about 50 pages)
Go is very simple ([[/ref/spec][lang spec]] is about 50 pages)
.image readability/gophers5th.jpg
.caption _Gopher_ by [[http://www.reneefrench.com][Renée French]]
@ -95,10 +95,10 @@ revised
.code readability/err_regexp_good.go
- Check error with [[https://golang.org/pkg/regexp/#MustCompile][regexp.MustCompile]].
- Must should be used only in [[http://golang.org/ref/spec#Package_initialization][initialization]] (package `var` or `init()`).
- Check error with [[/pkg/regexp/#MustCompile][regexp.MustCompile]].
- Must should be used only in [[/ref/spec#Package_initialization][initialization]] (package `var` or `init()`).
- [[http://golang.org/ref/spec#String_literals][Raw string literal]] makes it easy to read regexp.
- [[/ref/spec#String_literals][Raw string literal]] makes it easy to read regexp.
* error check: original code
@ -121,7 +121,7 @@ revised
.code readability/val-and-error.go
[[http://golang.org/doc/effective_go.html#multiple-returns][Return error as error, not as some value]]
[[/doc/effective_go.html#multiple-returns][Return error as error, not as some value]]
* error design
@ -144,15 +144,15 @@ If you want to put detailed information in error.
&FooError{ /* set error data */ }
Don't use `panic`.
But when you do, use it only within the package, and [[http://golang.org/doc/effective_go.html#recover][return error with catching it by recover]].
But when you do, use it only within the package, and [[/doc/effective_go.html#recover][return error with catching it by recover]].
* nil error
.code readability/nil_error.go
[[https://golang.org/doc/faq#nil_error][FAQ: Why is my nil error value not equal to nil?]]
[[/doc/faq#nil_error][FAQ: Why is my nil error value not equal to nil?]]
[[http://blog.golang.org/laws-of-reflection][interface has 2 data]] (type and value). interface value is nil == both are nil.
[[/blog/laws-of-reflection][interface has 2 data]] (type and value). interface value is nil == both are nil.
* embed interface: original code
@ -165,7 +165,7 @@ But when you do, use it only within the package, and [[http://golang.org/doc/eff
.code readability/implement-interface-good.go
- The original author wanted to check `ColumnWriter` [[http://golang.org/doc/effective_go.html#blank_implements][implements]] the `scan.Writer` interface.
- The original author wanted to check `ColumnWriter` [[/doc/effective_go.html#blank_implements][implements]] the `scan.Writer` interface.
* embed interface
@ -186,7 +186,7 @@ It would be useful in a test when you want to implement only a subset of methods
.code readability/struct-field-good.go
- Organize fields in groups, with blank lines between them.
- Put [[https://golang.org/pkg/sync/#Mutex][sync.Mutex]] in top of a block of fields that the mutex protects.
- Put [[/pkg/sync/#Mutex][sync.Mutex]] in top of a block of fields that the mutex protects.
* Long line
@ -196,19 +196,19 @@ It would be useful in a test when you want to implement only a subset of methods
.code readability/long-line-nofold.go
- [[https://golang.org/s/comments#Line_Length][No rigid line length limit]]
- [[/s/comments#Line_Length][No rigid line length limit]]
- though, can't we make it shorter?
* Choose concise names
[[https://golang.org/s/comments#Variable_Names][Choose good name in the context]]
[[/s/comments#Variable_Names][Choose good name in the context]]
- Long names are not always better than short names.
Short and accurate names.
- [[https://golang.org/s/comments#Package_Names][SamplingServer in sampling package is stutter]]. Name `Server`, which clients will write as `sampling.Server`.
- Use [[https://golang.org/s/comments#Receiver_Names][one or two letters for receiver names]].
- [[/s/comments#Package_Names][SamplingServer in sampling package is stutter]]. Name `Server`, which clients will write as `sampling.Server`.
- Use [[/s/comments#Receiver_Names][one or two letters for receiver names]].
- Use short names for parameters since type name will give some information.
- Use descriptive names for basic types, though.
- Use short names for local variables: prefer `i` to `index`, `r` to `reader`.
@ -222,7 +222,7 @@ Short and accurate names.
* conditional branch
- [[https://golang.org/s/comments#Indent_Error_Flow][Keep the normal code path at a minimal indentation.]]
- [[/s/comments#Indent_Error_Flow][Keep the normal code path at a minimal indentation.]]
original code
@ -250,13 +250,13 @@ revised
.code readability/if-switch-good.go
- use [[http://golang.org/ref/spec#Switch_statements][switch]]
- use [[/ref/spec#Switch_statements][switch]]
* Simpler code
* time.Duration
Use [[https://golang.org/pkg/time/#Duration][time.Duration]] ([[https://golang.org/pkg/flag/#Duration][flag.Duration]]) rather than `int` or `float` to represent time duration.
Use [[/pkg/time/#Duration][time.Duration]] ([[/pkg/flag/#Duration][flag.Duration]]) rather than `int` or `float` to represent time duration.
original code
@ -269,7 +269,7 @@ revised
.code readability/time_duration_good.go
- Don't write unnecessary type conversion.
- Since [[http://blog.golang.org/constants][const is untyped]], no need to convert 30 to `time.Duration`.
- Since [[/blog/constants][const is untyped]], no need to convert 30 to `time.Duration`.
- Don't write unnecessary comments.
* sync.Mutex and sync.Cond: original code
@ -280,7 +280,7 @@ revised
.code readability/close-cond-good.go
- You could use [[http://golang.org/ref/spec#Channel_types][chan]], instead of [[https://golang.org/pkg/sync/#Mutex][sync.Mutex]] and [[https://golang.org/pkg/sync/#Cond][sync.Cond]].
- You could use [[/ref/spec#Channel_types][chan]], instead of [[/pkg/sync/#Mutex][sync.Mutex]] and [[/pkg/sync/#Cond][sync.Cond]].
* reflect: original code
@ -290,7 +290,7 @@ revised
.code readability/reflect-good.go
- Don't use [[https://golang.org/pkg/reflect/][reflect]], if you know the type at compilation time.
- Don't use [[/pkg/reflect/][reflect]], if you know the type at compilation time.
* Test
@ -298,9 +298,9 @@ revised
.code readability/test-pattern_en.go
- [[https://golang.org/s/comments#Useful_Test_Failures][Have helpful test failure messages]]
- [[/s/comments#Useful_Test_Failures][Have helpful test failure messages]]
- Don't create yet-another assert function. Use existing programming language features.
- Write [[https://golang.org/pkg/testing/#hdr-Examples][an example test]] rather than writing how to use API in a doc comment.
- Write [[/pkg/testing/#hdr-Examples][an example test]] rather than writing how to use API in a doc comment.
.code readability/example_test.go
@ -308,9 +308,9 @@ revised
* Comment
[[https://golang.org/s/comments#Package_Comments][Write package comment.]] Write command comment in main package.
[[https://golang.org/s/comments#Doc_Comments][Write comments on exported names.]]
[[https://golang.org/s/comments#Comment_Sentences][Doc comment should be a complete sentence that starts with the name being declared.]]
[[/s/comments#Package_Comments][Write package comment.]] Write command comment in main package.
[[/s/comments#Doc_Comments][Write comments on exported names.]]
[[/s/comments#Comment_Sentences][Doc comment should be a complete sentence that starts with the name being declared.]]
// Package math provides basic constants and mathematical functions.
package math
@ -321,7 +321,7 @@ revised
// Encode writes the JSON encoding of req to w.
func Encode(w io.Writer, req *Request) {
Browse with [[http://blog.golang.org/godoc-documenting-go-code][godoc]]
Browse with [[/blog/godoc-documenting-go-code][godoc]]
$ godoc bytes Buffer
@ -338,11 +338,11 @@ Important to choose a good package name.
Make API simple.
- [[http://golang.org/doc/effective_go.html#multiple-returns][Use multiple returns]]. Don't use pointers as output parameters.
- [[/doc/effective_go.html#multiple-returns][Use multiple returns]]. Don't use pointers as output parameters.
- Don't use pointer to slice, map, chan or interface.
- [[http://golang.org/doc/effective_go.html#multiple-returns][Return error as error]]: [[https://golang.org/s/comments#Don't_Panic][don't panic]]
- Implement common interfaces ([[https://golang.org/pkg/fmt/#Stringer][fmt.Stringer]], [[https://golang.org/pkg/io/#Reader][io.Reader]] and so on) if they match your code.
- Use interfaces for parameters. They makes it easier to test. e.g.: If a function reads from a file, use [[https://golang.org/pkg/io/#Reader][io.Reader]] as a parameter instead of [[https://golang.org/pkg/os/#File][*os.File]].
- [[/doc/effective_go.html#multiple-returns][Return error as error]]: [[/s/comments#Don't_Panic][don't panic]]
- Implement common interfaces ([[/pkg/fmt/#Stringer][fmt.Stringer]], [[/pkg/io/#Reader][io.Reader]] and so on) if they match your code.
- Use interfaces for parameters. They makes it easier to test. e.g.: If a function reads from a file, use [[/pkg/io/#Reader][io.Reader]] as a parameter instead of [[/pkg/os/#File][*os.File]].
- Prefer synchronous API to async API: refrain from using chan across package boundary.
- Clients can easily run synchronous API concurrently with goroutine and chan.
@ -371,13 +371,13 @@ Keep in mind
* References
- Effective Go: [[https://golang.org/doc/effective_go.html][https://golang.org/doc/effective_go.html]]
- standard package: [[https://golang.org/pkg/][https://golang.org/pkg/]]
- Code Review Comments: [[https://golang.org/s/comments][https://golang.org/s/comments]]
- Effective Go: [[/doc/effective_go.html][go.dev/doc/effective_go.html]]
- standard package: [[/pkg/][go.dev/pkg/]]
- Code Review Comments: [[/s/comments][go.dev/s/comments]]
- Go for gophers: [[http://go.dev/talks/2014/go4gophers.slide][http://go.dev/talks/2014/go4gophers.slide]]
- What's in a name? [[http://go.dev/talks/2014/names.slide][http://go.dev/talks/2014/names.slide]]
- Organizing Go code: [[http://go.dev/talks/2014/organizeio.slide][http://go.dev/talks/2014/organizeio.slide]]
- Go for gophers: [[/talks/2014/go4gophers.slide][/talks/2014/go4gophers.slide]]
- What's in a name? [[/talks/2014/names.slide][/talks/2014/names.slide]]
- Organizing Go code: [[/talks/2014/organizeio.slide][/talks/2014/organizeio.slide]]
.image readability/ref.png
.caption _Gopher_ by [[http://www.reneefrench.com][Renée French]]

Просмотреть файл

@ -3,7 +3,7 @@ The Research Problems of Implementing Go
Russ Cox
Google
http://golang.org/
https://go.dev/
* About the Talk
@ -52,7 +52,7 @@ A simple but powerful and fun language.
For more background on design:
- [[http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html][Less is exponentially more]]
- [[http://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
- [[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
* Research and Go

Просмотреть файл

@ -3,7 +3,7 @@ More Research Problems of Implementing Go
Dmitry Vyukov
Google
http://golang.org/
https://go.dev/
* About Go
@ -48,7 +48,7 @@ A simple but powerful and fun language.
For more background on design:
- [[http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html][Less is exponentially more]]
- [[http://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
- [[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]]
* Research and Go

Просмотреть файл

@ -171,7 +171,7 @@ And, later:
- `$GOPATH/src/mypkg/internal/foo` can be imported only by code in `$GOPATH/src/mypkg`.
.link http://golang.org/s/go14internal
.link /s/go14internal go.dev/s/go14internal
* src/pkg → src
@ -182,7 +182,7 @@ Basically makes `$GOROOT` work just like `$GOPATH`.
(Not a big deal for most, but a nice clean up for the core.)
.link http://golang.org/s/go14nopkg
.link /s/go14nopkg go.dev/s/go14nopkg
* File system access throttling
@ -244,7 +244,7 @@ Rough estimate: 10-20% overall speedup, 20-50% GC pause reduction, 5-10% RSS red
Details:
.link http://golang.org/s/go14mallocgc
.link /s/go14mallocgc go.dev/s/go14mallocgc
* Other runtime changes
@ -282,12 +282,12 @@ Goal: enough support for writing games.
Based on the work of Elias Naur and others in the community.
.link http://golang.org/s/go14android
.link /s/go14android go.dev/s/go14android
* More
.link http://golang.org/s/go14todo
.link /s/go14todo go.dev/s/go14todo
* Questions?

Просмотреть файл

@ -91,7 +91,7 @@ With gccgo, more.
// new:
delete(name, userID)
- [[https://golang.org/doc/go1compat][stability promise]] + API check tool:
- [[/doc/go1compat][stability promise]] + API check tool:
pkg net/http, const StatusOK = 200
pkg net/http, const StatusOK ideal-int
@ -182,9 +182,9 @@ Requires knowing what every position in memory _actually_ is.
* Better docs
- [[http://blog.golang.org][Blog]] articles,
- Community [[https://golang.org/wiki][Wiki]],
- [[https://golang.org/wiki/Books][Books]]
- [[/blog][Blog]] articles,
- Community [[/wiki][Wiki]],
- [[/wiki/Books][Books]]
* Users: up and to the right
@ -233,12 +233,12 @@ Requires knowing what every position in memory _actually_ is.
* Better tools
- go/parser: godoc, [[http://godoc.org]], gofmt, gofix →
- [[http://godoc.org/code.google.com/p/go.tools/cmd/goimports][goimports]]: automatic import lines
- go/types, gofix+types,
- go/ast, go/ssa, [[http://godoc.org/code.google.com/p/go.tools/cmd/oracle][oracle]],
- [[http://godoc.org/code.google.com/p/go.tools/cmd/eg][eg]], example-based refactoring
- [[http://godoc.org/code.google.com/p/go.tools/cmd/gorename][gorename]], safe global renaming tool
- go/parser: godoc, [[https://pkg.go.dev]], gofmt, gofix →
- [[https://pkg.go.dev/code.google.com/p/go.tools/cmd/goimports][goimports]]: automatic import lines
- go/types, gofix+types,
- go/ast, go/ssa, [[https://pkg.go.dev/code.google.com/p/go.tools/cmd/oracle][oracle]],
- [[https://pkg.go.dev/code.google.com/p/go.tools/cmd/eg][eg]], example-based refactoring
- [[https://pkg.go.dev/code.google.com/p/go.tools/cmd/gorename][gorename]], safe global renaming tool
Tooling begets better tooling!
@ -260,10 +260,10 @@ Tooling begets better tooling!
* Go 1.4
- [[http://golang.org/s/go14android][GOOS=android]] (Elias Naur, David Crawshaw)
- [[/s/go14android][GOOS=android]] (Elias Naur, David Crawshaw)
- GOOS=nacl GOARCH=arm
- [[http://golang.org/s/go14internal]["internal" packages]]
- [[http://golang.org/s/go1.4-generate]["go generate"]]
- [[/s/go14internal]["internal" packages]]
- [[/s/go1.4-generate]["go generate"]]
- [[https://docs.google.com/a/golang.org/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs][syscall package frozen, go.sys]]
- "go tool pprof" converted from Perl (!) to Go
- minor stdlib additions, improvements
@ -273,7 +273,7 @@ Tooling begets better tooling!
* Go 1.5 (2014-06-01?)
- Concurrent GC is main theme
- Roadmap: [[http://golang.org/s/go14gc]] (GC in 1.4, 1.5, 1.6+)
- Roadmap: [[/s/go14gc]] (GC in 1.4, 1.5, 1.6+)
* Go 1.5: ports
@ -298,7 +298,7 @@ Didn't make Go 1.4:
- unify all `8g`, `5g`, `6g`, `9g`
- SSA form, new optimizations
See rsc's GopherCon [[http://go.dev/talks/2014/c2go.slide#1][slides]], [[http://gophercon.sourcegraph.com/post/83820197495/russ-cox-porting-the-go-compiler-from-c-to-go][notes]], [[https://www.youtube.com/watch?v=QIE5nV5fDwA][video]].
See rsc's GopherCon [[/talks/2014/c2go.slide#1][slides]], [[http://gophercon.sourcegraph.com/post/83820197495/russ-cox-porting-the-go-compiler-from-c-to-go][notes]], [[https://www.youtube.com/watch?v=QIE5nV5fDwA][video]].
* Go 1.5 Tracing
@ -363,7 +363,7 @@ We can't wait to join them.
- everything is growing on top of everything else,
- hard to keep up with golang-dev@, golang-nuts@, bugs, wiki, new github projects, code reviews,
* You all are awesome
* You all are awesome
- keep being awesome
- keep making awesome things

Просмотреть файл

@ -46,7 +46,7 @@ Supports interactive, editor-integrated queries:
* Demo: godoc analysis features
.link http://golang.org/lib/godoc/analysis/help.html godoc -analysis=type,pointer
.link /lib/godoc/analysis/help.html godoc -analysis=type,pointer
Package view
- method set and _implements_ relation for every type
@ -85,7 +85,7 @@ Many subtle corners:
Making it correct, fast, and clean was a substantial project
.link http://godoc.org/golang.org/x/tools/go/types golang.org/x/tools/go/types
.link https://pkg.go.dev/golang.org/x/tools/go/types golang.org/x/tools/go/types
Author: Robert Griesemer
@ -103,7 +103,7 @@ All Go programs can be expressed using only ~30 basic instructions
Simple, explicit, high-level, high source fidelity
.link http://godoc.org/golang.org/x/tools/go/ssa golang.org/x/tools/go/ssa
.link https://pkg.go.dev/golang.org/x/tools/go/ssa golang.org/x/tools/go/ssa
The llgo project is using go/ssa as a front-end for LLVM
@ -128,7 +128,7 @@ Pointers complicate reasoning about program behaviour
We use *pointer* *analysis* to answer the question:
which variables might this pointer point to?
.link http://godoc.org/golang.org/x/tools/go/pointer golang.org/x/tools/go/pointer
.link https://pkg.go.dev/golang.org/x/tools/go/pointer golang.org/x/tools/go/pointer
# comment on go's appropriateness for this analysis:
# (closed program---no dlopen, classloading, no generics, typesafe)
@ -209,7 +209,7 @@ Lots of optimizations, for example:
_sparse_bit_vectors_, a very compact representation for points-to sets
.link http://godoc.org/golang.org/x/tools/container/ints golang.org/x/tools/container/ints
.link https://pkg.go.dev/golang.org/x/tools/container/ints golang.org/x/tools/container/ints
Solver log is >1GB. Debugging is fun.
@ -251,7 +251,7 @@ Sound: either a conflict is reported, or the refactoring preserves behaviour*
*except reflection
.link http://godoc.org/golang.org/x/tools/cmd/gorename golang.org/x/tools/cmd/gorename
.link https://pkg.go.dev/golang.org/x/tools/cmd/gorename golang.org/x/tools/cmd/gorename
* Demo: gorename
@ -273,7 +273,7 @@ Parameters are _wildcards_
% eg -t template.go <package> ...
.link http://godoc.org/golang.org/x/tools/cmd/eg golang.org/x/tools/cmd/eg
.link https://pkg.go.dev/golang.org/x/tools/cmd/eg golang.org/x/tools/cmd/eg
* Demo: eg

Просмотреть файл

@ -464,7 +464,7 @@ Reducer:
- Extensive standard library
.link http://golang.org/pkg/
.link /pkg/ go.dev/pkg/
- Powerful tools
@ -477,4 +477,4 @@ Reducer:
- Great documentation
.link http://tour.golang.org/#1
.link /tour/ go.dev/tour

Просмотреть файл

@ -251,9 +251,9 @@ To test this code, we invoke the test binary itself as a subprocess:
* More information
.link http://golang.org/pkg/testing/
.link /pkg/testing/ go.dev/pkg/testing/
.link http://golang.org/cmd/go/
.link /cmd/go/ go.dev/cmd/go/
.link http://golang.org
.link / go.dev

Просмотреть файл

@ -26,7 +26,7 @@ This talk was presented at [[http://javasig.com][NYJavaSIG]] on April 23, 2015.
"Go is an open source programming language that makes it easy to build simple, reliable, and efficient software."
.link http://golang.org
.link / go.dev
* History
@ -92,7 +92,7 @@ The target is networked servers, but it's a great general-purpose language.
* Who uses Go besides Google?
.link http://golang.org/wiki/GoUsers
.link /wiki/GoUsers go.dev/wiki/GoUsers
Apcera, Bitbucket, bitly, Canonical, CloudFlare, Core OS, Digital Ocean, Docker, Dropbox, Facebook, Getty Images, GitHub, Heroku, Iron.io, Kubernetes, Medium, MongoDB services, Mozilla services, New York Times, pool.ntp.org, Secret, SmugMug, SoundCloud, Stripe, Square, Thomson Reuters, Tumblr, ...
@ -147,7 +147,7 @@ Sometimes this means writing out a loop instead of invoking an obscure function.
For more background on design:
- [[http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html][Less is exponentially more (Pike, 2012)]]
- [[http://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering (Pike, 2012)]]
- [[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering (Pike, 2012)]]
* Examples
@ -423,7 +423,7 @@ Run it:
Generated documentation for the world's open-source Go code:
.link http://godoc.org
.link https://pkg.go.dev
* IDE and editor support
@ -443,12 +443,12 @@ Go tools meet you where you are.
Take the Go Tour online.
.link http://tour.golang.org
.link /tour/ go.dev/tour
Lots more material.
.link http://golang.org/wiki/Learn
.link /wiki/Learn go.dev/wiki/Learn
Great community.
.link http://golang.org/project
.link /project go.dev/project

Просмотреть файл

@ -76,7 +76,7 @@ Others:
- Mozilla
- ...
[[http://golang.org/wiki/GoUsers][golang.org/wiki/GoUsers]]
[[/wiki/GoUsers][go.dev/wiki/GoUsers]]
* Who uses Go?
@ -304,7 +304,7 @@ An example:
void write_to_file (const std::string & message) {
// mutex to protect file access
static std::mutex mutex;
// lock mutex before accessing file
// at the end of the scope unlock mutex
std::lock_guard<std::mutex> lock(mutex);
@ -338,7 +338,7 @@ But it's easy to limit heap allocations
- many values are allocated on the stack
- object pools: [[sync.Pool][http://golang.org/pkg/sync/#Pool]]
- object pools: [[/pkg/sync/#Pool][sync.Pool]]
- contiguous area of memory
@ -350,11 +350,11 @@ Trusted in production.
Brad Fitzpatrick's talk on migrating dl.google.com from C++ to Go:
- [[https://go.dev/talks/2013/oscon-dl.slide#1][dl.google.com: Powered by Go]]
- [[/talks/2013/oscon-dl.slide#1][dl.google.com: Powered by Go]]
Current state and road plan:
- [[http://golang.org/s/go14gc][golang.org/s/go14gc]]
- [[/s/go14gc][go.dev/s/go14gc]]
* Inheritance vs Composition
@ -373,7 +373,7 @@ Example:
We want `Car` to be able to `Start` and `Stop` too.
More detail in my talk [[http://go.dev/talks/2014/go4java.slide#32][Go for Javaneros]]
More detail in my talk [[/talks/2014/go4java.slide#32][Go for Javaneros]]
* Struct embedding
@ -681,9 +681,9 @@ Ok, I'm just bragging here
And there's lots to learn!
- [[http://go.dev/talks/2012/concurrency.slide#1][Go Concurrency Patterns]], by Rob Pike
- [[http://go.dev/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
- [[http://go.dev/talks/2012/waza.slide#1][Concurrency is not Parallelism]], by Rob Pike
- [[/talks/2012/concurrency.slide#1][Go Concurrency Patterns]], by Rob Pike
- [[/talks/2013/advconc.slide#1][Advanced Concurrency Patterns]], by Sameer Ajmani
- [[/talks/2012/waza.slide#1][Concurrency is not Parallelism]], by Rob Pike
.image go4cpp/busy.jpg
@ -703,10 +703,10 @@ And there's lots to learn!
* What to do next?
Learn Go on your browser with [[http://tour.golang.org][tour.golang.org]]
Learn Go on your browser with [[/tour/][go.dev/tour]]
Find more about Go on [[http://golang.org][golang.org]]
Find more about Go on [[/][go.dev]]
Join the community at [[https://groups.google.com/forum/#!forum/Golang-nuts][golang-nuts]]
Link to the slides [[http://go.dev/talks/2015/go4cpp.slide]]
Link to the slides [[/talks/2015/go4cpp.slide]]

Просмотреть файл

@ -5,7 +5,7 @@ Gopherfest
Rob Pike
Google
r@golang.org
http://golang.org/
https://go.dev/
* Go in Go
@ -35,7 +35,7 @@ Not for validation; we have more pragmatic motives:
Already seeing benefits, and it's early yet.
Design document: [[http://golang.org/s/go13compiler]]
Design document: [[/s/go13compiler]]
* Why move the runtime to Go?
@ -277,7 +277,7 @@ Therefore need to build or download a working Go installation to build 1.5 from
We use Go 1.4+ as the base to build the 1.5+ tool chain. (Newer is OK too.)
Details: [[http://golang.org/s/go15bootstrap]]
Details: [[/s/go15bootstrap]]
* Future

Просмотреть файл

@ -77,18 +77,18 @@ There is no Java or Objective-C or C in my code
golang.org/x/mobile/...
- [[https://golang.org/x/mobile/app][app: App control]]
- [[https://golang.org/x/mobile/asset][asset: Asset management]]
- [[https://golang.org/x/mobile/gl][gl: OpenGL ES 2]]
- [[https://golang.org/x/mobile/event][event: Events]]
- [[https://golang.org/x/mobile/geom][geom: Screen geometry]]
- [[https://pkg.go.dev/golang.org/x/mobile/app][app: App control]]
- [[https://pkg.go.dev/golang.org/x/mobile/asset][asset: Asset management]]
- [[https://pkg.go.dev/golang.org/x/mobile/gl][gl: OpenGL ES 2]]
- [[https://pkg.go.dev/golang.org/x/mobile/event][event: Events]]
- [[https://pkg.go.dev/golang.org/x/mobile/geom][geom: Screen geometry]]
golang.org/x/mobile/exp/...
- [[https://golang.org/x/mobile/exp/audio][audio: Audio]]
- [[https://golang.org/x/mobile/exp/font][font: System font]]
- [[https://golang.org/x/mobile/exp/sprite][sprite: 2-D rendering]]
- [[https://golang.org/x/mobile/exp/sensor][sensor: Sensors]]
- [[https://pkg.go.dev/golang.org/x/mobile/exp/audio][audio: Audio]]
- [[https://pkg.go.dev/golang.org/x/mobile/exp/font][font: System font]]
- [[https://pkg.go.dev/golang.org/x/mobile/exp/sprite][sprite: 2-D rendering]]
- [[https://pkg.go.dev/golang.org/x/mobile/exp/sensor][sensor: Sensors]]
* Challenge #2: Build systems
@ -130,7 +130,7 @@ Go 1.5 can build Go programs as a library that can be used by non-Go programs
Functions marked with `//export` cgo annotations are callable.
.link https://golang.org/s/execmodes
.link /s/execmodes go.dev/s/execmodes
* Working with Foreign Languages
@ -147,7 +147,7 @@ Automates language binding through code generation
Defines the language binding from exported Go APIs; no explicit annotation
Currently supports a [[https://golang.org/x/mobile/cmd/gobind][subset of Go types]]
Currently supports a [[https://pkg.go.dev/golang.org/x/mobile/cmd/gobind][subset of Go types]]
* Binding Functions, Basic Types & Errors
@ -201,17 +201,17 @@ Use it from Java
Counter counter = NewCounter();
counter.SetValue(12345);
counter.Inc();
* Generated Objective-C API
@interface GoMypkgCounter : NSObject { }
@property(strong, readonly) GoSeqRef *ref;
- (int64_t)Value;
- (void)setValue:(int64_t)v;
- (void)Inc;
@end
FOUNDATION_EXPORT GoMypkgCounter* GoMypkgNewCounter();
Use it from Objective-C
@ -255,7 +255,7 @@ To update the .aar,
* The Story of Ivy
The [[robpike.io/ivy][Ivy]] is a command line tool developed by Rob Pike
The [[https://robpike.io/ivy][Ivy]] is a command line tool developed by Rob Pike
It's a useful desktop calculator that handles big int, rational and floating-point numbers, vectors, matrices, ...
@ -300,8 +300,8 @@ The `gobind` tool for Java and Go language binding
Packages for cross-device apps: basic app control, OpenGL ES 2, touch
.link https://golang.org/s/go14android
.link https://golang.org/s/gobind
.link /s/go14android go.dev/s/go14android
.link /s/gobind go.dev/s/gobind
* Go 1.5: Hello iOS!
@ -315,7 +315,7 @@ iOS builder
Can call Go functions from foreign language in a clean way
.link https://golang.org/s/execmodes
.link /s/execmodes go.dev/s/execmodes
* Go 1.5: Better tools & more packages

Просмотреть файл

@ -64,17 +64,17 @@ Ten languages: *C*, *Java*, *Go*, C++, Node.js, Python, Ruby, Objective-C, PHP,
IDL: *Proto3*
Transport: *HTTP2*
[[http://golang.org/x/net/context][golang.org/x/net/context]] for deadlines, cancellation, and request-scoped values
[[http://golang.org/x/net/trace][golang.org/x/net/trace]] for real-time request traces and connection logging
[[https://pkg.go.dev/golang.org/x/net/context][golang.org/x/net/context]] for deadlines, cancellation, and request-scoped values
[[https://pkg.go.dev/golang.org/x/net/trace][golang.org/x/net/trace]] for real-time request traces and connection logging
* gRPC users
150+ imports of [[https://godoc.org/google.golang.org/grpc?importers][google.golang.org/grpc]] on [[http://godoc.org][godoc.org]]
150+ imports of [[https://pkg.go.dev/google.golang.org/grpc?tab=imports][google.golang.org/grpc]] on [[https://pkg.go.dev][pkg.go.dev]]
- [[https://github.com/apcera/kurma][Apcera/Kurma]]: container OS
- [[http://bazil.org][Bazil]]: distributed file system
- [[http://coreos.com/etcd/][CoreOS/Etcd]]: distributed consistent key-value store
- [[https://godoc.org/google.golang.org/cloud/bigtable][Google Cloud Bigtable]]: sparse table storage
- [[https://pkg.go.dev/google.golang.org/cloud/bigtable][Google Cloud Bigtable]]: sparse table storage
- [[https://github.com/monetas/bmd][Monetas/Bitmessage]]: transaction platform
- [[http://www.pachyderm.io/][Pachyderm]]: containerized data analytics
- [[http://vitess.io/][YouTube/Vitess]]: storage platform for scaling MySQL
@ -226,10 +226,10 @@ It is an excellent fit for building parallel, distributed, and streaming systems
- [[http://grpc.io][grpc.io]] - gRPC reference and tutorials
- [[https://github.com/golang/protobuf][github.com/golang/protobuf]] - Protocol buffers
- [[http://golang.org/x/net/http2][golang.org/x/net/http2]] - HTTP2
- [[http://golang.org/x/net/trace][golang.org/x/net/trace]] - Request traces and event logs
- [[http://golang.org/x/net/context][golang.org/x/net/context]] - Cancellation and request-scoped data
- [[http://blog.golang.org/pipelines][blog.golang.org/pipelines]] - Streaming data pipelines
- [[https://pkg.go.dev/golang.org/x/net/http2][golang.org/x/net/http2]] - HTTP2
- [[https://pkg.go.dev/golang.org/x/net/trace][golang.org/x/net/trace]] - Request traces and event logs
- [[https://pkg.go.dev/golang.org/x/net/context][golang.org/x/net/context]] - Cancellation and request-scoped data
- [[/blog/pipelines][blog.golang.org/pipelines]] - Streaming data pipelines
*Thanks*to* Qi Zhao, David Symonds, Brad Fitzpatrick, and the rest.

Просмотреть файл

@ -60,7 +60,7 @@ The first commit (now git hash `18c5b48`) was a draft of that spec:
Go's entire history is preserved in the core reposistory.
* The first Go program
* The first Go program
The first Go program was a Prime Sieve, and was included in the spec.
@ -108,7 +108,7 @@ The last Subversion commit (git hash `777ee7`, 21 July 2008) contained:
* Getting serious
In July 2008 the project migrated from Subversion to Perforce,
to use Google's excellent code review system.
@ -142,7 +142,7 @@ Before then, `fmt` had an awkward chaining API:
fmt.New().s("i = ").d(i).putnl()
Now:
Now:
fmt.Println("i = ", i)
@ -226,9 +226,9 @@ People sent changes from day one. The first non-Googler change:
Date: Tue Nov 10 20:04:14 2009 -0800
Fix go-mode.el to work on empty buffers
Fixes #8.
R=agl, agl1, rsc
https://golang.org/cl/153056
@ -249,7 +249,7 @@ But the process was now different, as they now had a community.
On December 9th, Rob Pike sent the first public change proposal.
He proposed to remove semicolons at line endings.
[[https://golang.org/s/semicolon-proposal][golang.org/s/semicolon-proposal]]
[[/s/semicolon-proposal][go.dev/s/semicolon-proposal]]
The proposal was a "design doc" that included:
@ -305,7 +305,7 @@ At first, we did a poor job explaining the project's goals and development proce
This caused frustration. ("Why don't they accept my suggestions?")
It took us a while to articulate it:
Rob Pike's [[http://go.dev/talks/2012/splash.article][talk]] in October 2012
Rob Pike's [[/talks/2012/splash.article][talk]] in October 2012
"Go at Google: Language Design in the Service of Software Engineering"
was the first thorough explanation of Go's _raison_d'être_.
@ -446,7 +446,7 @@ Presented the document to the community for discussion.
Community feedback essential in refining the document.
.link http://blog.golang.org/preview-of-go-version-1
.link /blog/preview-of-go-version-1 go.dev/blog/preview-of-go-version-1
* An example: errors (1/5)
@ -467,7 +467,7 @@ References to `os.Error` were ubiquitous.
type Reader interface {
Read(p []byte) (n int, err os.Error)
}
type Closer interface {
Close() os.Error
}
@ -487,14 +487,14 @@ At the meeting the team discussed the issue,
Russ presented data from his experiments with the change,
and we made a tentative decision:
.image how-go-was-made/errors-discussion.png 350 _
.image how-go-was-made/errors-discussion.png 350 _
* An example: errors (4/5)
On the list, the community made some keen suggestions:
.image how-go-was-made/errors-rog.png 500 _
.image how-go-was-made/errors-rog.png 500 _
* An example: errors (5/5)
@ -586,7 +586,7 @@ The new change process, in brief:
- The contributors review the document.
- If the proposal is accepted, implement it.
[[https://golang.org/s/proposal-process][golang.org/s/proposal-process]]
[[/s/proposal-process][go.dev/s/proposal-process]]
* An experimental process
@ -607,4 +607,4 @@ the community needs a larger role in shaping its future.
With your help, we can make Go's next 5 years more spectacular than the last.
.image how-go-was-made/5years.png 350 _
.image how-go-was-made/5years.png 350 _

Просмотреть файл

@ -276,7 +276,7 @@ You will see it as comments in the code like:
//go:generate go tool yacc -o gopher.go -p parser gopher.y
More information in the [[http://blog.golang.org/generate][blog post]].
More information in the [[/blog/generate][blog post]].
* code generation tools: stringer

Просмотреть файл

@ -5,9 +5,7 @@ dotGo
Rob Pike
Google
@rob_pike
[[http://golang.org/s/plusrob][+RobPikeTheHuman]]
http://golang.org/
https://go.dev/
* Bonjour mes Gophers!
@ -282,7 +280,7 @@ Simple idea took about a year to work out. Difficulties:
Still not totally satisfied, but the effect is that constants feel like numbers, contribute to the ease of using Go. But complicated behind the scenes.
More at [[http://blog.golang.org/constants][this blog post]].
More at [[/blog/constants][this blog post]].
* Interfaces

Просмотреть файл

@ -10,7 +10,7 @@ adg@golang.org
I gave a similar talk at FOSDEM in February 2015.
.link https://go.dev/talks/2015/state-of-go.slide
.link /talks/2015/state-of-go.slide go.dev/talks/2015/state-of-go.slide
This talk builds on that talk.
@ -48,7 +48,7 @@ Goals:
.image state-of-go-may/gc.png
.link https://golang.org/s/go14gc
.link /s/go14gc go.dev/s/go14gc
* Concurrent GC trade-offs
@ -128,7 +128,7 @@ Build a "Hello, world" program that links against the shared libraries:
Go 1.5 can also build Go programs as C archive files (for static linking)
or shared libraries (for dynamic linking) that can be consumed by C programs.
.link https://golang.org/s/execmodes
.link /s/execmodes go.dev/s/execmodes
(Demo)
@ -211,7 +211,7 @@ The new execution tracer collects data to produce diagrams of process execution.
Front end is the Android/Chrome trace-viewer. ([[https://github.com/google/trace-viewer][github.com/google/trace-viewer]])
.link http://golang.org/s/go15trace
.link /s/go15trace go.dev/s/go15trace
* Analysis and Refactoring Tools

Просмотреть файл

@ -21,7 +21,7 @@ Lots of behind-the-scenes work:
- Prep work for C to Go tool chain conversion.
- Source tree re-organization.
.link https://golang.org/doc/go1.4
.link /doc/go1.4 go.dev/doc/go1.4
* Transition to Git
@ -112,7 +112,7 @@ Machine-translated `gc` to replace `6g`, `8g`, etc.
Design doc:
.link https://golang.org/s/go13compiler
.link /s/go13compiler go.dev/s/go13compiler
Go 1.5 will have *no* C code in the tool chain or runtime.
@ -129,7 +129,7 @@ New OS or architecture ports will need to cross-compile.
Design doc:
.link https://golang.org/s/go15bootstrap
.link /s/go15bootstrap go.dev/s/go15bootstrap
If you use a binary distribution of Go, you don't need to do anything.
@ -145,7 +145,7 @@ Goal:
On track for Go 1.5.
.link https://golang.org/s/go14gc
.link /s/go14gc go.dev/s/go14gc
* HTTP/2
@ -205,7 +205,7 @@ It collects data to produce diagrams of process execution.
Front end is the Android/Chrome trace-viewer. ([[https://github.com/google/trace-viewer][github.com/google/trace-viewer]])
.link http://golang.org/s/go15trace
.link /s/go15trace go.dev/s/go15trace
* Analysis and Refactoring Tools

Просмотреть файл

@ -24,7 +24,7 @@ This talk was presented at the [[http://applicative.acm.org/][ACM Applicative]]
"Go is an open source programming language that makes it easy to build simple, reliable, and efficient software."
.link http://golang.org
.link / go.dev
* History
@ -94,7 +94,7 @@ The target is networked servers, but Go is a great general-purpose language.
* Who uses Go besides Google?
.link http://golang.org/wiki/GoUsers
.link /wiki/GoUsers go.dev/wiki/GoUsers
Aerospike, BBC Worldwide, Bitbucket, Booking.com, Core OS, Datadog, Digital Ocean, Docker, Dropbox, Facebook, Getty Images, GitHub, GOV.UK, Heroku, IBM, Intel, InfluxDB, Iron.io, Kubernetes, Medium, MongoDB, Mozilla services, Netflix, New York Times, pool.ntp.org, Rackspace, Shutterfly, SmugMug, SoundCloud, SpaceX, Square, Stack Exchange, Thomson Reuters Eikon, Tumblr, Twitch, Twitter, Uber, VMWare ...
@ -161,7 +161,7 @@ Sometimes this means writing out a loop instead of invoking an obscure function.
For more background on design:
- [[http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html][Less is exponentially more (Pike, 2012)]]
- [[http://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering (Pike, 2012)]]
- [[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering (Pike, 2012)]]
* Code examples
@ -408,11 +408,11 @@ No locks. No condition variables. No futures. No callbacks.
Take the Go Tour online.
.link http://tour.golang.org
.link /tour/ go.dev/tour
Then go deeper ...
.link http://golang.org/wiki/Learn
.link /wiki/Learn go.dev/wiki/Learn
Still interested?
@ -448,18 +448,18 @@ Go tools meet you where you are. There's no one "Go IDE".
- `gocode`: automatic completion
- the `go` tool: automatic fetch & build
- `guru`: static analysis, bug finding, code navigation
- [[http://godoc.org][godoc.org]]: open source package index and docs
- [[https://pkg.go.dev][pkg.go.dev]]: open source package index and docs
* Where to Go next
Take the Go Tour online.
.link http://tour.golang.org
.link /tour/ go.dev/tour
Lots more material.
.link http://golang.org/wiki/Learn
.link /wiki/Learn go.dev/wiki/Learn
Great community.
.link http://golang.org/project
.link /project go.dev/project

Просмотреть файл

@ -5,9 +5,7 @@ Gophercon
Rob Pike
Google
@rob_pike
[[http://golang.org/s/plusrob][+RobPikeTheHuman]]
http://golang.org/
https://go.dev/
* Presentation on youtube.com
@ -15,7 +13,7 @@ Video is [[https://www.youtube.com/watch?v=KINIAgRpkDA][here]].
* Motivation
_Why_Learn_Assembler_Language?_
_The_most_important_single_thing_to_realize_about_assembler_language_is_that_it_enables_the_programmer_to_use_all_System/360_machine_functions_as_if_he_were_coding_in_System/360_machine_language._
@ -65,7 +63,7 @@ Some examples...
.code asm/68000.s.txt
(From Wikipedia)
(From Wikipedia)
* CRAY-1
@ -185,11 +183,11 @@ The old `liblink` became a new suite of libraries, `obj/...`:
- `cmd/internal/obj/x86` (architecture-specific part)
- `cmd/internal/obj/arm` (architecture-specific part)
- ...
Previous presentations about this work:
- Russ Cox at Gophercon 2014 (out of date): [[youtube.com/watch?v=QIE5nV5fDwA]]
- Rob Pike at Gopherfest 2015: [[youtube.com/watch?v=cF1zJYkBW4A]]
- Russ Cox at Gophercon 2014 (out of date): [[https://youtube.com/watch?v=QIE5nV5fDwA]]
- Rob Pike at Gopherfest 2015: [[https://youtube.com/watch?v=cF1zJYkBW4A]]
* Go 1.5: Compiler and linker as single programs
The many compilers (`6g`, `8g` etc.) were replaced with a single tool: `compile`.

Просмотреть файл

@ -49,7 +49,7 @@ You might think of this as `go` `get`s codebase.
In contrast to Googles codebase,
`go` `get`s codebase is completely decentralized,
so its more difficult to get exact numbers.
In November 2016, there were 140,000 packages known to [[https://godoc.org/][godoc.org]],
In November 2016, there were 140,000 packages known to godoc.org
and over 160,000
[[https://github.com/search?utf8=%E2%9C%93&q=language%3AGo&type=Repositories&ref=searchresults][GitHub repos written in Go]].
@ -61,7 +61,7 @@ We made sure that there werent unnecessary dependencies
between packages, both to simplify programs and to make it
easier to test and refactor them.
For more detail about these considerations, see Rob Pikes 2012 article
“[[https://go.dev/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]].”
“[[/talks/2012/splash.article][Go at Google: Language Design in the Service of Software Engineering]].”
Over the past few years weve come to realize that theres
more that can and should be done to make it easier
@ -82,17 +82,17 @@ There are a few reasons you might want to change the way
a codebase is organized into packages.
The first reason is to split a package into more manageable pieces for users.
For example, most users of [[https://golang.org/pkg/regexp/][package regexp]] dont need access to the
regular expression parser, although [[https://godoc.org/github.com/google/codesearch/regexp][advanced uses may]],
so the parser is exported in [[https://golang.org/pkg/regexp/syntax][a separate regexp/syntax package]].
For example, most users of [[/pkg/regexp/][package regexp]] dont need access to the
regular expression parser, although [[https://pkg.go.dev/github.com/google/codesearch/regexp][advanced uses may]],
so the parser is exported in [[/pkg/regexp/syntax][a separate regexp/syntax package]].
The second reason is to [[https://blog.golang.org/package-names][improve naming]].
The second reason is to [[/blog/package-names][improve naming]].
For example, early versions of Go had an `io.ByteBuffer`,
but we decided `bytes.Buffer` was a better name and package bytes a better place for the code.
The third reason is to lighten dependencies.
For example, we moved `os.EOF` to `io.EOF` so that code not using the operating system
can avoid importing the fairly heavyweight [[https://golang.org/pkg/os][package os]].
can avoid importing the fairly heavyweight [[/pkg/os][package os]].
The fourth reason is to change the dependency graph
so that one package can import another.
@ -114,7 +114,7 @@ Before Go 1, the `os.FileInfo` struct contained these fields:
Notice the times `Atime_ns`, `Mtime_ns`, `Ctime_ns` have type int64,
an `_ns` suffix, and are commented as “nanoseconds since epoch.”
These fields would clearly be nicer using [[https://golang.org/pkg/time/#Time][`time.Time`]],
These fields would clearly be nicer using [[/pkg/time/#Time][`time.Time`]],
but mistakes in the design of the package structure of the codebase
prevented that.
To be able to use `time.Time` here, we refactored the codebase.
@ -132,9 +132,9 @@ As a result, operating system APIs could not use `time.Time`.
This kind of problem convinced us that
`os.Error` and its constructor `os.NewError` were so fundamental
that they should be moved out of package os.
In the end, we moved `os.Error` into the language as [[https://golang.org/ref/spec/#Errors][`error`]]
and `os.NewError` into the new
[[https://golang.org/pkg/errors][package errors]]
In the end, we moved `os.Error` into the language as [[/ref/spec/#Errors][`error`]]
and `os.NewError` into the new
[[/pkg/errors][package errors]]
as `errors.New`.
After this and other refactoring, the import graph in Go 1 looked like:
@ -142,18 +142,18 @@ After this and other refactoring, the import graph in Go 1 looked like:
Package io and package time had few enough dependencies
to be used by package os, and
the Go 1 definition of [[https://golang.org/pkg/os/#FileInfo][`os.FileInfo`]] does use `time.Time`.
the Go 1 definition of [[/pkg/os/#FileInfo][`os.FileInfo`]] does use `time.Time`.
(As a side note, our first idea was to move `os.Error` and `os.NewError`
to a new package named error (singular) as `error.Value` and `error.New`.
Feedback from Roger Peppe and others in the Go community helped us
see that making the error type predefined in the language would
allow its use even in low-level contexts like the specification of
[[https://golang.org/ref/spec#Run_time_panics][run-time panics]].
see that making the error type predefined in the language would
allow its use even in low-level contexts like the specification of
[[/ref/spec#Run_time_panics][run-time panics]].
Since the type was named `error`, the package became errors (plural)
and the constructor `errors.New`.
Andrew Gerrands 2015 talk
“[[https://go.dev/talks/2015/how-go-was-made.slide#37][How Go was Made]]” has more detail.)
“[[/talks/2015/how-go-was-made.slide#37][How Go was Made]]” has more detail.)
* Gradual code repair
@ -161,7 +161,7 @@ The benefits of a codebase refactoring apply throughout the codebase.
Unfortunately, so do the costs:
often a large number of repairs must be made as a result of the refactoring.
As codebases grow, it becomes infeasible to do all the repairs at one time.
The repairs must be done gradually,
The repairs must be done gradually,
and the programming language must make that possible.
As a simple example,
@ -170,7 +170,7 @@ moved two files, adjusted three makefiles, and repaired 43 other Go source files
The repairs outweighed the actual API change by a factor of twenty,
and the entire codebase was only 250 files.
As codebases grow, so does the repair multiplier.
Similar changes in large Go codebases,
Similar changes in large Go codebases,
such as Docker, and Juju, and Kubernetes,
can have repair multipliers ranging from 10X to 100X.
Inside Google weve seen repair multipliers well over 1000X.
@ -181,7 +181,7 @@ together in one big commit:
.html refactor/atomic.html
The argument in favor of this approach,
The argument in favor of this approach,
which we will call “atomic code repair,”
is that it is conceptually simple:
by updating the API and the code repairs in the same commit,
@ -245,11 +245,11 @@ That stub was in a new file named `io/xxx.go` that read:
// so that the protocol compiler's output
// still works. Once the protocol compiler
// gets fixed, this goes away.
package io
import "bytes"
type ByteBuffer struct {
bytes.Buffer;
}
@ -294,7 +294,7 @@ Lets look at examples of how Go makes that possible (or not).
Lets start with a simple example of moving a constant.
Package io defines the [[https://golang.org/pkg/io/#Seeker][Seeker interface]],
Package io defines the [[/pkg/io/#Seeker][Seeker interface]],
but the named constants that developers prefer to use
when invoking the `Seek` method came from package os.
Go 1.7 moved the constants to package io and gave them more idiomatic names;
@ -305,11 +305,11 @@ when the definitions use the same type and value:
package io
const SeekStart int = 0
package os
const SEEK_SET int = 0
Due to [[https://golang.org/doc/go1compat][Go 1 compatibility]],
Due to [[/doc/go1compat][Go 1 compatibility]],
were blocked in stage 2 of this gradual code change.
We cant delete the old constants,
but making the new ones available in package io allows
@ -330,7 +330,7 @@ Now lets look at moving a function from one package to another.
As mentioned above,
in 2011 we replaced `os.Error` with the predefined type `error`
and moved the constructor `os.NewError` to a new package as
[[https://golang.org/pkg/errors/#New][`errors.New`]].
[[/pkg/errors/#New][`errors.New`]].
For a function, one name is interchangeable with another
when the definitions use the same signature and implementation.
@ -339,7 +339,7 @@ the new function:
package errors
func New(msg string) error { ... }
package os
func NewError(msg string) os.Error {
return errors.New(msg)
@ -350,7 +350,7 @@ there is no way to tell these two functions apart.
The old and new API are interchangeable,
so we can proceed to stages 2 and 3.
(We are ignoring a small detail here: the original
(We are ignoring a small detail here: the original
`os.NewError` returned an `os.Error`, not an `error`,
and two functions with different signatures _are_ distinguishable.
To really make these functions indistinguishable,
@ -373,11 +373,11 @@ The simplest way to arrange that is to initialize one from the other:
package io
var EOF = ...
package os
var EOF = io.EOF
In this example, io.EOF and os.EOF are the same value.
In this example, io.EOF and os.EOF are the same value.
The variable values are completely interchangeable.
There is one small problem.
@ -401,20 +401,20 @@ Theres no way in Go to make two names of types interchangeable.
The closest we can come in Go is to give `os.Error` and `error` the same underlying definition:
package os
type Error error
type Error error
Even with this definition, and even though these are interface types,
Go still considers these two types [[https://golang.org/ref/spec#Type_identity][different]],
Go still considers these two types [[/ref/spec#Type_identity][different]],
so that a function returning an os.Error
is not the same as a function returning an error.
Consider the [[https://golang.org/pkg/io/#Reader][`io.Reader`]] interface:
Consider the [[/pkg/io/#Reader][`io.Reader`]] interface:
package io
type Reader interface {
Read(b []byte) (n int, err error)
}
If `io.Reader` is defined using `error`, as above, then a `Read` method
If `io.Reader` is defined using `error`, as above, then a `Read` method
returning `os.Error` will not satisfy the interface.
If theres no way to make two names for a type interchangeable,
@ -433,8 +433,8 @@ This problem with moving types is not limited to fundamental changes like `os.Er
nor is it limited to the Go repository.
Heres a change from the [[https://kubernetes.io/][Kubernetes project]].
Kubernetes has a package util, and at some point the developers
decided to split out that packages `IntOrString` type into its own
[[https://godoc.org/k8s.io/kubernetes/pkg/util/intstr][package intstr]].
decided to split out that packages `IntOrString` type into its own
[[https://pkg.go.dev/k8s.io/kubernetes/pkg/util/intstr][package intstr]].
Applying the pattern for a gradual code repair,
the first stage is to establish a way for the two types to be interchangeable.
@ -447,7 +447,7 @@ assigned has the correct type:
type IntOrString intstr.IntOrString
// Not good enough for:
// IngressBackend describes ...
type IngressBackend struct {
ServiceName string `json:"serviceName"`
@ -474,16 +474,16 @@ As another example,
heres a change from the [[https://www.docker.com/][Docker project]].
Docker has a package utils, and at some point the developers
decided to split out that packages `JSONError` type into a separate
[[https://godoc.org/github.com/docker/docker/pkg/jsonmessage#JSONError][jsonmessage package]].
[[https://pkg.go.dev/github.com/docker/docker/pkg/jsonmessage#JSONError][jsonmessage package]].
Again we have the problem that the old and new types are not interchangeable,
but it shows up in a different way, namely [[https://golang.org/ref/spec#Type_assertions][type assertions]]:
but it shows up in a different way, namely [[/ref/spec#Type_assertions][type assertions]]:
package utils
type JSONError jsonmessage.JSONError
// Not good enough for:
jsonError, ok := err.(*jsonmessage.JSONError)
if !ok {
jsonError = &jsonmessage.JSONError{
@ -494,14 +494,14 @@ but it shows up in a different way, namely [[https://golang.org/ref/spec#Type_as
If the error `err` not already a `JSONError`, this code wraps it in one,
but during a gradual repair, this code handles `utils.JSONError` and `jsonmessage.JSONError` differently.
The two types are not interchangeable.
(A [[https://golang.org/ref/spec#Type_switches][type switch]] would expose the same problem.)
(A [[/ref/spec#Type_switches][type switch]] would expose the same problem.)
If this line were the only problem, then you could imagine
adding a type assertion for `*utils.JSONError`,
then doing a gradual code repair to remove other uses of `utils.JSONError`,
and finally removing the additional type guard just before removing the old type.
But this line is not the only problem.
The type is also used elsewhere in the API and has all the
The type is also used elsewhere in the API and has all the
problems of the Kubernetes example.
In practice, again the only option here is an atomic code repair
@ -518,7 +518,7 @@ The patterns for establishing interchangeable old and new API are:
func OldAPI() { NewPackage.API() }
var OldAPI = NewPackage.API
type OldAPI ... ??? modify compiler or ... ???
For constants and functions, the setup for a gradual code repair is trivial.
@ -551,7 +551,7 @@ for a constant or a function or (most of the time) a variable,
there is no way to create an alternate name for a type.
For Go 1.8 we experimented with introducing first-class support
for these alternate names, called [[https://golang.org/design/16339-alias-decls][_aliases_]].
for these alternate names, called [[/design/16339-alias-decls][_aliases_]].
A new declaration syntax, the alias form, would have provided a uniform way
to create an alternate name for any kind of identifier:
@ -570,7 +570,7 @@ would have used a single mechanism:
type Error => error
During the Go 1.8 release freeze, we found two small but important unresolved technical details
in the alias support (issues [[https://golang.org/issue/17746][17746]] and [[https://golang.org/issue/17784][17784]]),
in the alias support (issues [[/issue/17746][17746]] and [[/issue/17784][17784]]),
and we decided that it was not possible to resolve them confidently
in the time remaining before the Go 1.8 release,
so we held aliases back from Go 1.8.
@ -611,7 +611,7 @@ before the standard library changes.
.html refactor/version1.html
There is no compatible set of libraries to build your program:
you want the latest version of Bar, which requires
you want the latest version of Bar, which requires
standard library 6.0.0,
but you also need Foo, which is incompatible with standard library 6.0.0.
The best a versioning system can do in this case is report the failure clearly.
@ -638,9 +638,9 @@ giving versioning systems a better chance to find a way to build your program.
** Type aliases
To enable gradual code repair during codebase refactorings,
it must be possible to create alternate names for a
it must be possible to create alternate names for a
constant, function, variable, or type.
Go already allows introducing alternate names for
Go already allows introducing alternate names for
all constants, all functions, and nearly all variables, but no types.
Put another way,
the general alias form is never necessary for constants,
@ -653,7 +653,7 @@ suggests that perhaps the Go 1.8 aliases were an overgeneralization,
and that we should instead focus on a solution limited to types.
The obvious solution is type-only aliases,
for which no new operator is required.
Following
Following
[[http://www.freepascal.org/docs-html/ref/refse19.html][Pascal]]
(or, if you prefer, [[https://doc.rust-lang.org/book/type-aliases.html][Rust]]),
a Go program could introduce a type alias using the assignment operator:
@ -661,14 +661,14 @@ a Go program could introduce a type alias using the assignment operator:
type OldAPI = NewPackage.API
The idea of limiting aliases to types was
[[https://golang.org/issue/16339#issuecomment-233644777][raised during the Go 1.8 alias discussion]],
[[/issue/16339#issuecomment-233644777][raised during the Go 1.8 alias discussion]],
but it seemed worth trying the more general approach, which we did, unsuccessfully.
In retrospect, the fact that `=` and `=>` have identical meanings for constants
while they have nearly identical but subtly different meanings for variables
suggests that the general approach is not worth its complications.
In fact, the idea of adding Pascal-style type aliases
was [[https://golang.org/issue/16339#issuecomment-233759255][considered in the early design of Go]],
was [[/issue/16339#issuecomment-233759255][considered in the early design of Go]],
but until now we didnt have a strong use case for them.
Type aliases seem like a promising approach to explore,
@ -693,7 +693,7 @@ I hope we the Go community can fix this together in Go 1.9. Maybe type aliases a
* Acknowledgements
Thanks to the many people who helped us [[https://golang.org/issue/16339][think through the design questions]]
Thanks to the many people who helped us [[/issue/16339][think through the design questions]]
that got us this far and led to the alias trial during Go 1.8 development.
I look forward to the Go community helping us again when we revisit this problem for Go 1.9.
If youd like to contribute, please see [[https://golang.org/issue/18130][issue 18130]].
If youd like to contribute, please see [[/issue/18130][issue 18130]].

Просмотреть файл

@ -18,7 +18,7 @@ Go 1.6 Candidate Release 1 was released on January 28th
* Notes
The slides are available on [[https://go.dev/talks/2016/state-of-go.slide]]
The slides are available on [[/talks/2016/state-of-go.slide]]
Most of the code examples won't run except locally and using Go 1.6.
@ -273,7 +273,7 @@ Use `sort.Stable`:
* Minor changes
.image state-of-go/img/minorchanges.png _ 900
.caption too many to discuss: find them [[https://golang.org/doc/go1.6#minor_library_changes][here]]
.caption too many to discuss: find them [[/doc/go1.6#minor_library_changes][here]]
* Let's just discuss one

Просмотреть файл

@ -6,19 +6,17 @@ Sydney Go Meetup
Rob Pike
Google
@rob_pike
[[http://golang.org/s/plusrob][+RobPikeTheHuman]]
http://golang.org/
https://go.dev/
* Background
Spoke at Gophercon this year: [[https://go.dev/talks/2016/asm.slide]]
Spoke at Gophercon this year: [[/talks/2016/asm.slide]]
That talk was about system design and portability.
Today's talk is about its lexer.
Spoke about lexing before: [[https://go.dev/talks/2011/lex.slide]]
Spoke about lexing before: [[/talks/2011/lex.slide]]
That talk showed a way to use concurrency to build a lexer.
@ -58,7 +56,7 @@ The parser then reads these tokens to parse the input into a _parse_tree_.
There is a nice, efficient lexer package in the Go standard library:
- [[https://golang.org/pkg/text/scanner/][`text/scanner`]]
- [[/pkg/text/scanner/][`text/scanner`]]
It can do this job just fine.
@ -66,10 +64,10 @@ But.... that is not enough for the assembler because of
* Backwards compatibility
The new Go assembler had to be totally compatible with the ones it replaces, which used YACC and were written in C. (See [[https://go.dev/talks/2015/gogo.slide][]].)
The new Go assembler had to be totally compatible with the ones it replaces, which used YACC and were written in C. (See [[/talks/2015/gogo.slide][]].)
Each assembler (one per architecture) contained these lines at the end of `lex.c`:
#include "../cc/lexbody"
#include "../cc/macbody"
@ -78,15 +76,15 @@ The differences between C tokens and Go tokens are minor and can be handled, but
The C lexer brings in something problematic.
* The C preprocessor
The old assemblers had a C preprocessor built in!
An old-fashioned one, without `#if` and token pasting, but still:
#include "file"
#define MAXBUF 512
#define MULDIV(a, b, c) ((a)*(b)/(c))
#include "file"
#define MAXBUF 512
#define MULDIV(a, b, c) ((a)*(b)/(c))
#ifdef MAXBUF
#endif

Просмотреть файл

@ -26,7 +26,7 @@ Go 1.9 will be released early August.
* Notes
The slides are available on [[https://go.dev/talks/2017/state-of-go-may.slide]]
The slides are available on [[/talks/2017/state-of-go-may.slide]]
Most of the code examples won't run except locally and using tip.
@ -46,7 +46,7 @@ Changes since Go 1.8:
* Codebase Refactoring (with help from Go)
Article written by Russ Cox [[https://go.dev/talks/2016/refactor.article][link]]
Article written by Russ Cox [[/talks/2016/refactor.article][link]]
.image state-of-go-may/img/atomic.svg _ 300
@ -125,7 +125,7 @@ Both types are equivalent and completely interchangeable.
* Quaternions
.image state-of-go-may/img/quaternions.png _ 750
.caption [[https://golang.org/issue/19813][issue #19813]]
.caption [[/issue/19813][issue #19813]]
* The Standard library
@ -138,7 +138,7 @@ Both types are equivalent and completely interchangeable.
[[https://tip.golang.org/pkg/math/bits/#Len16][Package bits]] implements bit counting and manipulation functions for the predeclared unsigned integer types.
Added to the standard library with proposal [[https://golang.org/issue/18616][#18616]].
Added to the standard library with proposal [[/issue/18616][#18616]].
- LenXX, OnesCountXX
- ReverseXX, ReverseBytesXX
@ -149,7 +149,7 @@ Added to the standard library with proposal [[https://golang.org/issue/18616][#1
* sync.Map
A new type has been added to the `sync` package with proposal [[https://golang.org/issue/18177][#18177]].
A new type has been added to the `sync` package with proposal [[/issue/18177][#18177]].
[[https://tip.golang.org/pkg/sync/#Map][sync.Map]] is a concurrent map with amortized-constant-time loads, stores,and deletes.
@ -252,17 +252,17 @@ The compiler has been refactored into multiple packages.
cmd/go/internal/...
Issue [[https://golang.org/issue/17639][#17639]] made parsing concurrent.
Issue [[/issue/17639][#17639]] made parsing concurrent.
The compiler is faster as a result.
* go test
`vendor` directories are ignored by the `go` tool [[https://golang.org/issue/19090][#19090]]:
`vendor` directories are ignored by the `go` tool [[/issue/19090][#19090]]:
go test ./...
You can now list all the tests to be executed, without running them [[https://golang.org/issue/17209][#17209]].
You can now list all the tests to be executed, without running them [[/issue/17209][#17209]].
$ go test -test.list .
TestIntegration
@ -271,7 +271,7 @@ You can now list all the tests to be executed, without running them [[https://go
* godoc
You can now link to fields in a struct in the documentation [[https://golang.org/issue/16753][#16753]].
You can now link to fields in a struct in the documentation [[/issue/16753][#16753]].
.link https://tip.golang.org/pkg/net/http/#Client.Transport

Просмотреть файл

@ -18,7 +18,7 @@ Go 1.8 was released on February 16th.
* Notes
The slides are available on [[https://go.dev/talks/2017/state-of-go.slide]]
The slides are available on [[/talks/2017/state-of-go.slide]]
Most of the code examples won't run except locally and using Go 1.8.

Просмотреть файл

@ -78,6 +78,20 @@ func (h *handler) renderDoc(w http.ResponseWriter, r *http.Request, docFile stri
return err
}
for _, a := range doc.Authors {
for _, elem := range a.Elem {
if link, ok := elem.(present.Link); ok {
if link.URL.Host == "go.dev" {
if link.URL.Path == "" {
link.URL.Path = "/"
}
link.URL.Host = ""
link.URL.Scheme = ""
}
}
}
}
ext := strings.TrimPrefix(path.Ext(r.URL.Path), ".")
h.site.ServePage(w, r, web.Page{
"layout": "/talks/" + ext,