您的位置 首页 golang

清华学神尹成带你学习golang2021(8)Go语言标准库强大

学习编程语言,早已不是学一点语法规则那么简单。现在更习惯称作选择
Ecosystem(生态圈),而这其中标准库的作用和分量尤为明显。

 

在Go语言的安装文件里包含了一些可以直接使用的包,即标准库。Go语言的标准库(通常被称为语言自带的电池),提供了清晰的构建模块和公共接口,包含
I/O 操作、文本处理、图像、密码学、网络和分布式应用程序等,并支持许多标准化的文件格式和编解码协议。

 

在 Windows
下,标准库的位置在Go语言根目录下的子目录 pkgwindows_amd64 中;在 Linux 下,标准库在Go语言根目录下的子目录
pkglinux_amd64 中(如果是安装的是 32 位,则在 linux_386 目录中)。一般情况下,标准包会存放在
$GOROOT/pkg/$GOOS_$GOARCH/ 目录下。

 

Go语言的编译器也是标准库的一部分,通过词法器扫描源码,使用语法树获得源码逻辑分支等。 Go 语言的周边工具也是建立在这些标准库上。在标准库上可以完成几乎大部分的需求。

 

Go语言的标准库以包的方式提供支持,下表列出了Go语言标准库中常见的包及其功能。

 

清华学神尹成带你学习golang2021(8)Go语言标准库强大

 

Go语言标准库包名

功  能

bufio

带缓冲的 I/O 操作

bytes

实现字节操作

container

封装堆、列表和环形列表等容器

crypto

加密算法

database

数据库驱动和接口

debug

各种调试文件格式访问及调试功能

encoding

常见算法如 JSON、XML、Base64 等

flag

命令行解析

fmt

格式化操作

go

Go语言的词法、语法树、类型等。可通过这个包进行代码信息提取和修改

html

HTML 转义及模板系统

image

常见图形格式的访问及生成

io

实现 I/O 原始访问接口及访问封装

math

数学库

net

网络库,支持 Socket、HTTP、邮件、RPC、SMTP 等

os

操作系统平台不依赖平台操作封装

path

兼容各操作系统的路径操作实用函数

plugin

Go 1.7 加入的插件系统。支持将代码编译为插件,按需加载

reflect

语言反射支持。可以动态获得代码中的类型信息,获取和修改变量的值

regexp

正则表达式封装

runtime

运行时接口

sort

排序接口

strings

字符串转换、解析及实用函数

time

时间接口

text

文本模板及 Token 词法器

Go语言标准库常用的包及功能

当然,优秀第三方资源也是语言生态圈的重要组成部分。近年来崛起的几门语言中,Go
算是独树一帜,大批优秀作品频繁涌现,这也给我们学习 Go 提供了很好的参照。

文章来源:智云一二三科技

文章标题:清华学神尹成带你学习golang2021(8)Go语言标准库强大

文章地址:https://www.zhihuclub.com/90337.shtml

关于作者: 智云科技

热门文章

评论已关闭

33条评论

  1. To decide between both ED medications, it s best to first consult a healthcare provider before making a choice

  2. In a well-designed, randomized and double blind study, sildenafil was compared to a placebo 21 PDE5 is an enzyme responsible for constricting blood vessels, meaning blood doesn t flow as easily as it might

  3. Several rounds of blood moons shone on the rhino 6500 male enhancement liquid Healthy Man Sexual Stress Symptoms erectile dysfunction after da vinci prostectomy heavens and rhino 6500 male enhancement liquid the earth, and the powerful aura enveloped the four rhino 6500 male enhancement liquid fields, and the whole city seemed to be in it

  4. The doctor may suggest you try again, for this very reason, if you don t experience success the first time

  5. I first thought Clomid was the cause bc during my first round, it elevated it some, but it came back down before O time.

  6. hominis strain isolated in our patient was susceptible to both tetracyclines and quinolones.

  7. It is possible to follow the evolution of the precursor internal energy distribution for many milliseconds after admittance of the precursor ions into the linear ion trap 433 was detectable with respect to the DFS Fig

  8. Its protective function becomes compromised and aging is associated with impaired wound healing, hair loss, pigmentary changes and skin cancer

  9. ETN disrupts several established cellular molecular events that drive myogenic vasoconstriction 29 Cortical neurons from E16 SD rats were cultured according to previous work Wang et al

  10. Because this result is not the best, the best result is that Samsung takes the risk and directly will nolvadex increase testosterone pushes lithium battery products

  11. MUSIC Jill Leonard Musician All Glory Laud and Honor Here I Am Lord Song of Farewell The Summons Special Music Carry Me Home

  12. The 20 children were healthy with no apparent abnormalities; no details on obstetric outcome were reported 60

  13. Ren J, Jin F, Yu Z, Zhao L, Wang L, Bai X, Zhao H, Yao W, Mi X, Wang E, Olopade OI, Wei M All women were genotyped using the custom Ilumina iSelect genotyping array of the Collaborative Oncological Gene environment Study iCOGS which comprises 211, 155 single nucleotide polymorphisms SNPs primarily selected for replication of loci putatively associated with breast cancer and other cancers 18

  14. Ten additional patients had debulking surgery followed by two cycles of postoperative adjuvant CIT commencing a mean of 6 weeks after surgery

  15. Characterization of cell surface carbohydrate receptors for Entamoeba histolytica adherence lectin It felt like plantar fasciitis and other heel pain

  16. Finally, reactions 21 and 23 shown in Figure 1C depict the processes of transcription synthesis of mRNA, r and translation synthesis of the protein, p, whereas reactions 22 and 24 account for degradation of RNA and protein, respectively

  17. But they have become popular in China not for their taste, but for their medicinal benefits Ticagrelor is a P2Y 12 receptor antagonist that inhibits the formation of thromboses to reduce the risk of myocardial infarction and ischemic stroke

  18. A phoenix Hearing the old man is words, all the monsters were overjoyed and rushed towards the center of the sea of fire

  19. A persistent blood pressure lowering effect was demonstrated by a randomized withdrawal study patients randomized to continue drug or placebo, which showed a statistically significant difference between patients kept on aliskiren and those randomized to placebo

  20. The following adverse reactions have been identified during post approval use of TOPROL XL or immediate release metoprolol Ann Otol Rhinol Laryngol 2019; 128 9 869 78

  21. mysoline antibiotica flucloxacilline The latest deaths only increase the mistrust between the two sides as they hold negotiations after a hiatus of nearly five years

  22. Placebo controlled studies of 12 weeks duration in patients who did not respond adequately to diuretics and

  23. Between blepharitis and dry eye product sales, slit lamp photos, and in office treatment, we re on schedule to collect an additional 20, 000 in net revenue this year

  24. Therefore, for a single growth factor to induce therapeutic angiogenesis, an entire self propagating cascade of proliferative, migratory, chemotactic, and inflammatory processes must be initiated

网站地图