| sr-due | 2025-12-28 |
|---|---|
| sr-interval | 11 |
| sr-ease | 270 |
#review
each go source code begins with a package declaration package main has a meaning, autonomous Go programs should use the main package. the import keyword allows you to include functionality from existing packages. two characteristics of go that makes it able to generate an executable binary:
- the name of the package
- presence of the main() function.
methods = functions that attached to specific data types
go global rule: everything that begins with a lower-case letter is considered private and it is accessible in the current package only. except packages name which can be named anything but he is not aware of one that starts with capital letters.
two ways of execute go code:
- as a compiled language == using go build and then run ./executable_file
- mimicking a scripting == language using go run
the go run command builds the named go package, creates a temporary executable file executes that file and deletes it once it is done