mirror of
https://github.com/golang/go
synced 2024-11-21 23:04:39 -07:00
doc/go1: mention that regexp has changed
Also restore alphabetical order. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5701053
This commit is contained in:
parent
e10dc82ce0
commit
cc7e11c91e
64
doc/go1.html
64
doc/go1.html
@ -1702,6 +1702,39 @@ Code that uses the old POSIX error values from the <code>os</code> package
|
||||
will fail to compile and will also need to be updated by hand.
|
||||
</p>
|
||||
|
||||
<h3 id="os_signal">The os/signal package</h3>
|
||||
|
||||
<p>
|
||||
The <code>os/signal</code> package in Go 1 replaces the
|
||||
<code>Incoming</code> function, which returned a channel
|
||||
that received all incoming signals,
|
||||
with the selective <code>Notify</code> function, which asks
|
||||
for delivery of specific signals on an existing channel.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>Updating</em>:
|
||||
Code must be updated by hand.
|
||||
A literal translation of
|
||||
</p>
|
||||
<pre>
|
||||
c := signal.Incoming()
|
||||
</pre>
|
||||
<p>
|
||||
is
|
||||
</p>
|
||||
<pre>
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c) // ask for all signals
|
||||
</pre>
|
||||
<p>
|
||||
but most code should list the specific signals it wants to handle instead:
|
||||
</p>
|
||||
<pre>
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
|
||||
</pre>
|
||||
|
||||
<h3 id="path_filepath">The path/filepath package</h3>
|
||||
|
||||
<p>
|
||||
@ -1747,38 +1780,19 @@ will need to be updated by hand.
|
||||
The compiler will catch code using the old interface.
|
||||
</p>
|
||||
|
||||
<h3 id="os_signal">The os/signal package</h3>
|
||||
<h3 id="regexp">The regexp package</h3>
|
||||
|
||||
<p>
|
||||
The <code>os/signal</code> package in Go 1 replaces the
|
||||
<code>Incoming</code> function, which returned a channel
|
||||
that received all incoming signals,
|
||||
with the selective <code>Notify</code> function, which asks
|
||||
for delivery of specific signals on an existing channel.
|
||||
The <a href="/pkg/regexp/"><code>regexp</code></a> package has been rewritten.
|
||||
It has the same interface but the specification of the regular expressions
|
||||
it supports has changed from the old "egrep" form to that of
|
||||
<a href="code.google.com/p/re2">RE2</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>Updating</em>:
|
||||
Code must be updated by hand.
|
||||
A literal translation of
|
||||
Code that uses the package should have its regular expressions checked by hand.
|
||||
</p>
|
||||
<pre>
|
||||
c := signal.Incoming()
|
||||
</pre>
|
||||
<p>
|
||||
is
|
||||
</p>
|
||||
<pre>
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c) // ask for all signals
|
||||
</pre>
|
||||
<p>
|
||||
but most code should list the specific signals it wants to handle instead:
|
||||
</p>
|
||||
<pre>
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
|
||||
</pre>
|
||||
|
||||
<h3 id="runtime">The runtime package</h3>
|
||||
|
||||
|
76
doc/go1.tmpl
76
doc/go1.tmpl
@ -1601,37 +1601,6 @@ Code that uses the old POSIX error values from the <code>os</code> package
|
||||
will fail to compile and will also 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 error) 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 <a href="/pkg/path/filepath/#variables"><code>filepath.SkipDir</code></a>
|
||||
</p>
|
||||
|
||||
{{code "progs/go1.go" `/STARTWALK/` `/ENDWALK/`}}
|
||||
|
||||
<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="os_signal">The os/signal package</h3>
|
||||
|
||||
<p>
|
||||
@ -1665,6 +1634,51 @@ c := make(chan os.Signal)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
|
||||
</pre>
|
||||
|
||||
<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 error) 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 <a href="/pkg/path/filepath/#variables"><code>filepath.SkipDir</code></a>
|
||||
</p>
|
||||
|
||||
{{code "progs/go1.go" `/STARTWALK/` `/ENDWALK/`}}
|
||||
|
||||
<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="regexp">The regexp package</h3>
|
||||
|
||||
<p>
|
||||
The <a href="/pkg/regexp/"><code>regexp</code></a> package has been rewritten.
|
||||
It has the same interface but the specification of the regular expressions
|
||||
it supports has changed from the old "egrep" form to that of
|
||||
<a href="code.google.com/p/re2">RE2</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>Updating</em>:
|
||||
Code that uses the package should have its regular expressions checked by hand.
|
||||
</p>
|
||||
|
||||
<h3 id="runtime">The runtime package</h3>
|
||||
|
||||
<p>
|
||||
|
Loading…
Reference in New Issue
Block a user