GoTheBiggerPicture Flashcards
Main problems solved by Go-Lang
- In-efficient Compilation
- In-efficient Execution
- Complex programming model
From Which language syntax is inspired in Go lang?
‘C Language’
Is Go procedural or Object Oriented ?
It is both.
Is Go Garbage collected ?
Yes Go language automatically performs garbage collection.
what it means when we say Go is fully compiled language?
It means, the Go compiled code doesn’t requires a “mediator” runtime to execute the same. It can be directly executable by the OS.
Unlike other languages like Java or Python, which requires a “mediator” runtime to execute the compiled code, the Go doesn’t requires any runtime same.
Does Go provides Single Binary output after compilation ?
yes, to make deployment easier, the Go compiler provides single binary output for deployment.
When first version of Go was released and what’s its release cycle ?
First Version: 2012 - 1.0
Release Cycle: Every six Month
Current Version: 1.20
What are the go inbuilt packages which provide network supports?
net and net/http
Which package in Go language provides “concurrency” support ?
goRoutine
How can we share resources between concurrent threads in Go ?
Using “channels”
How Go lang generate OS specific binaries for Windows, OS X and Android?
Go uses following variables to create Platform specific binaries:
1. GOOS
2. GOARCH
Once we set these environment variables, Go automatically creates the OS specific binaries. e.g.
1. Windows: GOOS: windows & GOARCH: amd64
2. OSX: GOOS: darwin & GOARCH: amd64
3. Android: GOOS: android & GOARCH: arm
Which package in GO is used to accept command line parameters ?
“Flag”
What should be the first statement of any Go Source File ?
“package” statement.
It says where our source code sits in our Application.
How to put a single line comment in Go ?
// This is a commented line
How to put a multi-line comment in Go ?
/*
This is
multi line comment.
*/
What is an Import statement ?
Import statement is used to import “external” package inside our package.
What is an Import block ?
An import block allowed us to import multiple packages without repeating the word “import”. e.g.
import (
“os”
“fmt”
)
What type of indentation is used by Go formatter to format the code - “Space” or “Tab”?
“Tab”.
It is a standard practice to use “Tab” for indentation, instead of “spaces”