Golang is extremely explicit with types. It supports constants of a type. But how about a const 2 or hello. What type would they assume!? Go solved this problem with untyped constants. Untyped means: A constant’s type depends on the type of assignee variable. The assignee’s type must […]
The project structure [https://github.com/golang-standards/project-layout] Coding standard [gofmt and golint] Coding IDE [vim + vim-go]. My favorite! Go Packages Fundamentals [https://medium.com/rungo/everything-you-need-to-know-about-packages-in-go-b8bac62b74cc]
Concurrency is one of the most exciting features of Go language. A single threaded program runs serially, but if you have tasks that can run concurrently, you create threads for such tasks. Threads execute independently and progress concurrently. Go supports creation of thousands of threads in an application!! […]
The Empty Interface An empty interface is used when type of a variable is unknown. There are scenarios such as printf function, raw buffers where you would not know the type. Use case // Definition of a map is –> var map[key]value // If we do not know […]
Function with return value name func f() (r int) { r = 1 return } Return Multiple Values func f() (int, string) { return 10, “ten” } Variadic Functions package main import “fmt” func varFunc(a int, b …string) (int) { for v:= 0; v <= 3; v++ { […]
I have been a C/C++ developer for more than a decade and now getting a chance to work in Go. There are many past references of C, C++, and Python to learn the language quickly. but there are some new syntax that appear unfamiliar. We share such language […]