Interface with abstract of methods

Defining an Interface Keyword : type, interface Interface_name user provide a descriptive name Within the { } curly bracket, method sets are a list of method_name has been defined method name with parameters, return. No implementation details. https://golang.org/pkg/os/#FileInfo the FileInfo interface has the following method sets: Name() string // return Read more…

Struct type

Struct types A struct is a sequence of named elements, called fields, each of which has a name and a type. Field names may be specified explicitly (IdentifierList) or implicitly (EmbeddedField). Within a struct, non-blank field names must be unique. StructType = “struct” “{” { FieldDecl “;” } “}” . FieldDecl = Read more…

Go Modules

A module is a collection of Go packages stored in a file tree with a go.mod file at its root. The go.mod file defines the module’s module path, which is also the import path used for the root directory, and its dependency requirements, which are the other modules needed for Read more…

Compiler Explorer.

Compiler Explorer is an interactive tool that lets you type code in one window and see the results of its compilation in another window. Using the site should be pretty self-explanatory: by default the left hand pane is the source window and the right hand has the assembly output. https://go.godbolt.org/

Function closures

Go functions may be closures. A closure is a function value that references variables from outside its body. The function may access and assign to the referenced variables; in this sense the function is “bound” to the variables https://tour.golang.org/moretypes/25

Cross-Compile

Building Go Applications for Different Operating Systems and Architectures On One Computer. To run a build for a different platform, we simply set the GOOS and GOARCH environment variables (for the operating system and architecture, respectively) and invoke “go build” When you run a command like go build, Go uses the current platform’s GOOS and GOARCH to determine how to build Read more…