What is this go language? Let’s explore.
Go language uses lots of standard libraries, list of which can be found at https://golang.org/pkg/
Importing functions from other packages
-
Visit pkg.go.dev and search for a “quote” package.
Locate and click thersc.io/quote
package in search results (if you seersc.io/quote/v3
, ignore it for now). - run command “go mod init hello” to generated mod files.
- finally run “go run <filename>.go”
Packages
- group of files in a directory form package
- functions and variables are accessible across package files.
- Function and var that start with capital letter are called exported variables that can be accessed from functions of other files in the package.