From 72f5a91aa3c040d48ba85fbc86f05d84400af114 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sun, 19 Feb 2012 18:04:38 -0500 Subject: [PATCH] doc/go1: update for runtime, unsafe API changes Fixes #2890. R=golang-dev, r, remyoudompheng CC=golang-dev https://golang.org/cl/5683044 --- doc/go1.html | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- doc/go1.tmpl | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 4 deletions(-) diff --git a/doc/go1.html b/doc/go1.html index f4a4623db6..04726069cd 100644 --- a/doc/go1.html +++ b/doc/go1.html @@ -1635,15 +1635,41 @@ signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)

The runtime package

-The runtime package in Go 1 includes a new niladic function, +In Go 1, much of the API exported by package +runtime has been removed in favor of +functionality provided by other packages. +Code using the runtime.Type interface +or its specific concrete type implementations should +now use package reflect. +Code using runtime.Semacquire or runtime.Semrelease +should use channels or the abstractions in package sync. +The runtime.Alloc, runtime.Free, +and runtime.Lookup functions, an unsafe API created for +debugging the memory allocator, have no replacement. +

+ +

+Before, runtime.MemStats was a global variable holding +statistics about memory allocation, and calls to runtime.UpdateMemStats +ensured that it was up to date. +In Go 1, runtime.MemStats is a struct type, and code should use +runtime.ReadMemStats +to obtain the current statistics. +

+ +

+The package adds a new function, runtime.NumCPU, that returns the number of CPUs available for parallel execution, as reported by the operating system kernel. Its value can inform the setting of GOMAXPROCS. +The runtime.Cgocalls and runtime.Goroutines functions +have been renamed to runtime.NumCgoCall and runtime.NumGoroutine.

Updating: -No existing code is affected. +Running go fix will update code for the function renamings. +Other code will need to be updated by hand.

The strconv package

@@ -1781,6 +1807,25 @@ The testing/script package has been deleted. It was a dreg. No code is likely to be affected.

+

The unsafe package

+ +

+In Go 1, the functions +unsafe.Typeof, unsafe.Reflect, +unsafe.Unreflect, unsafe.New, and +unsafe.NewArray have been removed; +they duplicated safer functionality provided by +package reflect. +

+ +

+Updating: +Code using these functions must be rewritten to use +package reflect. +The changes to encoding/gob and the protocol buffer library +may be helpful as examples. +

+

The url package

diff --git a/doc/go1.tmpl b/doc/go1.tmpl index 314a6de93d..57957beaba 100644 --- a/doc/go1.tmpl +++ b/doc/go1.tmpl @@ -1520,15 +1520,41 @@ signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)

The runtime package

-The runtime package in Go 1 includes a new niladic function, +In Go 1, much of the API exported by package +runtime has been removed in favor of +functionality provided by other packages. +Code using the runtime.Type interface +or its specific concrete type implementations should +now use package reflect. +Code using runtime.Semacquire or runtime.Semrelease +should use channels or the abstractions in package sync. +The runtime.Alloc, runtime.Free, +and runtime.Lookup functions, an unsafe API created for +debugging the memory allocator, have no replacement. +

+ +

+Before, runtime.MemStats was a global variable holding +statistics about memory allocation, and calls to runtime.UpdateMemStats +ensured that it was up to date. +In Go 1, runtime.MemStats is a struct type, and code should use +runtime.ReadMemStats +to obtain the current statistics. +

+ +

+The package adds a new function, runtime.NumCPU, that returns the number of CPUs available for parallel execution, as reported by the operating system kernel. Its value can inform the setting of GOMAXPROCS. +The runtime.Cgocalls and runtime.Goroutines functions +have been renamed to runtime.NumCgoCall and runtime.NumGoroutine.

Updating: -No existing code is affected. +Running go fix will update code for the function renamings. +Other code will need to be updated by hand.

The strconv package

@@ -1653,6 +1679,25 @@ The testing/script package has been deleted. It was a dreg. No code is likely to be affected.

+

The unsafe package

+ +

+In Go 1, the functions +unsafe.Typeof, unsafe.Reflect, +unsafe.Unreflect, unsafe.New, and +unsafe.NewArray have been removed; +they duplicated safer functionality provided by +package reflect. +

+ +

+Updating: +Code using these functions must be rewritten to use +package reflect. +The changes to encoding/gob and the protocol buffer library +may be helpful as examples. +

+

The url package

-- 2.50.0