Tag:Interface type

  • A summary of four types of conversion in golang

    Time:2021-5-31

    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

    Time:2020-11-19

      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

    Time:2020-11-1

    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

    Time:2020-2-27

    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 […]