Features

  • doesn't have function overloading
  • doesn't allow truthiness. In fact, no other type can be converted to a bool, implicitly or explicitly.
  • Go runtime provides services like memory allocation and garbage collection, concurrency support, networking, and implementations of built-in types and functions.
  • No classes, and no inheritance
  • functions in Go are values

Terminal Commands

Installation for macos


    $ brew install go # using brew
    $ choco install golang # using chocolatey
    $ go version # verify installation
        

Other important commands


    $ go install <library_name> # for installing libraries
    $ go run <file_name> # builds the binary, executes the binary from that temporary directory, and then deletes the binary after your program finishes
    $ go build <file_name> # creates an executable in the current directory. The name of the binary matches the name of the file or package passed.
        

Code Formatting


    $ go fmt # automatically reformats your code to match the standard format
    $ goimports # cleans up your import statements
    $ golint ./... # to run the lint program
      # $ go install golang.org/x/lint/golint@latest to install the lint program
    $ go vet ./... # to counter the errors that were not what the developer meant to do.
      # This includes things like passing the wrong number of parameters to formatting methods or assigning values to variables that are never used
        
// GoLand is the Go-specific IDE from JetBrains.
// Go Playground (http://play.golang.org/) is also available for use