Skip to content

RamaRaju-personal-org/Go_Basics

Repository files navigation

Go Basics

Note

First go to the folder where the go file is present.

  • To run a go application in development :
   go run firstCode.go
  • In production :
   
   # initialize the module (on MacOS)
   go mod init /path/to/your/goFile/customModuleName
   # build the module
   go build 
   # Run the module and get the executable file (on MacOS)
   ./customModuleName
  • Go has modules and each module has multiple packages
  • Should have atleast one package in a file
  • A single package can be split accross multiple go files
  • Can have multiple packages in one go file also
  • Go standard libraby for packages

packages packages