Skip to content

Blog

Functions Cannot Compare

In go, there are some cases when we need to check functions in some cases:

  • check the equality of functions
  • compare two objects with function fields.

However, function type in Go is not addressable and not comparable.

How Go Exec Works

It’s common to run and wish to get results. As the command is executed in a forked child process, how results are passed back? This blog investigates how output is passed to parent process in command.Output.

Design of Go-Github Library

Usually, we write a client package to hide the logic about rpc to get the value, hide complex about network.

This article will based on the library of https://github.com/google/go-github to introduce useful experience when we want to design a client for results from the remote.

As usual, our client package needs to satisfy some requirements, which why we create a saperate package for it.

  • we need to call many api from server, and most logics of them are duplicated.
  • hide some duplicated work and could be reused by the caller.

Not Encourage Copy Hint In Go Language

In cpp, some classes cannot be copied as their copy constructers are disable. For example, you can never pass an iostream by value, only reference is allowed.

Based on provious blogs, we know that if we pass by pointer or interface, the value will be passed like reference.

Define and Use Error Properly in Go

Copy Behaviors in Go

Go has no way to disable the copy, but it provides a way to check whether the code not wishes to copy something.

Request Sending Precedures in GRPC Client Side

As a developer, understanding the behaviors of grpc cannot keep away from the implementation. If we only know the high-level design but do not care about the implementation, we cannot get help in coding through our learning effects.

In this article, I will list some necessary concepts and draw some diagrams to understand implementation better.