diff --git a/doc/effective_go.html b/doc/effective_go.html index bec95e5fb6..f0d0ffa53b 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -2719,6 +2719,18 @@ for try := 0; try < 2; try++ { } +

+The second if statement here is idiomatic Go. +The type assertion err.(*os.PathError) is +checked with the "comma ok" idiom (mentioned earlier +in the context of examining maps). +If the type assertion fails, ok will be false, and e +will be nil. +If it succeeds, ok will be true, which means the +error was of type *os.PathError, and then so is e, +which we can examine for more information about the error. +

+

Panic

diff --git a/doc/effective_go.tmpl b/doc/effective_go.tmpl index 69a16239a1..b9ba469d41 100644 --- a/doc/effective_go.tmpl +++ b/doc/effective_go.tmpl @@ -2657,6 +2657,18 @@ for try := 0; try < 2; try++ { } +

+The second if statement here is idiomatic Go. +The type assertion err.(*os.PathError) is +checked with the "comma ok" idiom (mentioned earlier +in the context of examining maps). +If the type assertion fails, ok will be false, and e +will be nil. +If it succeeds, ok will be true, which means the +error was of type *os.PathError, and then so is e, +which we can examine for more information about the error. +

+

Panic