Hi!
For reference, you can store this cheatsheet after you take the lectures in this section.
You can also print this cheatsheet and then follow the video lectures in this section along with it.
Enjoy!
-
Enter into a directory:
cd directoryPath -
WINDOWS:
- List files in a directory:
dir
- List files in a directory:
-
OS X & LINUXes:
- List files in a directory:
ls
- List files in a directory:
-
Build a Go program:
- While inside a program directory, type:
go build main.go
- While inside a program directory, type:
-
Run a Go program:
- While inside a program directory, type:
go run main.go
- While inside a program directory, type:
- In any directory you like.
- Create a new directory:
mkdir myDirectoryName
- Go to that directory:
cd myDirectoryName
- Create a new
code main.gofile.- This is going to the create the file in the folder, and open up it in the Visual Studio Code.
- And add the following code to it and save it.
package main
import "fmt"
func main() {
fmt.Println("Hi! I want to be a Gopher!")
}- Finally, return back to the command-line.
- Run it like this:
go run main.go
- Run it like this:
- If you create other files and run them all, you can use this command:
go run .
That's all! Enjoy!
For more tutorials: https://blog.learngoprogramming.com
Copyright © 2018 Inanc Gumus
Learn Go Programming Course