Tag:Interface type

  • A summary of four types of conversion in golang


    A series of articles: Implementation principle of golang reflect A summary of four types of conversion in golang Go type conversion There are four types of go conversion: assertion, coercion, explicit and implicit. Generally speaking, type conversion refers to assertion. Coercion is not used in daily life. Display is a basic type conversion. It is […]

  • Go interface


      Implicit interface An interface type is a collection defined by a set of methods. The value of the interface type can hold any value that implements these methods. Types implement interfaces by implementing those methods. There is no need to explicitly declare; therefore, there is no keyword “implements.”. Implicit interface decouples the package that […]

  • Golang underline summary


    Today, when I look at the gin framework, I used a render package when tracking gin when processing the interface return. In the process of looking at the code, I found such a writing method: // Render interface is to be implemented by JSON, XML, HTML, YAML and so on. type Render interface { // […]

  • Golang custom error


    The error processing of the system itself is generally errors. New() or FMT. Errorf(), etc., which is not very friendly to those that need complex display. We can extend the error. Error is defined as an interface type in the standard library, which has only one error () method type error interface { Error() string […]