Build RESTful API in Golang

Welcome again! After learning some Golang, my next experiment was to build APIs. So, here's a blog-post for someone interested in trying it out. The only prerequisite to building RESTful APIs is to know the basics of Golang along with some SQL. Link to my blog-post series on Introduction to Golang may come handy. The code … Continue reading Build RESTful API in Golang


Go – Concurrency

Concurrency is when two or more tasks make progress simultaneously. It could be very tedious to get it right in most of the programming languages. However, Go has a rich support to concurrency and makes the task very easy. Goroutines: Goroutines are functions or methods that can run concurrently with other methods. They are light-weight … Continue reading Go – Concurrency

Go – Methods and Interfaces

Methods GO has no Classes. However, it has Methods that can be defined on 'types'. A Method is a function with a special 'receiver' argument. In the example below, 'v' is the receiver of the type 'Square', to the method 'Sqroot'. package main import ( "math" "fmt" ) type Square struct { x, y float64 … Continue reading Go – Methods and Interfaces

GO – Types (part 2)

Range Range iterates over a slice. Range returns two values while iterating over a slice. First is the index of the element and second a copy of the element at that index. package main import "fmt" var t = []int{1, 3, 6, 9, 12, 15, 18, 21} func main() { for i,v := range t … Continue reading GO – Types (part 2)

GO – Types (part 1)

Pointers   GO has pointers as in C. A pointer holds the memory address of a value. & operator generates a pointer to its operand '*' operator refers to the underlying value of the pointer   package main import "fmt" func main() { i := 24 p := &i fmt.Println(p) *p = *p/2 // This … Continue reading GO – Types (part 1)

GO – Flow Control

The All-purpose For loop GO has a single looping construct which is the For loop. For loop has three components similar to that in C/Javascript: Init statement - Executed before the loop starts Conditional statement - Checked before every iteration Post statement - executed after every iteration. However, unlike C/Java/Javascript there is no parentheses surrounding the components. … Continue reading GO – Flow Control

GO – Getting Started

GO or Golang is known for its Efficiency, Concurrency and Scalability to large systems. Some of its distinctive features are: Clean, readable and modular code with minimum boilerplate. Is Statically typed Faster compilation time Remote Package Management goroutines (light-weight processes), channels (connects goroutins) and the Select statement Supports Networking and Multiprocessing. GO was created at … Continue reading GO – Getting Started