Go Interview Questions
Thanh Pham / Fri 25 Dec 2020

Summary.A list of questions for challenging, evaluating and learning Go faster.
Learning without testing your knowledge can lead to wrong perception about your expertise level. This article provides you a list of questions for you to evaluate yourself easier.
Go Questions
1. Basic
- What is Go?
- Why should you learn Go?
- What is Go suitable for?
- What are the advantages and disadvantages of Go?
- How Go is different from the programming languages that you have used? (Java, C/C++, Python, Rust, NodeJS, JavaScript)
2. Array and Slice
- What are the differences between array and slice?
- What are the differences between slice and link list?
- How re- slicing process of a slice happen under the hood?
- Can you modify array length? Can you append new item into an array?
- Explain how different between array/slice in Go and array in C/Java?
3. String
- How is string in Go constructed? And what is the different between string in Go with other programming languages?
- What is string literal? How is it done in Go?
- Explain how you can write multi-line strings in GO?
4. Goroutine
- What are the difference between goroutine and OS thread?
- Explain what is go routine in GO? How you can stop go routine?
- What is a worker pool? And how to do that in Go?
- How to stop a worker pool?
- What is fan-in, fan-out?
- What is sync.WaitGroup used for?
- What are the differences between sync.Mutex and semaphore?
- What are the differences between concurrency and parallelism?
- What are the differences between sharing by communicate vs communicate by sharing?
- What is channel? How does it work? What is it used for?
- What is context? What is it used for?
- Have you used goroutine in your application? Describe it.
- Why goroutine is better than thread?
- What is goroutine leak in Go? How to prevent it?
5. Interface
- Explain Interface in Go
- How interface in Go different from interface in other languages?
- When should you use interface?
- How did you use interface in your previous project?
6. Other General Questions:
- Does Go pass by value or pass by references? What are the differences?
- What is Go run time?
- How does garbage collector work in Go?
- What is inside the interface{}?
- How to handle gracefully shutdown in Go?
- Why would you prefer to use an empty struct{} ? Provide some examples of the good use of the empty struct{} .
- How do you compare two structs? What about two interfaces? Provide examples.
- How do you implement stack and queue in Go? Provide an example.
- What is type assertion and how is it done in Go?
- How type conversion is done in Go?
- What is the difference, if any, in the following two slice declarations, and which one is more preferable? var a []int and a := []int{}
Real Experiences Questions
1. General:
- How did you structure your last project in Go? What are the advantages and disadvantages of it?
2. Config
- How did you manage configurations of your services in Go?
- What kind of libraries did you use for configuration management in Go? Compare them.
- How did you manage configurations of your services in Docker, OpenShift, Kubenetes environment?
3. HTTP
- Have you ever used any framework for working with HTTP in Go? Compare it with native HTTP library provided by Go.
- What is middleware? Have you ever written one?
4. Logging
- Explain how did you implement logging component in your last application with Go?
- Did you use any libraries for logging in Go? Explain how did you use it and compare with native logging library.
- How did you organize logging in containerize environment like Docker, Kubernetes, OpenShift where you have a lot of instances running at the same time?
5. Deployment:
- How did you deploy your application?
- Have you ever used Docker or any containerize technology for deployment? Describes it.
- Have you ever written Docker file? Describes it?
6. Database:
- Have you ever used MongoDB? Explain in detail what did you use it for?
- Explain what are the differences between NoSQL and SQL? When should you use NoSQL and when not to?
- What library did you use to interact with MongoDB in Go? Compare it with other libraries.
- How big your data is?
- How did you scale your MongoDB for performance?
7. Search Engine:
- What did you use Elasticsearch for?
- When should you use Elasticsearch and when should you use MongoDB?
- What library did you use to interact with Elasticsearch in Go?
- How did you handle a lot of indexing in high performance application?
- Do you know bulk processor? Did you use it? How does it work?
8. Message queue:
- Have you ever used any message queue technology? Describe how did you use it.
- Have you ever used Kafka? How is it used in your application? And why did you choose it?
- When should you use message queue? Give some example.
9. Performance
- How many query/second of your application?
- How can you measure performance of your application?
- How did you scale up your application?