Prabhu Sunderaraman

Fullstack Engineer, Programmer, Writer, Trainer

prabhu.bits@gmail.com,     GitHub     Youtube     LinkedIn
  • Home
  • Profile
  • Books
  • Reading List
Browsing: / Home
Shortlink

Lockdown Learning – Day #44– Waiting for Goroutines in GoLang (Music Only)

By Prabhu Sunderaraman on May 8, 2020 in Go, Golang

Continuing with our lockdown learning of Go language. Here’s a video on the Need to wait for goroutines in Golang

A goroutine may have to wait for another goroutine to complete. Using time.Sleep() is a very crude way to wait

package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	go fixIssues()
	time.Sleep(time.Second * 5) //Unreliable.
	//So it would be good for the main goroutine to wait for fixIssues goroutine to complete
	//How do we do that? Next video :)
	fmt.Println("***Enough! I am done waiting")
}

func fixIssues()  {
	i := 0
	rand.Seed(time.Now().UnixNano())
	iterations := rand.Intn(20)
	fmt.Println("Time required:", iterations, "seconds")
	for i < iterations {
		fmt.Println("Fixing Issues ...")
		time.Sleep(time.Second * 1)
		i++
	}
}



You can watch other videos in Go lang in the links below

Getting Started
Variables and Constants
Data types
Conditional statements
Loops
Arrays
Maps
Slices – I
Slices – II
range
Functions – Part I
Functions – Part II
Closures
types
Type Conversions
struct – Part I
struct – Part II
struct – Part III
Pointers – Part I
Pointers – Part II
interface – Part I
interface – Part II
interface – Part III
interface – Part IV
defer – Part I
defer – Part II
defer – Part III
defer – Part III
panic
panic and recover
panic, recover and defer
Getting started with GoLand IDE.
Getting started with GoLand IDE.
packages.
import packages – Part I.
import packages – Part II.
import packages – Part III.
goroutine – intro .
goroutines & panic.
Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Lockdown Learning – Day #43– Goroutines & Panic in GoLang (Music Only)

By Prabhu Sunderaraman on May 7, 2020 in Go, Golang

Continuing with our lockdown learning of Go language. Here’s a video on panic in goroutines in Golang

A goroutine needs to have it’s own recover functions. Here’s the code that shows that

package main

import (
	"fmt"
	"time"
)

func main()  {
	go func() {
		defer func() {
			if r:=recover(); r != nil {
				fmt.Println("Error", r)
			}
		}()

		arr := [5]int{}

		//Something silly :)
		for i:=0; i< 15; i++ {
			fmt.Println(arr[i])
		}
	}()
	time.Sleep(time.Second)
	fmt.Println("End of main")
}

You can watch other videos in Go lang in the links below

Getting Started
Variables and Constants
Data types
Conditional statements
Loops
Arrays
Maps
Slices – I
Slices – II
range
Functions – Part I
Functions – Part II
Closures
types
Type Conversions
struct – Part I
struct – Part II
struct – Part III
Pointers – Part I
Pointers – Part II
interface – Part I
interface – Part II
interface – Part III
interface – Part IV
defer – Part I
defer – Part II
defer – Part III
defer – Part III
panic
panic and recover
panic, recover and defer
Getting started with GoLand IDE.
Getting started with GoLand IDE.
packages.
import packages – Part I.
import packages – Part II.
import packages – Part III.
goroutine – intro .
Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Lockdown Learning – Day #42– Goroutines – Intro in GoLang (Music Only)

By Prabhu Sunderaraman on May 6, 2020 in Go, Golang

Continuing with our lockdown learning of Go language. Here’s the a short intro to Goroutines in Golang

Here’s a list of things about go routines

  • Goroutines are “lightweight” threads
  • “lightweight” threads because they are not OS threads
  • Exist and managed within the Goruntime
  • go () starts a new Goroutine
  • main() itself runs as Goroutine

You can watch other videos in Go lang in the links below

