The Go Programming Language
The Go Programming Language
- 作者: Brian W. Kernighan
- 简介:
- 出版时间:
- ISBN:
- 分类:
- 出版社: Addison-Wesley Professional
- 字数: 0
- 在线阅读: 微信读书
- 划线数量: 48
- 想法数量: 32
笔记
The Origins of Go
📌 beget
💭 beget | BrE bɪˈɡɛt, AmE bəˈɡɛt |
transitive verb present participle begetting past tense begot | bɪˈɡɒt | or archaic begat | bɪˈɡæt | ; past participle begotten | bɪˈɡɒtn |
① archaic (father) 成为…之父
▸ they hoped that the king might beget an heir by his new queen
他们希望国王新娶的王后可以为他生一位继承人
② literary (bring about) 引起
▸ violence begets more violence
暴力招致暴力
- ⏱ 2024-01-29 14:26:35 ^19836794-7OA3CsHdq
📌 offspring
💭 offspring | BrE ˈɒfsprɪŋ, AmE ˈɔfˌsprɪŋ,ˈɑfˌsprɪŋ |
noun plural offspring
(of animal) 幼仔; (of human) 子女
- ⏱ 2024-01-29 14:26:57 ^19836794-7OA3DYGgK
📌 incorporate
💭 incorporate | BrE ɪnˈkɔːpəreɪt, AmE ɪnˈkɔrpəˌreɪt |
transitive verb
① (include) 纳入 ‹thoughts, suggestions›; 收录 ‹revision, feature›
② Business, Law 合并 ‹business, company›
- ⏱ 2024-01-29 14:27:34 ^19836794-7OA3GuUmN
📌 communicating sequential processes (CSP)
- ⏱ 2024-01-17 01:00:58 ^3-3339-3386
📌 In CSP, a program is a parallel composition of processes that have no shared state; the processes communicate and synchronize using channels.
- ⏱ 2024-01-17 13:10:41 ^3-3505-3646
📌 reminiscent
💭 reminiscent | BrE ˌrɛmɪˈnɪsnt, AmE ˌrɛməˈnɪs(ə)nt |
adjective
① (absorbed in memories) 怀旧的 ‹mood, smile›
② predicative (suggestive) 引人联想的
▸ to be reminiscent of sth/sb;
让人联想到某事物/某人
▸ his style is vaguely reminiscent of Matisse
他的风格隐约使人联想起马蒂斯
- ⏱ 2024-01-15 12:17:05 ^19836794-7OeCO0jkq
The Go Project
📌 frustration
💭 frustration | BrE frʌˈstreɪʃn, AmE frəˈstreɪʃ(ə)n |
noun
① uncountable (irritated feeling) 失望
▸ to suffer from frustration
感到失望
▸ frustration at or with sth;
对某事感到的失望
▸ to vent one’s frustration (on sb/sth);
(在某人/某物身上)出气
② countable (irritating thing) 令人沮丧的事物
▸ the frustrations of doing sth;
做某事的不如意
③ (of attempt, effort) 沮丧
④ uncountable (in job, role) 不满意
⑤ uncountable (of plans, ambition) 受挫
▸ the frustration of sb’s hopes
某人希望的落空
⑥ (sexual) 性方面的不满足
- ⏱ 2024-01-15 15:35:02 ^19836794-7OePLP3T2
📌 As Rob Pike put it, “complexity is multiplicative”: fixing a problem by making one part of the system more complex slowly but surely adds complexity to other parts. With constant pressure to add features and options and configurations, and to ship code quickly, it’s easy to neglect simplicity, even though in the long run simplicity is the key to good software.
- ⏱ 2024-01-15 15:42:14 ^4-1393-1778
📌 pernicious
💭 pernicious | BrE pəˈnɪʃəs, AmE pərˈnɪʃəs |
adjective
有害的
▸ a pernicious lie
恶毒的谎言
▸ a pernicious disease
恶疾
▸ to be pernicious to sth;
对某事物有害
- ⏱ 2024-01-15 15:43:11 ^19836794-7OeQiWm10
📌 accommodated
💭 accommodate | BrE əˈkɒmədeɪt, AmE əˈkɑməˌdeɪt |
A.transitive verb
① (provide space for) 为…提供住宿 ‹guests›; 容纳 ‹passengers›
▸ how many cars will the car park accommodate?
这个停车场能停多少辆车?
▸ the site can accommodate 10 factories
这个地方能建10座工厂
② (adapt to) 适应
③ formal (meet request of) 为…提供便利 ‹client›; 关照 ‹interests›
▸ I think I can accommodate you
我想我可以为你提供方便
B.to accommodate oneself reflexive verb
▸ to accommodate oneself to sb/sth;
使自己适应某人/某事物
▸ it took a long time for me to accommodate myself to the notion
我花了很长时间才接受了这个观念
- ⏱ 2024-01-15 15:44:35 ^19836794-7OeQoAVnc
📌 compromising
💭 compromise | BrE ˈkɒmprəmʌɪz, AmE ˈkɑmprəˌmaɪz |
A.noun
① countable (settlement) 妥协
▸ to make or reach or come to a compromise
达成妥协
▸ to agree to a compromise
同意达成妥协
▸ he was the compromise candidate, not anybody’s first choice
他是个折中的候选人,并不是任何人的首选
▸ a compromise plan/proposal
折中计划/提议
② uncountable (willingness to settle) 妥协态度
B.intransitive verb
妥协
▸ to compromise on sth;
在某事上作出让步
C.transitive verb
① (threaten) 危及
▸ she was much compromised by the gossip surrounding her divorce
关于她离婚的闲言碎语令她声誉受到很大损害
② (weaken) «person» 减少 ‹chances, hope›; «person» 在…上让步 ‹principles›; «event» 损害 ‹reputation›
▸ to compromise success
减少成功的机会
D.to compromise oneself reflexive verb
使自己受到损害
- ⏱ 2024-01-15 15:46:20 ^19836794-7OeQvHDq4
📌 agenda
💭 agenda | BrE əˈdʒɛndə, AmE əˈdʒɛndə |
noun
① Administration 议事日程
▸ to be on the agenda
列入日程表
② figurative (list of priorities) 工作事项
▸ a hidden or secret agenda
秘密事项
▸ unemployment is high on the political agenda
失业是重要的政治议题
- ⏱ 2024-01-15 18:27:23 ^19836794-7Of13Dvx4
📌 hindsight
💭 hindsight | BrE ˈhʌɪn(d)sʌɪt, AmE ˈhaɪn(d)ˌsaɪt |
noun uncountable
事后聪明
▸ with (the benefit of) hindsight
事后一想
- ⏱ 2024-01-15 18:27:50 ^19836794-7Of15v74a
📌 first-class functions
💭 In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens.
This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures. Some programming language theorists require support for anonymous functions (function literals) as well.
In languages with first-class functions, the names of functions do not have any special status; they are treated like ordinary variables with a function type. The term was coined by Christopher Strachey in the context of “functions as first-class citizens” in the mid-1960s.
- ⏱ 2024-01-15 18:30:22 ^19836794-7Of1fLzxO
📌 lexical
💭 lexical | BrE ˈlɛksɪkl, AmE ˈlɛksək(ə)l |
adjective
词汇的
- ⏱ 2024-01-15 18:43:36 ^19836794-7Of27xPzo
📌 immutable
💭 immutable | BrE ɪˈmjuːtəbl, AmE ɪ(m)ˈmjudəb(ə)l,əˈmjudəb(ə)l |
adjective
formal 不可改变的 ‹fact, decision›
- ⏱ 2024-01-15 18:44:16 ^19836794-7Of2aeD99
📌 text is generally encoded in UTF-8
- ⏱ 2024-01-15 18:44:29 ^4-3181-3215
📌 no generics
💭 Go 1.18版本增加了对泛型的支持。
- ⏱ 2024-01-15 20:15:14 ^19836794-7Of87zgQM
📌 plague
💭 plague | BrE pleɪɡ, AmE pleɪɡ |
A.noun
① uncountable Medicine (epidemic) 瘟疫; (bubonic plague) 鼠疫
▸ a plague of typhoid/cholera
伤寒/霍乱瘟疫
▸ a plague epidemic/bacterium/vaccine
瘟疫流行/病菌/疫苗
▸ the Great Plague
大瘟疫 [1665-1666年主要在英国伦敦流行的黑死病]
▸ to avoid sb/sth like the plague
informal 极力回避某人/某事物
② countable (large number) 灾祸
▸ a plague of locusts/rats/muggers
蝗灾/鼠害/抢劫祸患
③ countable informal (annoying person) 讨厌的人; (annoying thing) 令人烦恼的事物
▸ the noise is a constant plague to the residents
噪音一直烦扰着居民
▸ that dog is a real plague!
那只狗实在讨厌!
B.transitive verb
① (beset) 困扰
▸ to be plagued with or by sth
为某事物所困扰
▸ the computer is plagued with or by technical faults
这台计算机频频出现技术故障
▸ we were plagued with or by wasps
我们为黄蜂所困扰
② (harass) 纠缠
▸ to plague sb with questions/complaints;
不断提问题/发牢骚烦扰某人
▸ to plague sb for sth;
缠着某人要求某事物
▸ to plague sb to do sth;
缠着某人做某事
▸ to plague the life out of sb
informal 把某人烦得要死
- ⏱ 2024-01-15 20:18:07 ^19836794-7Of8jiQwy
📌 go to the lengths
💭 B.lengths plural noun
(extent, measures) 程度
▸ to go to great/any/such lengths (to do sth)
(为做某事)不遗余力
▸ they went to absurd lengths to keep the affair secret
他们为了对这件事保密无所不用其极
▸ to go to the lengths of doing sth
到做某事的程度
▸ he even went to the lengths of writing to the Queen
他甚至给女王写了信
- ⏱ 2024-01-15 20:31:36 ^19836794-7Of9c4iQk
📌 The variable-size stacks of Go’s lightweight threads or goroutines are initially small enough that creating one goroutine is cheap and creating a million is practical.
- ⏱ 2024-01-16 00:21:40 ^4-5566-5761
📌 batteries included
- ⏱ 2024-01-16 00:22:03 ^4-6158-6176
Organization of the Book
📌 slices, Go’s approach to dynamic lists
- ⏱ 2024-01-16 00:26:38 ^5-2456-2501
📌 imperative
💭 imperative /ɪmˈperətɪv/
a. 必要的;紧急的;极重要的
a. 命令(式)的;必须服从的,强制的;专横的
a. 具抑制(或控制、支配)力的
a. 【语】命令的,祈使的
n. 必要的事;紧急的事;必须履行的责任;需要,必要性
n. 命令;规则
n. 【语】祈使语气;祈使语气动词
- ⏱ 2024-01-16 00:28:03 ^19836794-7OfoGb5Uo
📌 Go has an unusual approach to object-oriented programming. There are no class hierarchies, or indeed any classes; complex object behaviors are created from simpler ones by composition, not inheritance. Methods may be associated with any user-defined type, not just structures, and the relationship between concrete types and abstract types (interfaces) is implicit, so a concrete type may satisfy an interface that the type’s designer was unaware of.
- ⏱ 2024-01-16 00:30:12 ^5-3511-4011
📌 laden
💭 laden /ˈleɪdən/
• lade的过去分词
a. 装满的;充满了的
a. 负担沉重的;苦恼的
/ˈleɪdən/
- ⏱ 2024-01-16 10:12:26 ^19836794-7Og0X575I
📌 atop
💭 atop /əˈtɒp/
prep. 在…顶上
ad. 在顶上
- ⏱ 2024-01-16 10:12:58 ^19836794-7Og0Zhv7X
📌 gory
💭 /ˈɡɔːrɪ/
a. 沾满血污的;血迹斑斑的;血淋淋的
a. 血块似的
a. 血流成渠的;流血的
a. 令人毛骨悚然的,骇人听闻的;残忍的;令人不快的
- ⏱ 2024-01-16 12:45:17 ^19836794-7OgaXJzkI
Where to Find More Information
- ⏱ 2024-01-16 19:21:59 ^6-983-1006
📌 blog.golang.org
- ⏱ 2024-01-16 19:22:11 ^6-1374-1394
📌 play.golang.org
- ⏱ 2024-01-16 19:22:47 ^6-2142-2162
📌 read-eval-print loop (REPL)
- ⏱ 2024-01-16 19:23:24 ^6-2803-2837
📌 tour.golang.org
- ⏱ 2024-01-16 19:24:21 ^6-3211-3231
📌 elaborate
💭 /ɪˈlæbərət/
a. 精心计划(或制作)的;精巧的;详尽的
a. 复杂的
a. (煞费)苦心的,刻苦的,辛勤的
vt. 精心制作;详细搞出;详尽阐述;发挥;发展
vt. 使(食物或简单成分)变成复杂有机物;由简单成分合成为(复杂有机物)
vi. 详述;详尽计划(on,upon)
vi. 变得复杂
- ⏱ 2024-01-16 19:25:02 ^19836794-7OgB8WcPf
Acknowledgments
📌 invaluable
💭 /ɪnˈvæljʊəbl/
a. 非常宝贵的;极为贵重的,无价的;无法估价的
a. ⟨古⟩没有价值的,无用的
- ⏱ 2024-01-16 19:26:13 ^19836794-7OgBdKqG8
📌 went far beyond the call of duty
- ⏱ 2024-01-16 19:26:38 ^7-1134-1166
📌 meticulous
💭 /mɪˈtɪkjʊləs, mə-/
a. 过分注意细节的;谨小慎微的
a. ⟨口⟩非常仔细的,非常注意细节的;一丝不苟的,严谨的
- ⏱ 2024-01-16 19:27:05 ^19836794-7OgBhgX4m
📌 indebted
💭 /ɪnˈdetɪd/
a. 受惠的,蒙恩的;感激的(to)
a. 负债的(to)
- ⏱ 2024-01-16 19:27:30 ^19836794-7OgBiXj9m
1.1 Hello, World
📌 Go is a compiled language. The Go toolchain converts a source program and the things it depends on into instructions in the native machine language of a computer.
- ⏱ 2024-01-17 13:33:37 ^9-2239-2401
📌 Go natively handles Unicode, so it can process text in all the world’s languages.
- ⏱ 2024-01-17 16:10:12 ^9-3628-3832
📌 Go code is organized into packages, which are similar to libraries or modules in other languages. A package consists of one or more .gosource files in a single directory that define what the package does. Each source file begins with a package declaration, here package main, that states which package the file belongs to, followed by a list of other packages that it imports, and then the declarations of the program that are stored in that file.
- ⏱ 2024-01-17 14:50:51 ^9-5822-6371
📌 Package main is special. It defines a standalone executable program, not a library. Within package main the functionmain is also special—it’s where execution of the program begins. Whatever main does is what the program does.
- ⏱ 2024-01-17 14:51:49 ^9-7324-7706
📌 You must import exactly the packages you need. A program will not compile if there are missing imports or if there are unnecessary ones. This strict requirement prevents references to unused packages from accumulating as programs evolve.
- ⏱ 2024-01-17 16:15:37 ^9-8593-8960
📌 fiat
💭 /ˈfaɪæt/
n. 命令;法令
n. 批准,许可;授权
n. (思想上的)决断,裁决
vt. 批准
vt. 以命令宣布,颁布
- ⏱ 2024-01-17 17:11:22 ^19836794-7OhYHnl8P
📌 infeasible
💭 /ɪnˈfiːzəbl/
a. 不能实行的,行不通的,办不到的
- ⏱ 2024-01-17 17:11:58 ^19836794-7OhYJN7iV
1.2 Command-Line Arguments
📌 The os package provides functions and other values for dealing with the operating system in a platform-independent fashion.
- ⏱ 2024-01-17 17:13:10 ^10-1588-1760
📌 contiguous
💭 /kənˈtɪɡjʊəs/
a. 共边的;互相接触着的
a. 毗邻的;【数】相邻的
a. (时间或顺序上)紧接的;邻近的
a. 包含在同一边界之内的,连续不断的,连成一片的
- ⏱ 2024-01-17 17:13:54 ^19836794-7OhYREjBf
📌 half-open intervals
- ⏱ 2024-01-17 17:14:30 ^10-2822-2848
📌 include the first index but exclude the last
- ⏱ 2024-01-17 17:14:45 ^10-2877-2921
📌 The first element of os.Args, os.Args[0], is the name of the command itself; the other elements are the arguments that were presented to the program when it started execution.
- ⏱ 2024-01-17 17:16:04 ^10-3491-3718
📌 If m or n is omitted, it defaults to 0 or len(s) respectively
- ⏱ 2024-01-17 17:17:17 ^10-4008-4147
📌 By convention, we describe each package in a comment immediately preceding its package declaration; for a main package, this comment is one or more complete sentences that describe the program as a whole.
- ⏱ 2024-01-17 17:19:58 ^10-7134-7364
📌 zero value
- ⏱ 2024-01-17 17:53:04 ^10-7886-7903
📌 assignment operator
- ⏱ 2024-01-17 17:55:11 ^10-10154-10180
📌 quadratic
💭 /kwɒˈdrætɪk/
a. 【数】二次的,平方的
a. (似)正方形的
n. 【数】二次方程;二次式
- ⏱ 2024-01-17 18:01:06 ^19836794-7Oi1XiKjD
📌 :=
- ⏱ 2024-01-17 18:02:21 ^10-11669-11677
📌 short variable declaration
- ⏱ 2024-01-17 18:02:11 ^10-11718-11751
📌 These are statements, not expressions as they are in most languages in the C family, so j = i++ is illegal, and they are postfix only, so –i is not legal either.
- ⏱ 2024-01-17 18:07:57 ^10-12462-12907
📌 postfix
💭 /ˈpəʊstfɪks/
n. 【语】后缀
vt. 【语】加…作后缀
vt. 【生】对(组织等)作后固定处理,再次用固定剂处理
- ⏱ 2024-01-17 18:07:46 ^19836794-7Oi2olTVy
📌 initialization statement
- ⏱ 2024-01-18 18:49:39 ^10-14367-14403
📌 condition is a boolean expression
- ⏱ 2024-01-18 18:49:55 ^10-14683-14728
📌 post statement
- ⏱ 2024-01-18 18:50:29 ^10-14944-14970
📌 blank identifier
- ⏱ 2024-01-18 18:51:49 ^10-19718-19734
📌 The blank identifier may be used whenever syntax requires a variable name but program logic does not, for instance to discard an unwanted loop index when we require only the element value.
- ⏱ 2024-01-19 00:33:48 ^10-19834-20022
📌 In practice, you should generally use one of the first two forms, with explicit initialization to say that the initial value is important and implicit initialization to say that the initial value doesn’t matter.
- ⏱ 2024-01-19 00:35:16 ^10-21935-22424
📌 The old contents of s are no longer in use, so they will be garbage-collected in due course.
- ⏱ 2024-01-19 09:58:21 ^10-22756-22876
📌 the Join function
- ⏱ 2024-01-19 09:58:39 ^10-23229-23272
1.3 Finding Duplicate Lines
📌 on the fly
💭 In a hurry, on the run.
e.g. I picked up some groceries on the fly.
The transfer of this expression, which literally means “in midair or in flight,” dates from the mid-1800s.
- ⏱ 2024-01-22 16:36:23 ^19836794-7OpxXfszr
📌 counts[input.Text()]++
- ⏱ 2024-01-19 15:45:40 ^11-2634-2656
📌 A map holds a set of key/value pairs and provides constant-time operations to store, retrieve, or test for an item in the set. The key may be of any type whose values can be compared with ==, strings being the most common example; the value may be of any type at all.
- ⏱ 2024-01-19 15:44:56 ^11-3710-4054
📌 It’s not a problem if the map doesn’t yet contain that key. The first time a new line is seen, the expression counts[line] on the right-hand side evaluates to the zero value for its type, which is 0 for int.
- ⏱ 2024-01-19 15:45:32 ^11-4959-5271
📌 The order of map iteration is not specified, but in practice it is random, varying from one run to another. This design is intentional, since it prevents programs from relying on any particular ordering where none is guaranteed.
- ⏱ 2024-01-22 17:19:24 ^11-5563-5791
📌 verbs
- ⏱ 2024-02-13 18:46:24 ^11-7784-7796
📌 escape sequences
💭 转义序列
- ⏱ 2024-01-22 17:36:43 ^19836794-7OpBUdCPo
📌 cavalier
💭 cavalier | BrE ˌkavəˈlɪə, AmE ˌkævəˈlɪr |
A.Cavalier proper noun
British History 保王党成员
B.adjective
(offhand) 漫不经心的; (haughty) 傲慢的
▸ to treat sb in a cavalier manner
慢待某人
- ⏱ 2024-01-23 15:52:18 ^19836794-7Or1nqSsa
📌 Functions and other package-level entities may be declared in any order.
- ⏱ 2024-01-23 15:52:41 ^11-16028-16100
📌 A map is a reference to the data structure created by make. When a map is passed to a function, the function receives a copy of the reference, so any changes the called function makes to the underlying data structure will be visible through the caller’s map reference too.
- ⏱ 2024-01-23 15:21:01 ^11-16150-16476
4.5 JSON
📌 JavaScript Object Notation (JSON) is a standard notation for sending and receiving structured information.
- ⏱ 2024-01-21 17:38:11 ^37-678-784