/golang-internal

This project features optimized Go language, expert source code, concurrent processing, and industry-best practices.

Golang Internal

Go language has many amazing features and syntax, such as how to swap the values of two variables.

package main

import "fmt"

func main() {
    a := 5
    b := 10
    fmt.Println("Before swapping, values of a and b are:", a, b)
    a, b = b, a
    fmt.Println("After swapping, values of a and b are:", a, b)
}

Output:

Before swapping, values of a and b are: 5 10
After swapping, values of a and b are: 10 5

This interesting syntax feature is used to test whether an engineer has enough understanding of the Go language. But why is this way of exchanging values valid? How is this syntax feature implemented in Go?

The goal of this project is to answer a series of questions like this from the perspective of the underlying implementation in Go, by explaining the source code, including syntax, data structures, and a series of concurrency issues.

Problems

Variable and Keywords

  1. How to Swap the Values of Two Variables
  2. Use New or Make
  3. String literals, Byte and Rune
  4. Struct, Interface, Pointer
  5. How to Use Defer
  6. Panic and Recover

GPM

  1. How Goroutine Works
  2. How to Use Channel
  3. How Context Works

GC

  1. Go Memory Allocate
  2. How Garbage Collector Works?

Map

  1. Map in Go
  2. New One: Slice

Concurrency

  1. Sync.map
  2. More Sync: Sync.pool, Sync.once
  3. Mutex
  4. Waitgroup
  5. Timer

Develop Tools

  1. Gin
  2. Godep

Code Practices

  1. Go Version Update
  2. What Are Golang Packages?
  3. Is Golang Case sensitive or Insensitive?
  4. Return Multiple Values From A Function in Go?
  5. Type Assertion in Go
  6. How Is GoPATH Different From GoROOT Variables In Go?
  7. In Go, Are There Any Good Error Handling Practices?
  8. Expressions. Diff b/w Curly Brackets and Square Brackets?