FAQ
Old thread, but this might be of interest for some
late-to-the-party-Googlers: be advised of the os.IsNotExist function.

http://godoc.org/os#IsNotExist

Greetings,

Hraban

Τη Τρίτη, 18 Οκτωβρίου 2011 8:27:56 μ.μ. UTC+3, ο χρήστης chris dollin
έγραψε:
On 18 October 2011 18:21, Nathan Trimble wrote:
Oh interesting. Excuse the ignorance please, but could someone explain the
line below to me?

e, ok := err.(*os.PathError);

err is an os.Error type correct? So what is "err.(*os.PathError)" doing?
It's a type assertion. If err is of actual type *os.PathError, assign the
value to (a probably freshly declared) e (which will/should have type
*os.PathError) and true to ok; otherwise assign false to ok and
a zero value to e.

Note that os.Error is an interface type.

Chris

--
Chris "allusive" Dollin
--

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 14, '13 at 1:15a
activeJan 14, '13 at 1:15a
posts1
users1
websitegolang.org

1 user in discussion

Hraban Luyat: 1 post

People

Translate

site design / logo © 2022 Grokbase