From 702226f93321a6cc9c90c657c589c869c70872fc Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 5 Feb 2020 10:22:07 -0500 Subject: [PATCH] =?utf8?q?doc/install.html:=20streamline=20the=20=E2=80=9C?= =?utf8?q?Test=20your=20installation=E2=80=9D=20step=20and=20make=20it=20m?= =?utf8?q?odule-agnostic?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In CL 199417, we updated “How to Write Go Code” to give a basic introduction to modules and to include module-mode commands. However, most new users will end up reading “Getting Started” (doc/install.html) before “How to Write Go Code”, and we forgot to update the handful of commands there for module mode. Before this change, the “Test your installation” section also covered quite a few operations beoyond merely testing the installation: it included setting up a GOPATH, building a binary, and installing and cleaning binaries. Those are valuable operations to learn, but they arguably belong in “How to Write Go Code”, not “Test your installation” — and having all that extra detail in the install instructions may well discourage folks from further essential reading. Rather than updating all of those operations here, I've removed them. A companion CL will update “How to Write Go Code” to ensure that it mentions GOPATH (as the location of the module cache and the default install location for binaries) and 'go clean -i'. Updates #37042 Change-Id: I157f21ccbe3896575fa1115dc821abf6c71ed15e Reviewed-on: https://go-review.googlesource.com/c/go/+/217840 Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor Reviewed-by: Tyler Bui-Palsulich --- doc/install.html | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/doc/install.html b/doc/install.html index 05b6d0538c..40faadb2fa 100644 --- a/doc/install.html +++ b/doc/install.html @@ -192,20 +192,11 @@ Settings" option inside the "System" control panel.

Test your installation

-Check that Go is installed correctly by setting up a workspace -and building a simple program, as follows. +Check that Go is installed correctly by building a simple program, as follows.

-Create your workspace directory, -$HOME/go%USERPROFILE%\go. -(If you'd like to use a different directory, -you will need to set the GOPATH environment variable.) -

- -

-Next, make the directory src/hellosrc\hello inside your workspace, -and in that directory create a file named hello.go that looks like: +Create a file named hello.go that looks like:

@@ -223,19 +214,17 @@ Then build it with the go tool:
 

-$ cd $HOME/go/src/hello
-$ go build
+$ go build hello.go
 
-C:\> cd %USERPROFILE%\go\src\hello
-C:\Users\Gopher\go\src\hello> go build
+C:\Users\Gopher\go\src\hello> go build hello.go
 

The command above will build an executable named hellohello.exe -in the directory alongside your source code. +in the current directory alongside your source code. Execute it to see the greeting:

@@ -253,12 +242,6 @@ hello, world If you see the "hello, world" message then your Go installation is working.

-

-You can run go install to install the binary into -your workspace's bin directory -or go clean -i to remove it. -

-

Before rushing off to write Go code please read the How to Write Go Code document, -- 2.50.0