The Go CLI Playbook Flashcards

1
Q

How many programs do you need to develop in go?

A

Only one: go cli

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to get help on a specific command?

A

go help

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to run a single go file? What are the two things it requires to run?

A

go run .

Requires a func main() and all dependencies needs to be acessible.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the effect of the go build command in a module and in the main file?

A

Only compiles the module. Builds and generates an executable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is the binary saved by default?

A

In the working dir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what command runs tests? does it support defining specific names with wildcards such as *?

A

go test -run ./Module*

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to print the go environment variables? How to print in json format?

A

go env

go env -json

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how to add a package to the module? Should you add the url schema to it (e.g: https)? What is the most common form?

A

go get github.com/nathan-osman/go-sunrise
NO
go install github.com/nathan-osman/go-sunrise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly