src/hello-world: shill VS Code

This commit is contained in:
Cadey Ratio 2019-10-28 23:21:04 +00:00
parent e49b9015a7
commit c17533e092
1 changed files with 17 additions and 8 deletions

View File

@ -86,7 +86,7 @@ If you are using bash, add the following lines to your .bashrc (Linux) or
```
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH="$PATH:$GOPATH/bin"
```
Then reload the configuration by closing and re-opening your terminal.
@ -98,7 +98,7 @@ following lines:
```
set -gx GOPATH $HOME/go
set -gx PATH $PATH $GOPATH/bin
set -gx PATH $PATH "$GOPATH/bin"
```
##### zsh
@ -107,19 +107,27 @@ If you are using zsh, add the following lines to your .zshrc:
```
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH="$PATH:$GOPATH/bin"
```
#### Windows
Follow the instructions [here](https://github.com/golang/go/wiki/SettingGOPATH#windows).
Follow the instructions
[here](https://github.com/golang/go/wiki/SettingGOPATH#windows).
## Installing a Text Editor
For this book, we will be using VS Code. Download and install it
from https://code.visualstudio.com. The default settings will let you work with
Go code.
## Hello, world!
Now that everything is installed, let's test it with the classic "Hello, world!"
program. Create a folder in your code folder called `go_learning` and create a
subfolder called `hello`. Open a file in there called `hello.go` in your
favorite text editor and type in the following:
program. Create a folder in your home folder `Code`. Create another folder
inside that Code folder called `get_going` and create yet another subfolder
called `hello`. Open a file in there with VS Code (Open Folder -> Code ->
get_going -> hello) called `hello.go` and type in the following:
```go
// Command hello is your first Go program.
@ -151,7 +159,8 @@ func main() { // func main is the entrypoint of the program, or
} // This ends the main function
```
Now to run this program run the following command:
Now click over to the terminal at the bottom of the VS Code window and run this
program with the following command:
```console
$ go run hello.go