From 97b13acb6704d5ae2b641d7d8343424ce9156931 Mon Sep 17 00:00:00 2001
From: Shenghou Ma
Go takes a different approach. For plain error handling, Go's multi-value
returns make it easy to report an error without overloading the return value.
-A
-canonical error type, coupled
-with Go's other features, makes error
-handling pleasant but quite different from that in other languages.
+A canonical error type, coupled
+with Go's other features, makes error handling pleasant but quite different
+from that in other languages.
@@ -336,7 +335,7 @@ when used well, can result in clean error-handling code.
-See the Defer, Panic, and Recover article for details.
+See the Defer, Panic, and Recover article for details.
For more information about the append
function and slices
in general see the
- Slices: usage and internals article.
+ Slices: usage and internals article.
@@ -1317,8 +1316,7 @@ table-driven, iterating over a list of inputs and outputs defined
in a data structure (Go has excellent support for data structure literals).
The work to write a good test and good error messages will then be amortized over many
test cases. The standard Go library is full of illustrative examples, such as in
-the formatting
-tests for the
fmt
package.
+the formatting tests for the fmt
package.
gofmt
,
+gofmt
,
some style must be chosen. That style may differ from what
you've used in C or Java, but Go is a new language and
gofmt
's style is as good as any other. More