Getting Started
Variables and Constants
Data types
Conditional statements
Loops
Arrays
Maps
Slices – I
Slices – II
range
Functions – Part I
Functions – Part II
Closures
types
Type Conversions
struct – Part I
struct – Part II
struct – Part III
Pointers – Part I
Pointers – Part II
interface – Part I
interface – Part II
interface – Part III
interface – Part IV
defer – Part I
defer – Part II
defer – Part III
defer – Part III
panic
panic and recover
panic, recover and defer
Getting started with GoLand IDE.
Getting started with GoLand IDE.
packages.
import packages – Part I.
import packages – Part II.
import packages – Part III.
Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Lockdown Learning – Day #41– import packages – Part III in GoLang (Music Only)

By Prabhu Sunderaraman on May 5, 2020 in Go, Golang

Continuing with our lockdown learning of Go language. Here’s the third part of the video on import packagesin Golang

You can watch other videos in Go lang in the links below

Getting Started
Variables and Constants
Data types
Conditional statements
Loops
Arrays
Maps
Slices – I
Slices – II
range
Functions – Part I
Functions – Part II
Closures
types
Type Conversions
struct – Part I
struct – Part II
struct – Part III
Pointers – Part I
Pointers – Part II
interface – Part I
interface – Part II
interface – Part III
interface – Part IV
defer – Part I
defer – Part II
defer – Part III
defer – Part III
panic
panic and recover
panic, recover and defer
Getting started with GoLand IDE.
Getting started with GoLand IDE.
packages.
import packages – Part I.
import packages – Part II.
Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Lockdown Learning – Day #40 – import packages – Part II in GoLang (Music Only)

By Prabhu Sunderaraman on May 4, 2020 in Go, Golang

Continuing with our lockdown learning of Go language. Here’s the second part of the video on import packagesin Golang

You can watch other videos in Go lang in the links below

Getting Started
Variables and Constants
Data types
Conditional statements
Loops
Arrays
Maps
Slices – I
Slices – II
range
Functions – Part I
Functions – Part II
Closures
types
Type Conversions
struct – Part I
struct – Part II
struct – Part III
Pointers – Part I
Pointers – Part II
interface – Part I
interface – Part II
interface – Part III
interface – Part IV
defer – Part I
defer – Part II
defer – Part III
defer – Part III
panic
panic and recover
panic, recover and defer
Getting started with GoLand IDE.
Getting started with GoLand IDE.
packages.
import packages – Part I.
Share this on: Mixx Delicious Digg Facebook Twitter
« Previous 1 2 3 … 64 Next »

Youtube Channel




Categories

  • JavaScript (48)
    • RequireJS (5)
  • Go (44)
  • Golang (44)
  • Ext JS (23)
  • Spring (22)
  • Mobile (21)
  • Scala (20)
    • Play (3)
  • Uncategorized (19)
  • Video Sessions (18)
  • GoG (17)
  • Sencha Touch (16)
  • jQuery (14)
  • Languages (13)
  • Java 8 (12)
  • React JS (11)
  • Kotlin (11)
  • HealthyCodeMagazine (9)
  • Video (9)
  • Objective-C (8)
  • NoSQL (8)
  • Android (7)
  • MongoDB (7)
  • GWT (6)
  • Tools (6)
  • HTML 5 (5)
  • Cloud (5)
  • General (5)
  • Micro services (5)
  • Java (5)
  • Books (4)
  • AWS (4)
  • Software Architecture (4)
  • .NET (3)
  • Elixir (3)
  • Docker (3)
  • Reactive (3)
  • NodeJS (2)
  • RoR (2)
  • Backbone (1)
  • AngularJS (1)

Archives

  • 2020 (49)
  • 2019 (7)
  • 2018 (34)
  • 2017 (15)
  • 2016 (7)
  • 2015 (18)
  • 2014 (31)
  • 2013 (55)
  • 2012 (100)

Search

Subscribe




Copyright © 2025 Prabhu Sunderaraman.

Powered by WordPress and News.