当前位置:网站首页>The difference between underline and dot of golang import package
The difference between underline and dot of golang import package
2022-04-23 19:21:00 【Handsome that handsome】
stay golang When importing packages , We sometimes encounter the need to underline or dot the front of the package , I never understood what it meant , Then a search was carried out :
The package is underlined _: When importing a package , All the documents under the package init Functions are executed , But sometimes we just need to use init Function. I don't want to import the whole package into ( Do not use other functions in the package )
Before the bag is a dot .:
import(.“fmt”)
The meaning of this point operation is that after the package is imported, when you call the function of the package , You can omit the prefix package name , That's what you called earlier fmt.Println(“hello world”) It can be written as Println(“hello world”)
版权声明
本文为[Handsome that handsome]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210557450790.html
边栏推荐
- 深度学习环境搭建步骤—gpu
- 开关电源设计分享及电源设计技巧图解
- 開關電源設計分享及電源設計技巧圖解
- ArcGIS JS API dojoconfig configuration
- c1000k TCP 连接上限测试1
- arcMap 发布切片服务
- Redis optimization series (III) solve common problems after master-slave configuration
- Summary of several relationships of UML class diagram
- Some records used by VS2010
- ArcMap连接 arcgis server
猜你喜欢
MySQL syntax collation (3)
命令-sudo
Some records used by VS2010
[record] typeerror: this getOptions is not a function
Wechat applet part of the mobile phone Preview PDF did not respond
优先使用组合而不使用继承
SQL常用的命令
Wechat video extraction and receiving file path
The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
The platinum library cannot search the debug process records of some projection devices
随机推荐
Garbage collector and memory allocation strategy
Codeworks round 783 (Div. 2) d problem solution
c1000k TCP 连接上限测试1
MySQL syntax collation (4)
SQL常用的命令
MySQL syntax collation (5) -- functions, stored procedures and triggers
c1000k TCP 连接上限测试
MySQL restores or rolls back data through binlog
Using Visual Studio code to develop Arduino
開關電源設計分享及電源設計技巧圖解
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
Tencent cloud GPU best practices - remote development training using jupyter pycharm
Common SQL commands
Class loading process of JVM
Some ideas about time-consuming needs assessment
An idea of rendering pipeline based on FBO
Use of fluent custom fonts and pictures
The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
开关电源设计分享及电源设计技巧图解
I just want to leave a note for myself