Category: Programming Language

Go: Program Structure

Go program is designed into various section. The following sections defines a Go program.

  1. Package Declaration
  2. Import statement
  3. Functions
  4. Variables
  5. Statements and Expression

Now let us write a hello world program in go language.

package main /*Package declaration*/
import "fmt" /*Import statement*/
func main() { /*Function declaration*/
  /*Our hello world program*/
  /*The below line when executed will print "Hello World!"*/
  fmt.Println("Hello world!")

Save the above program in a file hello-world.go. Now to run the above program, go to terminal and type

$ go run hello-world.go


Hello world!


Go is a general-purpose language specifically designed with systems programming in mind.
Robert Griesemer, Rob Pike, and Ken Thompson initially developed Go at Google in the year 2007. It is strongly and statically typed, provides inbuilt support for garbage collection, and supports concurrent programming.

Go programs use packages to efficiently manage the dependencies. The traditional compile and link model is used to generate executable binaries.

Some important features of Go programming language is :

  1. Environment adopting patterns similar to dynamic languages is supported.
  2. Compilation time is really great.
  3. It has inbuilt concurrency support.
  4. Simple, concise and safe

Now that we know the features of Go, i.e. what is included in Go language, we must make our way towards what does Go does not have ! or else .. some intentionally excluded features in Go. The following features have been excluded from go to keep the language simple and concise.

  1. Type inheritence
  2. Method or operator overloading
  3. Circular dependencies
  4. Pointer arithmetic
  5. Assertions
  6. Generic programming

Recent Posts


GiottoPress by Enrique Chavez