1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:24:39 -07:00

docs: replace references to gofix etc. with tool invocations

R=rsc
CC=golang-dev
https://golang.org/cl/5630045
This commit is contained in:
Rob Pike 2012-02-04 07:49:51 +11:00
parent 3fe3ae7476
commit 2783691522
6 changed files with 70 additions and 61 deletions

View File

@ -66,7 +66,10 @@ prescriptive style guide.
With Go we take an unusual With Go we take an unusual
approach and let the machine approach and let the machine
take care of most formatting issues. take care of most formatting issues.
The <code>gofmt</code> tool reads a Go program The <code>gofmt</code> program
(also available as <code>go tool fmt</code>, which
operates at the package level rather than source file level)
reads a Go program
and emits the source in a standard style of indentation and emits the source in a standard style of indentation
and vertical alignment, retaining and if necessary and vertical alignment, retaining and if necessary
reformatting comments. reformatting comments.

View File

@ -62,7 +62,10 @@ prescriptive style guide.
With Go we take an unusual With Go we take an unusual
approach and let the machine approach and let the machine
take care of most formatting issues. take care of most formatting issues.
The <code>gofmt</code> tool reads a Go program The <code>gofmt</code> program
(also available as <code>go tool fmt</code>, which
operates at the package level rather than source file level)
reads a Go program
and emits the source in a standard style of indentation and emits the source in a standard style of indentation
and vertical alignment, retaining and if necessary and vertical alignment, retaining and if necessary
reformatting comments. reformatting comments.

View File

