当前位置:网站首页>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
边栏推荐
猜你喜欢

Garbage collector and memory allocation strategy

JVM的类加载过程

5 minutes to achieve wechat cloud applet payment function (including source code)

binlog2sql 工具安装使用及问题汇总

深度学习——特征工程小总结

MySQL syntax collation (2)

2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)

为何PostgreSQL即将超越SQL Server?

MySQL restores or rolls back data through binlog

优先使用组合而不使用继承
随机推荐
Oracle configuration st_ geometry
Build intelligent garbage classification applet based on Zero
js上传文件时控制文件类型和大小
I just want to leave a note for myself
Regular expressions for judging positive integers
Easy mock local deployment (you need to experience three times in a crowded time. Li Zao will do the same as me. Love is like a festival mock)
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy
Network protocol: SCTP flow control transmission protocol
JVM的类加载过程
Virtual machine performance monitoring and fault handling tools
Codeworks round 783 (Div. 2) d problem solution
为何PostgreSQL即将超越SQL Server?
Audio signal processing and coding - 2.5.3 the discrete cosine transform
【玩转Lighthouse】腾讯云轻量服务器搭建全平台视频解析视频下载网站
MySQL syntax collation (4)
2021-2022-2 ACM training team weekly Programming Competition (8) problem solution
SSDB基础3
Codeforces Round #784 (Div. 4)
Zero cost, zero foundation, build profitable film and television applet