mirror of
https://github.com/golang/go
synced 2024-11-23 09:10:08 -07:00
doc: show relevant test instructions on install page
Fixes golang/go#12490 Change-Id: I0861e62aaa589fc63217c83e9c227c17e35cda75 Reviewed-on: https://go-review.googlesource.com/18277 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
2586af47f6
commit
e9fc522100
@ -220,19 +220,29 @@ and building a simple program, as follows.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Create a directory to contain your <a href="code.html#Workspaces">workspace</a>,
|
Create a directory to contain your <a href="code.html#Workspaces">workspace</a>,
|
||||||
<code>$HOME/work</code> for example, and set the <code>GOPATH</code> environment
|
<code class="testUnix">$HOME/work</code>
|
||||||
|
<code class="testWindows" style="display: none">%HOME%\work</code>
|
||||||
|
for example, and set the <code>GOPATH</code> environment
|
||||||
variable to point to that location.
|
variable to point to that location.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre class="testUnix">
|
||||||
$ <b>export GOPATH=$HOME/work</b>
|
$ <b>export GOPATH=$HOME/work</b>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<pre class="testWindows" style="display: none">
|
||||||
|
C:\> <b>set GOPATH=%HOME%\work</b>
|
||||||
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
<span class="testUnix">
|
||||||
You should put the above command in your shell startup script
|
You should put the above command in your shell startup script
|
||||||
(<code>$HOME/.profile</code> for example) or, if you use Windows,
|
(<code>$HOME/.profile</code> for example).
|
||||||
follow the <a href="#windows_env">instructions above</a> to set the
|
</span>
|
||||||
|
<span class="testWindows">
|
||||||
|
On Windows, follow the <a href="#windows_env">instructions above</a> to set the
|
||||||
<code>GOPATH</code> environment variable on your system.
|
<code>GOPATH</code> environment variable on your system.
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -256,21 +266,30 @@ func main() {
|
|||||||
Then compile it with the <code>go</code> tool:
|
Then compile it with the <code>go</code> tool:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre class="testUnix">
|
||||||
$ <b>go install github.com/user/hello</b>
|
$ <b>go install github.com/user/hello</b>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<pre class="testWindows" style="display: none">
|
||||||
|
C:\> <b>go install github.com/user/hello</b>
|
||||||
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The above command will put an executable command named <code>hello</code>
|
The command above will put an executable command named <code>hello</code>
|
||||||
(or <code>hello.exe</code>) inside the <code>bin</code> directory of your workspace.
|
(or <code>hello.exe</code>) inside the <code>bin</code> directory of your workspace.
|
||||||
Execute the command to see the greeting:
|
Execute the command to see the greeting:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre class="testUnix">
|
||||||
$ <b>$GOPATH/bin/hello</b>
|
$ <b>$GOPATH/bin/hello</b>
|
||||||
hello, world
|
hello, world
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<pre class="testWindows" style="display: none">
|
||||||
|
C:\> <b>%GOPATH%\bin\hello</b>
|
||||||
|
hello, world
|
||||||
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you see the "hello, world" message then your Go installation is working.
|
If you see the "hello, world" message then your Go installation is working.
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user