@ -242,10 +242,11 @@ There is no return value. Deleting a non-existent entry is a no-op.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will convert expressions of the form <code>m[k] = ignored, Running <code>go fix</code> will convert expressions of the form <code>m[k] = ignored,
false</code> into <code>delete(m, k)</code> when it is clear that false</code> into <code>delete(m, k)</code> when it is clear that
the ignored value can be safely discarded from the program and the ignored value can be safely discarded from the program and
<code>false</code> refers to the predefined boolean constant. Gofix <code>false</code> refers to the predefined boolean constant.
The fix tool
will flag other uses of the syntax for inspection by the programmer. will flag other uses of the syntax for inspection by the programmer.
</p> </p>
@ -534,7 +535,7 @@ and <code>template</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update all imports and package renames for packages that Running <code>go fix</code> will update all imports and package renames for packages that
remain inside the standard repository. Programs that import packages remain inside the standard repository. Programs that import packages
that are no longer in the standard repository will need to be edited that are no longer in the standard repository will need to be edited
by hand. by hand.
@ -571,14 +572,15 @@ Also, the <code>utf8.String</code> type has been moved to its own package, <code
<p> <p>
Finally, the <code>gotype</code> command now resides in <code>exp/gotype</code>, while Finally, the <code>gotype</code> command now resides in <code>exp/gotype</code>, while
<code>ebnflint</code> is now in <code>exp/ebnflint</code> <code>ebnflint</code> is now in <code>exp/ebnflint</code>.
If they are installed, they now reside in <code>$GOROOT/bin/tool</code>.
</p> </p>
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses packages in <code>exp</code> will need to be updated by hand, Code that uses packages in <code>exp</code> will need to be updated by hand,
or else compiled from an installation that has <code>exp</code> available. or else compiled from an installation that has <code>exp</code> available.
Gofix or the compiler will complain about such uses. The go fix tool or the compiler will complain about such uses.
<br> <br>
<font color="red">TODO: go fix should warn about such uses.</font> <font color="red">TODO: go fix should warn about such uses.</font>
</p> </p>
@ -605,7 +607,7 @@ The packages in their new locations are:
<em>Updating</em>: <em>Updating</em>:
Code that uses packages now in <code>old</code> will need to be updated by hand, Code that uses packages now in <code>old</code> will need to be updated by hand,
or else compiled from an installation that has <code>old</code> available. or else compiled from an installation that has <code>old</code> available.
Gofix will warn about such uses. The go fix tool will warn about such uses.
<br> <br>
<font color="red">TODO: go fix should warn about such uses.</font> <font color="red">TODO: go fix should warn about such uses.</font>
</p> </p>
@ -690,7 +692,7 @@ This table lists the old and new import paths:
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update imports of these packages to use the new import paths. Running <code>go fix</code> will update imports of these packages to use the new import paths.
Installations that depend on these packages will need to install them using Installations that depend on these packages will need to install them using
a <code>go install</code> command. a <code>go install</code> command.
</p> </p>
@ -755,7 +757,7 @@ to turn a string into an error. It replaces the old <code>os.NewError</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
Code that defines error types with a <code>String</code> method will need to be updated Code that defines error types with a <code>String</code> method will need to be updated
by hand to rename the methods to <code>Error</code>. by hand to rename the methods to <code>Error</code>.
</p> </p>
@ -774,7 +776,7 @@ that satisfies <code>error</code> and replaces the old <code>os.Errno</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
Regardless, most code should use the <code>os</code> package Regardless, most code should use the <code>os</code> package
rather than <code>syscall</code> and so will be unaffected. rather than <code>syscall</code> and so will be unaffected.
</p> </p>
@ -842,11 +844,11 @@ its representation of file time stamps.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update many uses of the old <code>time</code> package to use the new The <code>go fix</code> tool will update many uses of the old <code>time</code> package to use the new
types and methods, although it does not replace values such as <code>1e9</code> types and methods, although it does not replace values such as <code>1e9</code>
representing nanoseconds per second. representing nanoseconds per second.
Also, because of type changes in some of the values that arise, Also, because of type changes in some of the values that arise,
some of the expressions rewritten by gofix may require some of the expressions rewritten by the fix tool may require
further hand editing; in such cases the rewrite will include further hand editing; in such cases the rewrite will include
the correct function or method for the old functionality, but the correct function or method for the old functionality, but
may have the wrong type or require further analysis. may have the wrong type or require further analysis.
@ -857,7 +859,7 @@ may have the wrong type or require further analysis.
<p> <p>
This section describes smaller changes, such as those to less commonly This section describes smaller changes, such as those to less commonly
used packages or that affect used packages or that affect
few programs beyond the need to run gofix. few programs beyond the need to run <code>go fix</code>.
This category includes packages that are new in Go 1. This category includes packages that are new in Go 1.
</p> </p>
@ -880,7 +882,7 @@ in <code>crypto/elliptic</code> that take an <code>elliptic.Curve</code>
as their first argument. as their first argument.
</p> </p>
<h3 id="crypto/hmac">The crypto/hmac package</h3> <h3 id="crypto_hmac">The crypto/hmac package</h3>
<p> <p>
In Go 1, the hash-specific functions, such as <code>hmac.NewMD5</code>, have In Go 1, the hash-specific functions, such as <code>hmac.NewMD5</code>, have
@ -890,7 +892,7 @@ a function that returns a <code>hash.Hash</code>, such as <code>md5.New</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will perform the needed changes. Running <code>go fix</code> will perform the needed changes.
</p> </p>
<h3 id="crypto_x509">The crypto/x509 package</h3> <h3 id="crypto_x509">The crypto/x509 package</h3>
@ -1020,7 +1022,7 @@ The previous behavior can be recreated by adding a <code>nil</code> argument to
Existing implementations of <code>hash.Hash</code> will need to add a Existing implementations of <code>hash.Hash</code> will need to add a
<code>BlockSize</code> method. Hashes that process the input one byte at <code>BlockSize</code> method. Hashes that process the input one byte at
a time can implement <code>BlockSize</code> to return 1. a time can implement <code>BlockSize</code> to return 1.
Gofix will update calls to the <code>Sum</code> methods of the various Running <code>go fix</code> will update calls to the <code>Sum</code> methods of the various
implementations of <code>hash.Hash</code>. implementations of <code>hash.Hash</code>.
</p> </p>
@ -1062,7 +1064,7 @@ historical artifact.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update the few programs that are affected except for Running <code>go fix</code> will update the few programs that are affected except for
uses of <code>RawURL</code>, which must be fixed by hand. uses of <code>RawURL</code>, which must be fixed by hand.
</p> </p>
@ -1181,7 +1183,7 @@ and
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
</p> </p>
<h3 id="mime">The mime package</h3> <h3 id="mime">The mime package</h3>
@ -1227,7 +1229,7 @@ The <code>net.ListenMulticastUDP</code> function replaces the old
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses the old methods will fail to compile and must be updated by hand. Code that uses the old methods will fail to compile and must be updated by hand.
The semantic change makes it difficult for gofix to update automatically. The semantic change makes it difficult for the fix tool to update automatically.
</p> </p>
<h3 id="os_fileinfo">The os.FileInfo type</h3> <h3 id="os_fileinfo">The os.FileInfo type</h3>
@ -1299,7 +1301,7 @@ of the standard interface.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update code that uses the old equivalent of the current <code>os.FileInfo</code> Running <code>go fix</code> will update code that uses the old equivalent of the current <code>os.FileInfo</code>
and <code>os.FileMode</code> API. and <code>os.FileMode</code> API.
Code that needs system-specific file details will need to be updated by hand. Code that needs system-specific file details will need to be updated by hand.
</p> </p>
@ -1438,11 +1440,11 @@ for full details.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
<br> <br>
§ <code>Atoi</code> persists but <code>Atoui</code> and <code>Atof32</code> do not, so § <code>Atoi</code> persists but <code>Atoui</code> and <code>Atof32</code> do not, so
they may require they may require
a cast that must be added by hand; gofix will warn about it. a cast that must be added by hand; the go fix tool will warn about it.
</p> </p>
@ -1540,7 +1542,7 @@ added to <code>URL</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses the old fields will fail to compile and must be updated by hand. Code that uses the old fields will fail to compile and must be updated by hand.
The semantic changes make it difficult for gofix to update automatically. The semantic changes make it difficult for the fix tool to update automatically.
</p> </p>
<h3 id="xml">The xml package</h3> <h3 id="xml">The xml package</h3>
@ -1579,9 +1581,9 @@ of the XML element being marshaled.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update most uses of the package except for some calls to Running <code>go fix</code> will update most uses of the package except for some calls to
<code>Unmarshal</code>. Special care must be taken with field tags, <code>Unmarshal</code>. Special care must be taken with field tags,
since gofix will not update them and if not fixed by hand they will since the fix tool will not update them and if not fixed by hand they will
misbehave silently in some cases. For example, the old misbehave silently in some cases. For example, the old
<code>"attr"</code> is now written <code>",attr"</code> while plain <code>"attr"</code> is now written <code>",attr"</code> while plain
<code>"attr"</code> remains valid but with a different meaning. <code>"attr"</code> remains valid but with a different meaning.

