Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
dd442a55
Commit
dd442a55
authored
Jan 25, 2012
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/go1: mime, filepath.Walk
R=golang-dev, gri, bradfitz, adg CC=golang-dev
https://golang.org/cl/5571060
parent
8eaf38cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
2 deletions
+98
-2
go1.html
doc/go1.html
+49
-1
go1.tmpl
doc/go1.tmpl
+49
-1
No files found.
doc/go1.html
View file @
dd442a55
...
...
@@ -1124,6 +1124,21 @@ and
Gofix will update almost all code affected by the change.
</p>
<h3
id=
"mime"
>
The mime package
</h3>
<p>
In Go 1, the
<a
href=
"/pkg/mime/#FormatMediaType"
><code>
FormatMediaType
</code></a>
function
of the
<code>
mime
</code>
package has been simplified to make it
consistent with
<a
href=
"/pkg/mime/#ParseMediaType"
><code>
ParseMediaType
</code></a>
.
It now takes
<code>
"text/html"
</code>
rather than
<code>
"text"
</code>
and
<code>
"html"
</code>
.
</p>
<p>
<em>
Updating
</em>
:
What little code is affected will be caught by the compiler and must be updated by hand.
</p>
<h3
id=
"net"
>
The net package
</h3>
<p>
...
...
@@ -1140,7 +1155,7 @@ reads and writes will time out and no longer block.
</p>
<p>
There is also a new
<a
href=
"/pkg/net/#DialTimeout"
>
net.DialTimeout
</code></a>
method to simplify
There is also a new
<a
href=
"/pkg/net/#DialTimeout"
>
<code>
net.DialTimeout
</code></a>
method to simplify
timing out dialing a network address.
</p>
...
...
@@ -1224,6 +1239,39 @@ and <code>os.FileMode</code> API.
Code that needs system-specific file details will need to be updated by hand.
</p>
<h3
id=
"path_filepath"
>
The path/filepath package
</h3>
<p>
In Go 1, the
<a
href=
"/pkg/path/filepath/#Walk"
><code>
Walk
</code></a>
function of the
<code>
path/filepath
</code>
package
has been changed to take a function value of type
<a
href=
"/pkg/path/filepath/#WalkFunc"
><code>
WalkFunc
</code></a>
instead of a
<code>
Visitor
</code>
interface value.
<code>
WalkFunc
</code>
unifies the handling of both files and directories.
</p>
<pre>
type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
</pre>
<p>
The
<code>
WalkFunc
</code>
function will be called even for files or directories that could not be opened;
in such cases the error argument will describe the failure.
If a directory's contents are to be skipped,
the function should return the value
<code>
SkipDir
</code>
.
</p>
<p>
<font
color=
"red"
>
TODO: add an example?
</font>
</p>
<p>
<em>
Updating
</em>
:
The change simplifies most code but has subtle consequences, so affected programs
will need to be updated by hand.
The compiler will catch code using the old interface.
</p>
<h3
id=
"runtime"
>
The runtime package
</h3>
<p>
...
...
doc/go1.tmpl
View file @
dd442a55
...
...
@@ -1027,6 +1027,21 @@ and
Gofix
will
update
almost
all
code
affected
by
the
change
.
</
p
>
<
h3
id
=
"mime"
>
The
mime
package
</
h3
>
<
p
>
In
Go
1
,
the
<
a
href
=
"/pkg/mime/#FormatMediaType"
><
code
>
FormatMediaType
</
code
></
a
>
function
of
the
<
code
>
mime
</
code
>
package
has
been
simplified
to
make
it
consistent
with
<
a
href
=
"/pkg/mime/#ParseMediaType"
><
code
>
ParseMediaType
</
code
></
a
>.
It
now
takes
<
code
>
"text/html"
</
code
>
rather
than
<
code
>
"text"
</
code
>
and
<
code
>
"html"
</
code
>.
</
p
>
<
p
>
<
em
>
Updating
</
em
>:
What
little
code
is
affected
will
be
caught
by
the
compiler
and
must
be
updated
by
hand
.
</
p
>
<
h3
id
=
"net"
>
The
net
package
</
h3
>
<
p
>
...
...
@@ -1043,7 +1058,7 @@ reads and writes will time out and no longer block.
</
p
>
<
p
>
There
is
also
a
new
<
a
href
=
"/pkg/net/#DialTimeout"
>
net
.
DialTimeout
</
code
></
a
>
method
to
simplify
There
is
also
a
new
<
a
href
=
"/pkg/net/#DialTimeout"
>
<
code
>
net
.
DialTimeout
</
code
></
a
>
method
to
simplify
timing
out
dialing
a
network
address
.
</
p
>
...
...
@@ -1127,6 +1142,39 @@ and <code>os.FileMode</code> API.
Code that needs system-specific file details will need to be updated by hand.
</p>
<h3 id="path_filepath">The path/filepath package</h3>
<p>
In Go 1, the <a href="/pkg/path/filepath/#Walk"><code>Walk</code></a> function of the
<code>path/filepath</code> package
has been changed to take a function value of type
<a href="/pkg/path/filepath/#WalkFunc"><code>WalkFunc</code></a>
instead of a <code>Visitor</code> interface value.
<code>WalkFunc</code> unifies the handling of both files and directories.
</p>
<pre>
type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
</pre>
<p>
The <code>WalkFunc</code> function will be called even for files or directories that could not be opened;
in such cases the error argument will describe the failure.
If a directory'
s
contents
are
to
be
skipped
,
the
function
should
return
the
value
<
code
>
SkipDir
</
code
>.
</
p
>
<
p
>
<
font
color
=
"red"
>
TODO
:
add
an
example
?</
font
>
</
p
>
<
p
>
<
em
>
Updating
</
em
>:
The
change
simplifies
most
code
but
has
subtle
consequences
,
so
affected
programs
will
need
to
be
updated
by
hand
.
The
compiler
will
catch
code
using
the
old
interface
.
</
p
>
<
h3
id
=
"runtime"
>
The
runtime
package
</
h3
>
<
p
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment