From cc7e11c91ebb9d30b260cf92e66e94f3217b45e6 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Mon, 27 Feb 2012 14:34:16 +1100 Subject: [PATCH] doc/go1: mention that regexp has changed Also restore alphabetical order. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5701053 --- doc/go1.html | 64 ++++++++++++++++++++++++++----------------- doc/go1.tmpl | 76 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 84 insertions(+), 56 deletions(-) diff --git a/doc/go1.html b/doc/go1.html index 3309a40730..75a309fe9e 100644 --- a/doc/go1.html +++ b/doc/go1.html @@ -1702,6 +1702,39 @@ Code that uses the old POSIX error values from the os package will fail to compile and will also need to be updated by hand.

+

The os/signal package

+ +

+The os/signal package in Go 1 replaces the +Incoming function, which returned a channel +that received all incoming signals, +with the selective Notify function, which asks +for delivery of specific signals on an existing channel. +

+ +

+Updating: +Code must be updated by hand. +A literal translation of +

+
+c := signal.Incoming()
+
+

+is +

+
+c := make(chan os.Signal)
+signal.Notify(c) // ask for all signals
+
+

+but most code should list the specific signals it wants to handle instead: +

+
+c := make(chan os.Signal)
+signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
+
+

The path/filepath package

@@ -1747,38 +1780,19 @@ will need to be updated by hand. The compiler will catch code using the old interface.

-

The os/signal package

+

The regexp package

-The os/signal package in Go 1 replaces the -Incoming function, which returned a channel -that received all incoming signals, -with the selective Notify function, which asks -for delivery of specific signals on an existing channel. +The regexp 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 +RE2.

Updating: -Code must be updated by hand. -A literal translation of +Code that uses the package should have its regular expressions checked by hand.

-
-c := signal.Incoming()
-
-

-is -

-
-c := make(chan os.Signal)
-signal.Notify(c) // ask for all signals
-
-

-but most code should list the specific signals it wants to handle instead: -

-
-c := make(chan os.Signal)
-signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
-

The runtime package

diff --git a/doc/go1.tmpl b/doc/go1.tmpl index e3c6ea999d..6551daefd2 100644 --- a/doc/go1.tmpl +++ b/doc/go1.tmpl @@ -1601,37 +1601,6 @@ Code that uses the old POSIX error values from the os package will fail to compile and will also need to be updated by hand.

-

The path/filepath package

- -

-In Go 1, the Walk function of the -path/filepath package -has been changed to take a function value of type -WalkFunc -instead of a Visitor interface value. -WalkFunc unifies the handling of both files and directories. -

- -
-    type WalkFunc func(path string, info os.FileInfo, err error) error
-
- -

-The WalkFunc 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 filepath.SkipDir -

- -{{code "progs/go1.go" `/STARTWALK/` `/ENDWALK/`}} - -

-Updating: -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. -

-

The os/signal package

@@ -1665,6 +1634,51 @@ c := make(chan os.Signal) signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT) +

The path/filepath package

+ +

+In Go 1, the Walk function of the +path/filepath package +has been changed to take a function value of type +WalkFunc +instead of a Visitor interface value. +WalkFunc unifies the handling of both files and directories. +

+ +
+    type WalkFunc func(path string, info os.FileInfo, err error) error
+
+ +

+The WalkFunc 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 filepath.SkipDir +

+ +{{code "progs/go1.go" `/STARTWALK/` `/ENDWALK/`}} + +

+Updating: +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. +

+ +

The regexp package

+ +

+The regexp 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 +RE2. +

+ +

+Updating: +Code that uses the package should have its regular expressions checked by hand. +

+

The runtime package