Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the purpose of golang a underlining

Shulou Source: shulou.com Published: 2022-06-02 09:20:10 11月15日 Update

This article introduces the relevant knowledge of "what is the function of golang a underlining". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The role of underlining in golang

In Golang, the role of import is to import other package, but today when looking at the beego framework to see the import underline, do not know its meaning, so Baidu and solve it.

The role of import underscores (such as import _ hello/imp): when importing a package, all init () functions in the file under the package will be executed, however, sometimes we don't need to import the whole package, we just want it to execute the init () function. At this point, you can use import _ to reference the package. Even if you use [import _ package path] just to reference the package, just to call the init () function, so you can't call other functions in the package through the package name.

This is the end of the content of "what is the purpose of golang a underlining". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Underline function function content time more knowledge practicality achievement and then its meaning just dilemma reality situation documents articles frames cases editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB Redmi OPPO Reno Shulou Information