August 2019
Beginner to intermediate
798 pages
17h 2m
English
The source code of a Go package, which can contain multiple files and multiple directories, can be found within a single directory that is named after the package name, with the obvious exception of the main package, which can be located anywhere.
For the purposes of this section, a simple Go package named aPackage will be developed. The source file of the package is called aPackage.go, and its source code will be presented in two parts.
The first part of aPackage.go is shown in the following Go code:
package aPackage
import (
"fmt"
)
func A() {
fmt.Println("This is function A!")
}
Notice that using capital letters in Go package names is not considered a good practice – aPackage is only used here as an example. ...
Read now
Unlock full access