View File

@ -192,10 +192,11 @@ There is no return value. Deleting a non-existent entry is a no-op.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will convert expressions of the form <code>m[k] = ignored, Running <code>go fix</code> will convert expressions of the form <code>m[k] = ignored,
false</code> into <code>delete(m, k)</code> when it is clear that false</code> into <code>delete(m, k)</code> when it is clear that
the ignored value can be safely discarded from the program and the ignored value can be safely discarded from the program and
<code>false</code> refers to the predefined boolean constant. Gofix <code>false</code> refers to the predefined boolean constant.
The fix tool
will flag other uses of the syntax for inspection by the programmer. will flag other uses of the syntax for inspection by the programmer.
</p> </p>
@ -458,7 +459,7 @@ and <code>template</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update all imports and package renames for packages that Running <code>go fix</code> will update all imports and package renames for packages that
remain inside the standard repository. Programs that import packages remain inside the standard repository. Programs that import packages
that are no longer in the standard repository will need to be edited that are no longer in the standard repository will need to be edited
by hand. by hand.
@ -495,14 +496,15 @@ Also, the <code>utf8.String</code> type has been moved to its own package, <code
<p> <p>
Finally, the <code>gotype</code> command now resides in <code>exp/gotype</code>, while Finally, the <code>gotype</code> command now resides in <code>exp/gotype</code>, while
<code>ebnflint</code> is now in <code>exp/ebnflint</code> <code>ebnflint</code> is now in <code>exp/ebnflint</code>.
If they are installed, they now reside in <code>$GOROOT/bin/tool</code>.
</p> </p>
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses packages in <code>exp</code> will need to be updated by hand, Code that uses packages in <code>exp</code> will need to be updated by hand,
or else compiled from an installation that has <code>exp</code> available. or else compiled from an installation that has <code>exp</code> available.
Gofix or the compiler will complain about such uses. The go fix tool or the compiler will complain about such uses.
<br> <br>
<font color="red">TODO: go fix should warn about such uses.</font> <font color="red">TODO: go fix should warn about such uses.</font>
</p> </p>
@ -529,7 +531,7 @@ The packages in their new locations are:
<em>Updating</em>: <em>Updating</em>:
Code that uses packages now in <code>old</code> will need to be updated by hand, Code that uses packages now in <code>old</code> will need to be updated by hand,
or else compiled from an installation that has <code>old</code> available. or else compiled from an installation that has <code>old</code> available.
Gofix will warn about such uses. The go fix tool will warn about such uses.
<br> <br>
<font color="red">TODO: go fix should warn about such uses.</font> <font color="red">TODO: go fix should warn about such uses.</font>
</p> </p>
@ -614,7 +616,7 @@ This table lists the old and new import paths:
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update imports of these packages to use the new import paths. Running <code>go fix</code> will update imports of these packages to use the new import paths.
Installations that depend on these packages will need to install them using Installations that depend on these packages will need to install them using
a <code>go install</code> command. a <code>go install</code> command.
</p> </p>
@ -669,7 +671,7 @@ to turn a string into an error. It replaces the old <code>os.NewError</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
Code that defines error types with a <code>String</code> method will need to be updated Code that defines error types with a <code>String</code> method will need to be updated
by hand to rename the methods to <code>Error</code>. by hand to rename the methods to <code>Error</code>.
</p> </p>
@ -688,7 +690,7 @@ that satisfies <code>error</code> and replaces the old <code>os.Errno</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
Regardless, most code should use the <code>os</code> package Regardless, most code should use the <code>os</code> package
rather than <code>syscall</code> and so will be unaffected. rather than <code>syscall</code> and so will be unaffected.
</p> </p>
@ -746,11 +748,11 @@ its representation of file time stamps.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update many uses of the old <code>time</code> package to use the new The <code>go fix</code> tool will update many uses of the old <code>time</code> package to use the new
types and methods, although it does not replace values such as <code>1e9</code> types and methods, although it does not replace values such as <code>1e9</code>
representing nanoseconds per second. representing nanoseconds per second.
Also, because of type changes in some of the values that arise, Also, because of type changes in some of the values that arise,
some of the expressions rewritten by gofix may require some of the expressions rewritten by the fix tool may require
further hand editing; in such cases the rewrite will include further hand editing; in such cases the rewrite will include
the correct function or method for the old functionality, but the correct function or method for the old functionality, but
may have the wrong type or require further analysis. may have the wrong type or require further analysis.
@ -761,7 +763,7 @@ may have the wrong type or require further analysis.
<p> <p>
This section describes smaller changes, such as those to less commonly This section describes smaller changes, such as those to less commonly
used packages or that affect used packages or that affect
few programs beyond the need to run gofix. few programs beyond the need to run <code>go fix</code>.
This category includes packages that are new in Go 1. This category includes packages that are new in Go 1.
</p> </p>
@ -784,7 +786,7 @@ in <code>crypto/elliptic</code> that take an <code>elliptic.Curve</code>
as their first argument. as their first argument.
</p> </p>
<h3 id="crypto/hmac">The crypto/hmac package</h3> <h3 id="crypto_hmac">The crypto/hmac package</h3>
<p> <p>
In Go 1, the hash-specific functions, such as <code>hmac.NewMD5</code>, have In Go 1, the hash-specific functions, such as <code>hmac.NewMD5</code>, have
@ -794,7 +796,7 @@ a function that returns a <code>hash.Hash</code>, such as <code>md5.New</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will perform the needed changes. Running <code>go fix</code> will perform the needed changes.
</p> </p>
<h3 id="crypto_x509">The crypto/x509 package</h3> <h3 id="crypto_x509">The crypto/x509 package</h3>
@ -923,7 +925,7 @@ The previous behavior can be recreated by adding a <code>nil</code> argument to
Existing implementations of <code>hash.Hash</code> will need to add a Existing implementations of <code>hash.Hash</code> will need to add a
<code>BlockSize</code> method. Hashes that process the input one byte at <code>BlockSize</code> method. Hashes that process the input one byte at
a time can implement <code>BlockSize</code> to return 1. a time can implement <code>BlockSize</code> to return 1.
Gofix will update calls to the <code>Sum</code> methods of the various Running <code>go fix</code> will update calls to the <code>Sum</code> methods of the various
implementations of <code>hash.Hash</code>. implementations of <code>hash.Hash</code>.
</p> </p>
@ -965,7 +967,7 @@ historical artifact.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update the few programs that are affected except for Running <code>go fix</code> will update the few programs that are affected except for
uses of <code>RawURL</code>, which must be fixed by hand. uses of <code>RawURL</code>, which must be fixed by hand.
</p> </p>
@ -1084,7 +1086,7 @@ and
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
</p> </p>
<h3 id="mime">The mime package</h3> <h3 id="mime">The mime package</h3>
@ -1130,7 +1132,7 @@ The <code>net.ListenMulticastUDP</code> function replaces the old
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses the old methods will fail to compile and must be updated by hand. Code that uses the old methods will fail to compile and must be updated by hand.
The semantic change makes it difficult for gofix to update automatically. The semantic change makes it difficult for the fix tool to update automatically.
</p> </p>
<h3 id="os_fileinfo">The os.FileInfo type</h3> <h3 id="os_fileinfo">The os.FileInfo type</h3>
@ -1202,7 +1204,7 @@ of the standard interface.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update code that uses the old equivalent of the current <code>os.FileInfo</code> Running <code>go fix</code> will update code that uses the old equivalent of the current <code>os.FileInfo</code>
and <code>os.FileMode</code> API. and <code>os.FileMode</code> API.
Code that needs system-specific file details will need to be updated by hand. Code that needs system-specific file details will need to be updated by hand.
</p> </p>
@ -1341,11 +1343,11 @@ for full details.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update almost all code affected by the change. Running <code>go fix</code> will update almost all code affected by the change.
<br> <br>
§ <code>Atoi</code> persists but <code>Atoui</code> and <code>Atof32</code> do not, so § <code>Atoi</code> persists but <code>Atoui</code> and <code>Atof32</code> do not, so
they may require they may require
a cast that must be added by hand; gofix will warn about it. a cast that must be added by hand; the go fix tool will warn about it.
</p> </p>
@ -1430,7 +1432,7 @@ added to <code>URL</code>.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Code that uses the old fields will fail to compile and must be updated by hand. Code that uses the old fields will fail to compile and must be updated by hand.
The semantic changes make it difficult for gofix to update automatically. The semantic changes make it difficult for the fix tool to update automatically.
</p> </p>
<h3 id="xml">The xml package</h3> <h3 id="xml">The xml package</h3>
@ -1469,9 +1471,9 @@ of the XML element being marshaled.
<p> <p>
<em>Updating</em>: <em>Updating</em>:
Gofix will update most uses of the package except for some calls to Running <code>go fix</code> will update most uses of the package except for some calls to
<code>Unmarshal</code>. Special care must be taken with field tags, <code>Unmarshal</code>. Special care must be taken with field tags,
since gofix will not update them and if not fixed by hand they will since the fix tool will not update them and if not fixed by hand they will
misbehave silently in some cases. For example, the old misbehave silently in some cases. For example, the old
<code>"attr"</code> is now written <code>",attr"</code> while plain <code>"attr"</code> is now written <code>",attr"</code> while plain
<code>"attr"</code> remains valid but with a different meaning. <code>"attr"</code> remains valid but with a different meaning.

View File

@ -350,7 +350,7 @@ to override the defaults.
The root of the Go tree, often <code>$HOME/go</code>. The root of the Go tree, often <code>$HOME/go</code>.
This defaults to the parent of the directory where <code>all.bash</code> is run. This defaults to the parent of the directory where <code>all.bash</code> is run.
If you choose not to set <code>$GOROOT</code>, you must If you choose not to set <code>$GOROOT</code>, you must
run <code>gomake</code> instead of <code>make</code> or <code>gmake</code> run <code>go tool make</code> instead of <code>make</code> or <code>gmake</code>
when developing Go programs using the conventional makefiles. when developing Go programs using the conventional makefiles.
</dd> </dd>

View File

@ -14,8 +14,7 @@ Plan 9 C compiler.
This implementation adds the flag -S, which prints each symbol's size This implementation adds the flag -S, which prints each symbol's size
in decimal after its address. in decimal after its address.
For reasons of disambiguation it is installed as 6nm although it also serves It is installed as go tool nm and is architecture-independent.
as an 8nm and a 5nm.
*/ */
package documentation package documentation