Posts

Interfaces

Image
 Interfaces in Golang What is Interface  In general, an interface is a set of methods or behaviors that a type must implement in order to be considered an implementation of that interface. Interfaces are a way of specifying a contract that a type must adhere to in order to be used in a certain context. Interfaces are a common feature in many programming languages, and they are often used to define the behavior of types in a way that is decoupled from their implementation. This allows you to write code that is more flexible and easier to extend, as you can use different implementations of an interface without having to change the code that uses the interface. For example, you might define an interface called Shape that defines methods for calculating the area and perimeter of a shape. You could then define multiple types that implement the Shape interface, such as Rectangle, Circle, and Triangle. This would allow you to write code that works with any type that implements the Sh...

Concurrency in Golang

Image
 Concurrency in Golang What is concurrency Concurrency is the ability of a system or program to have multiple tasks in progress at the same time.  It is a way of designing and organizing a system to allow multiple tasks to overlap in their execution, rather than executing them sequentially one after the other. Concurrency is often used in the context of computer programming,  where it allows multiple tasks to be performed concurrently within a single program.  It can be used to improve the performance and responsiveness of a program by allowing it to perform multiple tasks at the same time, rather than executing them one at a time in a sequential manner. There are several different ways to implement concurrency in a program, including: Multi threading : This involves dividing a program into multiple threads of execution that can run concurrently on separate cores or processors. Asynchronous programming : This involves using asynchronous functions or methods that allo...

Why Golang

Image
Why Golang History  Go, also known as Golang, is a programming language developed at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson.  It was designed to be a high-performance language that would be easy to use and maintain, with support for concurrency and garbage collection. Go was influenced by several other programming languages, including C, C++, and Pascal.  It has a syntax that is similar to C, but with some additional features that make it more modern and easier to use. One of the main goals of Go was to improve upon some of the shortcomings of existing programming languages, such as the slow compilation times and complex build processes of languages like C++.  Go was designed to be easy to build and deploy, with a simple, straightforward syntax that is easy to read and write. How Different from other languages Go is a general-purpose programming language that is designed to be simple, efficient, and easy to use.  It is different from othe...

Golang Interview Questions Part 2 Theory

What is Package Context in Go" and how we are using it?   What is the type Assertion? How Go's interface is different from Java Interface Design database design for particular system consider normalization What is Docker and Kubernetes? What is AWS Inline function in Go? Inline struct in Go? What is GORM? What is Gorilla Mux? Difference between Switch and Select in Go? What is First-Class Function in Go? How to define an anonymous function in Go? How to define an anonymous struct in Go? Function closures in Go What is Pass by Value and Pass by Reference? What is Slice Capacity and Length? What is struct composition? What is a nested struct? How to delete elements from Slice? What is Nil Interface What is Zero Value, Write down for all basic types? What is Atoi and Itoa ? What is gRPC? Part One  https://gophersgo.blogspot.com/2021/01/golang-interview-questions-part-1.html Keep GOing Keep Learning

Golang Interview Questions Part 2 Coding Question

Golang Interview Coding Questions This is Part 2 Golang Interview coding Questions, Please check part 1 for Theory Questions. https://gophersgo.blogspot.com/2021/01/golang-interview-questions-part-1.html All questions asked in a real interview. Write any method code Swap if the number is greater than the next number Find the key from the array (not in any easy way, split the array into two then search) Find the count of words in a long string Check if the website is active or not? Find the random number with x length Find longest increasing subsequence in an array Get unique values from a slice of int with count Write palindrome program in go Get pairs with x difference only unique pairs Reverse a string Input = ‘Hello’, Output = ‘olleH’ Write Code :- Input : "aabbbcccab" , Output: "aa2bbb3ccc3a1b1" Print unique elements form array, Input = [2,3,4,5,2,3], Output =  [2,3,4,5] Find the lengthiest word.  Input =’ i am in Bangalore‘ Check whether it is closed or not. ...

Golang Interview Questions Part 1 Theory Top 50 Question

 Most Frequently asked golang interview Questions         ( Based on the real interview experience)      for Fresher 0-1 year experience. Why Golang --> For its Simplicity, Build in Concurrency Support and Super Scalable. What is Goroutine --> Goroutine is like a thread in java, it's lightweight than a thread useful to achieve concurrency in Go.  https://golangbot.com/goroutines/ How to communicate between goroutines? --> By Using Channels we can communicate between Goroutines. What is mutex? -- >  https://golangbot.com/mutex/ What is synchronization in go -->  https://golang.org/pkg/sync/ How to achieve concurrency in Go   --> By Using Goroutines. What is Channels in go? -->  https://golangbot.com/channels/ What are the Types of Channels? -->  https://golangbyexample.com/channel-golang/ What is Buffered Channel and Unbuffered Channel explain? -->  https://golangbot.com/channels/ H...

Best GitHub repositories for Go

Best Repositories for Go   In this article, I will share with you the best repositories on GitHub for Go. Companies using Go https://github.com/golang/go/wiki/GoUsers Golang Roadmap https://github.com/Alikhll/golang-developer-roadmap Cheatsheet https://github.com/a8m/golang-cheat-sheet Books https://github.com/dariubs/GoBooks https://github.com/astaxie/build-web-application-with-golang/tree/master/es https://github.com/go101/go101/releases Golang code samples and examples https://github.com/inancgumus/learngo https://github.com/GoesToEleven/GolangTraining https://github.com/ardanlabs/gotraining Data structure and algorithms https://github.com/halfrost/ LeetCode-Go  ( Use Google Translator) https://github.com/emirpasic /gods https://github.com/TheAlgori thms/Go https://github.com/arnauddri /algorithms https://github.com/0xAX/go-a lgorithms https://github.com/floyernic k/Data-Structures-and- Algorithms https://github.com/PacktPublishing/Learn-Data-Structures-and-Algorithms-with-...