| About the Authors |
|
v | |
| About the Technical Writer |
|
vi | |
| About the Technical Editor |
|
vii | |
| Acknowledgments |
|
viii | |
| Introduction |
|
xxi | |
|
PART I The Basics of the Co Programming Language |
|
|
1 | (172) |
|
Lesson 1 Getting Started with Go |
|
|
3 | (18) |
|
|
|
4 | (4) |
|
Downloading the Installation Files |
|
|
4 | (1) |
|
Starting the Installation of Go |
|
|
5 | (3) |
|
|
|
8 | (2) |
|
Creating a Hello, World! Program |
|
|
10 | (6) |
|
Compiling and Running the Program |
|
|
11 | (2) |
|
|
|
13 | (1) |
|
Troubleshooting Hello, World! |
|
|
14 | (1) |
|
|
|
14 | (2) |
|
|
|
16 | (1) |
|
Online Editor for Go: The Go Playground |
|
|
16 | (2) |
|
|
|
18 | (1) |
|
|
|
18 | (3) |
|
Exercises 1.1 Counting Fun |
|
|
19 | (1) |
|
Exercises 1.2 Counting More Fun |
|
|
20 | (1) |
|
Lesson 2 Understanding Go Basics |
|
|
21 | (18) |
|
Understanding Statements and Tokens |
|
|
22 | (1) |
|
|
|
23 | (2) |
|
|
|
25 | (3) |
|
|
|
26 | (1) |
|
Block or Multi-line Comments |
|
|
27 | (1) |
|
|
|
28 | (4) |
|
|
|
30 | (1) |
|
|
|
31 | (1) |
|
|
|
32 | (1) |
|
|
|
33 | (1) |
|
|
|
33 | (6) |
|
Exercises 2.1 Fixing Problems |
|
|
34 | (1) |
|
Exercises 2.2 Making a Statement |
|
|
35 | (1) |
|
|
|
35 | (1) |
|
Exercises 2.4 Printing Without Repeating |
|
|
36 | (1) |
|
Exercises 2.5 Tagging Your Code |
|
|
37 | (1) |
|
|
|
37 | (2) |
|
Lesson 3 Storing with Variables |
|
|
39 | (30) |
|
|
|
40 | (4) |
|
|
|
41 | (1) |
|
Declaring and Initializing Variables |
|
|
42 | (1) |
|
Declaring and Initializing One Variable |
|
|
42 | (1) |
|
Declaring Multiple Variables |
|
|
43 | (1) |
|
Declaring and Initializing Multiple Variables |
|
|
44 | (1) |
|
Static vs. Dynamic Type Declaration |
|
|
44 | (4) |
|
Mixing Types of Declarations |
|
|
46 | (1) |
|
Mixing Type Declarations in a Single Statement |
|
|
47 | (1) |
|
|
|
48 | (2) |
|
|
|
50 | (3) |
|
|
|
50 | (1) |
|
|
|
51 | (2) |
|
Converting a String to a Number |
|
|
53 | (4) |
|
|
|
57 | (7) |
|
Architecture-Independent Integer Types |
|
|
58 | (2) |
|
|
|
60 | (1) |
|
Implementation-Specific Integer Types |
|
|
61 | (1) |
|
|
|
62 | (2) |
|
|
|
64 | (1) |
|
|
|
64 | (5) |
|
Exercises 3.1 Fixing Problems |
|
|
64 | (1) |
|
Exercises 3.2 Creating Variables |
|
|
65 | (1) |
|
Exercises 3.3 Fewer Lines |
|
|
65 | (1) |
|
Exercises 3.4 How It Is Assigned |
|
|
65 | (1) |
|
Exercises 3.5 Conversions |
|
|
65 | (1) |
|
Exercises 3.6 State Your State |
|
|
66 | (1) |
|
Exercises 3.7 Where You Live |
|
|
66 | (1) |
|
|
|
66 | (1) |
|
Exercises 3.9 Assigning Types |
|
|
66 | (3) |
|
Lesson 4 Performing Operations |
|
|
69 | (30) |
|
|
|
70 | (8) |
|
|
|
72 | (1) |
|
|
|
73 | (2) |
|
|
|
75 | (3) |
|
|
|
78 | (3) |
|
Addition and Subtraction Assignment Operations |
|
|
78 | (2) |
|
Multiplication, Division, and Modulus Assignment Operations |
|
|
80 | (1) |
|
|
|
81 | (1) |
|
|
|
82 | (4) |
|
Assigning Values to Boolean Variables |
|
|
84 | (1) |
|
Using Mismatched Types in Relational Operations |
|
|
84 | (2) |
|
|
|
86 | (2) |
|
|
|
88 | (2) |
|
|
|
90 | (1) |
|
|
|
91 | (3) |
|
Limiting the Possible Value |
|
|
92 | (1) |
|
Seeding the Random Number Generator |
|
|
93 | (1) |
|
|
|
94 | (1) |
|
|
|
95 | (4) |
|
Exercises 4.1 Resulting in 0 |
|
|
95 | (1) |
|
|
|
96 | (1) |
|
Exercises 4.3 Current Value of Deposit |
|
|
96 | (1) |
|
Exercises 4.4 Simple Interest |
|
|
96 | (1) |
|
Exercises 4.5 True and False |
|
|
97 | (1) |
|
Exercises 4.6 Functioning Math |
|
|
97 | (1) |
|
Exercises 4.7 Five Times the Basic Math |
|
|
97 | (1) |
|
Exercises 4.8 Using Relational Operators |
|
|
98 | (1) |
|
Exercises 4.9 Random Limits |
|
|
98 | (1) |
|
Lesson 5 Controlling Program Flow with Conditional Statements |
|
|
99 | (24) |
|
|
|
100 | (1) |
|
|
|
100 | (4) |
|
Working with Multiple Conditions |
|
|
104 | (1) |
|
Using an if-elseStatement |
|
|
105 | (2) |
|
Creating Nested//Statements |
|
|
107 | (2) |
|
|
|
109 | (8) |
|
Executing More than One Case with fallthrough |
|
|
111 | (3) |
|
Using Multiple Expressions in One Case |
|
|
114 | (1) |
|
Using Conditions in Switch Cases |
|
|
115 | (2) |
|
|
|
117 | (1) |
|
|
|
117 | (6) |
|
Exercises 5.1 Are You Rich? |
|
|
117 | (1) |
|
Exercises 5.2 Cat vs. Dog |
|
|
118 | (1) |
|
|
|
118 | (1) |
|
|
|
118 | (1) |
|
Exercises 5.5 Switching the Seasons |
|
|
119 | (1) |
|
Exercises 5.6 Quiz Generator |
|
|
119 | (1) |
|
Exercises 5.7 Coffee Shop |
|
|
119 | (4) |
|
Lesson 6 Controlling Program Flow with Loops |
|
|
123 | (22) |
|
|
|
124 | (1) |
|
|
|
125 | (7) |
|
Optional Items in a for Loop |
|
|
128 | (1) |
|
|
|
129 | (2) |
|
|
|
131 | (1) |
|
|
|
132 | (2) |
|
|
|
134 | (1) |
|
|
|
135 | (4) |
|
|
|
136 | (1) |
|
|
|
137 | (1) |
|
|
|
138 | (1) |
|
|
|
139 | (1) |
|
|
|
140 | (5) |
|
Exercises 6.1 The Alphabet |
|
|
140 | (1) |
|
|
|
141 | (1) |
|
|
|
141 | (1) |
|
Exercises 6.4 Numeric Breakout |
|
|
141 | (1) |
|
|
|
141 | (1) |
|
Exercises 6.6 Length Without len |
|
|
141 | (1) |
|
Exercises 6.7 Guessing Game |
|
|
142 | (1) |
|
Exercises 6.8 URL Shortener |
|
|
142 | (1) |
|
Exercises 6.9 Validating Phone Numbers |
|
|
142 | (1) |
|
Exercises 6.10 Validating Email Addresses |
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
143 | (2) |
|
Lesson 7 Pulling It All Together: Income Tax Calculator |
|
|
145 | (28) |
|
|
|
146 | (1) |
|
Step 1 Gather Requirements |
|
|
146 | (2) |
|
|
|
147 | (1) |
|
|
|
147 | (1) |
|
|
|
148 | (1) |
|
Step 2 Design the Program |
|
|
148 | (1) |
|
|
|
148 | (2) |
|
Step 4 Calculate the Taxable Income |
|
|
150 | (2) |
|
Step 5 Calculate the Tax Rate |
|
|
152 | (12) |
|
Add a Conditional Statement |
|
|
154 | (2) |
|
Create Nested Conditionals |
|
|
156 | (8) |
|
Step 6 Update the Application |
|
|
164 | (4) |
|
What About Negative Taxable Incomes? |
|
|
166 | (2) |
|
Does Code Compare to Standards? |
|
|
168 | (1) |
|
|
|
168 | (3) |
|
|
|
171 | (1) |
|
|
|
172 | (1) |
|
PART II Organizing Code and Data in Co |
|
|
173 | (204) |
|
|
|
175 | (20) |
|
|
|
175 | (10) |
|
|
|
177 | (2) |
|
Functions with No Return Values |
|
|
179 | (1) |
|
Functions with Multiple Return Values |
|
|
180 | (1) |
|
Returning Different Types |
|
|
181 | (2) |
|
|
|
183 | (1) |
|
|
|
184 | (1) |
|
|
|
185 | (1) |
|
|
|
186 | (1) |
|
|
|
187 | (1) |
|
|
|
188 | (2) |
|
|
|
190 | (1) |
|
|
|
191 | (4) |
|
Exercises 8.1 Creating Your Own Functions |
|
|
191 | (1) |
|
|
|
191 | (1) |
|
Exercises 8.3 What Does the Fox Say? |
|
|
192 | (1) |
|
Exercises 8.4 Using Recursion |
|
|
192 | (1) |
|
Exercises 8.5 Fibonacci Function |
|
|
192 | (1) |
|
Exercises 8.6 A Calculator |
|
|
192 | (3) |
|
Lesson 9 Accessing Arrays |
|
|
195 | (20) |
|
|
|
196 | (7) |
|
Assigning a Value to an Array Element |
|
|
196 | (2) |
|
|
|
198 | (3) |
|
Similarity of an Array Element and Variable |
|
|
201 | (2) |
|
Declaring and Initializing an Array |
|
|
203 | (1) |
|
|
|
204 | (1) |
|
Using a for Loop to Define an Array |
|
|
205 | (1) |
|
Using Range with an Array |
|
|
206 | (1) |
|
Creating Multidimensional Arrays |
|
|
207 | (2) |
|
|
|
209 | (1) |
|
|
|
210 | (2) |
|
|
|
212 | (1) |
|
|
|
212 | (3) |
|
|
|
212 | (1) |
|
Exercises 9.2 Th ree Arrays |
|
|
213 | (1) |
|
|
|
213 | (1) |
|
Exercises 9.4 Moving from One to Another |
|
|
213 | (1) |
|
Exercises 9.5 Forward and Backward |
|
|
213 | (1) |
|
Exercises 9.6 Two Dimensions of Four |
|
|
213 | (1) |
|
Exercises 9.7 Duplicating |
|
|
214 | (1) |
|
Exercises 9.8 Personal Data |
|
|
214 | (1) |
|
Lesson 10 Working with Pointers |
|
|
215 | (22) |
|
|
|
215 | (7) |
|
|
|
217 | (1) |
|
Declaring and Initializing a Pointer |
|
|
218 | (1) |
|
|
|
219 | (1) |
|
Pointers of Different Types |
|
|
219 | (3) |
|
Accessing the Stored Value of a Pointer |
|
|
222 | (1) |
|
Understanding nil Pointers |
|
|
223 | (2) |
|
Using Pointers to Change Variables |
|
|
225 | (1) |
|
|
|
226 | (1) |
|
Working with an Array of Pointers |
|
|
227 | (3) |
|
Changing Values in an Array |
|
|
229 | (1) |
|
Using Pointers with Functions |
|
|
230 | (2) |
|
Changing Values from a Function |
|
|
231 | (1) |
|
|
|
232 | (1) |
|
|
|
233 | (4) |
|
Exercises 10.1 Name, Age, and Gender |
|
|
233 | (1) |
|
Exercises 10.2 User Input |
|
|
233 | (1) |
|
Exercises 10.3 Playing with Pointers |
|
|
234 | (1) |
|
|
|
235 | (1) |
|
Exercises 10.5 What's It Doing? |
|
|
235 | (1) |
|
|
|
236 | (1) |
|
|
|
236 | (1) |
|
Lesson 11 Organizing with Structs |
|
|
237 | (26) |
|
Declaring and Initializing a Struct |
|
|
238 | (4) |
|
Retrieving Values from a Struct |
|
|
239 | (1) |
|
Initializing a Struct When Declaring |
|
|
240 | (1) |
|
Using the Short Assignment Operator |
|
|
241 | (1) |
|
Using Key-Value Pairs with Structs |
|
|
242 | (3) |
|
|
|
245 | (2) |
|
|
|
247 | (1) |
|
|
|
248 | (2) |
|
Adding Methods to a Struct |
|
|
250 | (2) |
|
|
|
252 | (2) |
|
|
|
254 | (2) |
|
|
|
256 | (1) |
|
|
|
256 | (7) |
|
Exercises 11.1 Addressing an Envelope |
|
|
257 | (1) |
|
|
|
257 | (1) |
|
|
|
257 | (1) |
|
Exercises 11.4 Address Book |
|
|
257 | (1) |
|
Exercises 11.5 Passing a Struct |
|
|
258 | (1) |
|
Exercises 11.6 Nesting Practice |
|
|
258 | (1) |
|
Exercises 11.7 Burger Shop |
|
|
259 | (2) |
|
|
|
261 | (2) |
|
Lesson 12 Accessing Slices |
|
|
263 | (24) |
|
|
|
264 | (1) |
|
|
|
265 | (3) |
|
|
|
266 | (1) |
|
|
|
267 | (1) |
|
Changing the Size of a Slice |
|
|
268 | (2) |
|
Iterating Through a Slice |
|
|
270 | (1) |
|
|
|
271 | (1) |
|
Creating a Slice Variable with var |
|
|
272 | (1) |
|
Working with Slice Elements |
|
|
273 | (5) |
|
Replacing an Element in a Slice |
|
|
273 | (1) |
|
Working with Empty Slices |
|
|
274 | (1) |
|
Working with a Section of a Slice |
|
|
275 | (2) |
|
|
|
277 | (1) |
|
Appending to a Slice Using the append Function |
|
|
278 | (1) |
|
|
|
278 | (2) |
|
Creating a Slice Using the new Keyword |
|
|
280 | (2) |
|
Removing an Item from a Slice |
|
|
282 | (1) |
|
|
|
283 | (1) |
|
|
|
283 | (4) |
|
|
|
284 | (1) |
|
Exercises 12.2 Count the Letters |
|
|
284 | (1) |
|
Exercises 12.3 An Average Word |
|
|
284 | (1) |
|
Exercises 12.4 Student Names |
|
|
285 | (1) |
|
|
|
285 | (1) |
|
Exercises 12.6 Slicing Numbers Together |
|
|
285 | (2) |
|
Lesson 13 Manipulating Maps |
|
|
287 | (18) |
|
|
|
287 | (4) |
|
|
|
289 | (1) |
|
|
|
290 | (1) |
|
|
|
291 | (1) |
|
Creating a Map Using make |
|
|
292 | (2) |
|
|
|
294 | (1) |
|
|
|
294 | (2) |
|
|
|
296 | (2) |
|
|
|
298 | (1) |
|
|
|
299 | (2) |
|
Literal Declarations in Maps |
|
|
301 | (1) |
|
|
|
302 | (1) |
|
|
|
302 | (3) |
|
Exercises 13.1 Creating Your Own Map |
|
|
303 | (1) |
|
Exercises 13.2 User Input |
|
|
303 | (1) |
|
|
|
303 | (1) |
|
Exercises 13.4 Does It Exist? |
|
|
303 | (1) |
|
Exercises 13.5 State Populations |
|
|
304 | (1) |
|
Exercises 13.6 Keyword Search |
|
|
304 | (1) |
|
Lesson 14 Creating Methods |
|
|
305 | (20) |
|
|
|
305 | (2) |
|
|
|
307 | (2) |
|
Using Pointers with Methods |
|
|
309 | (3) |
|
|
|
312 | (2) |
|
Working with Value Receivers and Arguments |
|
|
314 | (3) |
|
Working with Pointer Receivers and Arguments |
|
|
317 | (2) |
|
|
|
319 | (1) |
|
|
|
320 | (5) |
|
Exercises 14.1 Functioning with Integers |
|
|
320 | (1) |
|
Exercises 14.2 Methods with Integers |
|
|
321 | (1) |
|
Exercises 14.3 Volume of a Solid |
|
|
321 | (1) |
|
Exercises 14.4 Banking Terminal |
|
|
321 | (1) |
|
|
|
321 | (1) |
|
|
|
322 | (1) |
|
|
|
322 | (1) |
|
|
|
323 | (1) |
|
|
|
323 | (2) |
|
Lesson 15 Adding Interfaces |
|
|
325 | (18) |
|
|
|
325 | (3) |
|
Interfaces and Code Reusability |
|
|
328 | (2) |
|
Static vs. Dynamic Interface Types |
|
|
330 | (2) |
|
|
|
332 | (1) |
|
Checking an Interface Type |
|
|
332 | (2) |
|
|
|
334 | (3) |
|
|
|
337 | (2) |
|
|
|
339 | (1) |
|
|
|
339 | (4) |
|
Exercises 15.1 Rectangle Sides |
|
|
340 | (1) |
|
Exercises 15.2 Rectangle Space |
|
|
340 | (1) |
|
Exercises 15.3 Rectangle Borders |
|
|
340 | (1) |
|
Exercises 15.4 Triangles and Rectangles |
|
|
341 | (1) |
|
Exercises 15.5 Circles and Other Shapes |
|
|
341 | (2) |
|
Lesson 16 Pulling It All Together: Building a Burger Shop |
|
|
343 | (34) |
|
Requirements for Our Application |
|
|
344 | (1) |
|
|
|
344 | (1) |
|
|
|
345 | (14) |
|
|
|
346 | (4) |
|
|
|
350 | (2) |
|
|
|
352 | (2) |
|
|
|
354 | (3) |
|
|
|
357 | (2) |
|
Creating the Helper Functions |
|
|
359 | (5) |
|
|
|
361 | (1) |
|
|
|
362 | (1) |
|
|
|
363 | (1) |
|
|
|
364 | (1) |
|
|
|
364 | (3) |
|
|
|
367 | (1) |
|
The Full Burger Shop Listing |
|
|
367 | (10) |
|
PART III Creating Job Ready Solutions in Co |
|
|
377 | (148) |
|
Lesson 17 Handling Errors |
|
|
379 | (16) |
|
|
|
379 | (1) |
|
|
|
380 | (2) |
|
|
|
382 | (1) |
|
|
|
383 | (2) |
|
|
|
385 | (2) |
|
|
|
387 | (1) |
|
Error Messages with Structs |
|
|
388 | (2) |
|
Multiple Custom Error Messages |
|
|
390 | (3) |
|
|
|
393 | (1) |
|
|
|
393 | (2) |
|
Exercises 17.1 Not an Error |
|
|
394 | (1) |
|
Exercises 17.2 Greedy Withdrawal |
|
|
394 | (1) |
|
Exercises 17.3 Extending the Banking Application |
|
|
394 | (1) |
|
Exercises 17.4 On Your Own |
|
|
394 | (1) |
|
|
|
395 | (26) |
|
|
|
395 | (5) |
|
The Role of the Operating System |
|
|
396 | (1) |
|
Problems with Concurrency |
|
|
397 | (1) |
|
|
|
398 | (2) |
|
|
|
400 | (2) |
|
|
|
400 | (1) |
|
Preventing Problems with Parallelism |
|
|
401 | (1) |
|
|
|
402 | (3) |
|
|
|
405 | (3) |
|
|
|
408 | (4) |
|
Creating a Channel Using make |
|
|
409 | (1) |
|
|
|
409 | (2) |
|
|
|
411 | (1) |
|
Channels with Multiple Coroutines |
|
|
412 | (1) |
|
|
|
413 | (2) |
|
Iterating Through a Channel |
|
|
415 | (2) |
|
|
|
417 | (1) |
|
|
|
418 | (3) |
|
Exercises 18.1 Counting Up and Down |
|
|
418 | (1) |
|
Exercises 18.2 Passing to a Goroutine |
|
|
418 | (1) |
|
Exercises 18.3 Rolling the Die |
|
|
419 | (1) |
|
Exercises 18.4 Rolling the Dice |
|
|
419 | (2) |
|
Lesson 19 Sorting and Data Processing |
|
|
421 | (32) |
|
|
|
422 | (7) |
|
|
|
423 | (2) |
|
|
|
425 | (2) |
|
|
|
427 | (2) |
|
|
|
429 | (16) |
|
|
|
431 | (1) |
|
|
|
432 | (2) |
|
|
|
434 | (1) |
|
Determining Date Differences |
|
|
435 | (1) |
|
Adding a Duration to a Date/Time |
|
|
436 | (2) |
|
Adding Hours, Minutes, and Seconds |
|
|
438 | (1) |
|
Adding Years, Months, and Days |
|
|
439 | (2) |
|
|
|
441 | (2) |
|
|
|
443 | (1) |
|
Formatting Standard Times |
|
|
443 | (2) |
|
|
|
445 | (3) |
|
|
|
448 | (1) |
|
|
|
448 | (5) |
|
Exercises 19.1 Sorting Floats |
|
|
448 | (1) |
|
Exercises 19.2 Sorting Student Grades |
|
|
449 | (1) |
|
Exercises 19.3 Knowing What Time It Is |
|
|
449 | (1) |
|
Exercises 19.4 Working with Dates |
|
|
449 | (1) |
|
Exercises 19.5 String Searching |
|
|
450 | (1) |
|
Exercises 19.6 More String Searching |
|
|
450 | (1) |
|
Exercises 19.7 Date-Time Calculator |
|
|
450 | (1) |
|
Calculator 1 Time Duration |
|
|
451 | (1) |
|
Calculator 2 Add Time to or Subtract Time from a Date |
|
|
452 | (1) |
|
Calculator 3 Age Calculator |
|
|
452 | (1) |
|
Lesson 20 File I/O and OS Operations |
|
|
453 | (32) |
|
|
|
454 | (11) |
|
|
|
456 | (1) |
|
Reading a Subset of a File |
|
|
457 | (2) |
|
|
|
459 | (1) |
|
Reading a File from a Specific Starting Point |
|
|
460 | (1) |
|
|
|
461 | (1) |
|
Reading a File Line by Line |
|
|
462 | (3) |
|
|
|
465 | (5) |
|
|
|
467 | (1) |
|
|
|
468 | (2) |
|
|
|
470 | (9) |
|
|
|
471 | (1) |
|
|
|
472 | (1) |
|
Creating a Directory Tree |
|
|
473 | (1) |
|
Listing Directory Contents |
|
|
474 | (1) |
|
|
|
475 | (2) |
|
Temporary Files and Directories |
|
|
477 | (2) |
|
|
|
479 | (1) |
|
|
|
480 | (1) |
|
|
|
481 | (4) |
|
Exercises 20.1 Text Filing |
|
|
481 | (1) |
|
Exercises 20.2 Jumping Around |
|
|
482 | (1) |
|
Exercises 20.3 Counting Letters |
|
|
482 | (1) |
|
Exercises 20.4 Copying a File |
|
|
482 | (1) |
|
Exercises 20.5 Copying a File, Take 2 |
|
|
482 | (1) |
|
Exercises 20.6 Burger Shop |
|
|
483 | (2) |
|
Lesson 21 Pulling It All Together: Word Analysis in Co |
|
|
485 | (40) |
|
|
|
486 | (2) |
|
|
|
488 | (9) |
|
|
|
495 | (2) |
|
Tokenizing an Input String |
|
|
497 | (5) |
|
Identifying and Replacing Punctuation with a Space |
|
|
498 | (2) |
|
Converting Input Text to Lowercase |
|
|
500 | (1) |
|
Splitting the String into Words |
|
|
501 | (1) |
|
Creating a Tokenize Function |
|
|
502 | (2) |
|
Tokenizing an Input Review |
|
|
503 | (1) |
|
Tokenizing the Entire Dataset |
|
|
504 | (1) |
|
Counting the Words in Each Review |
|
|
504 | (2) |
|
Tokenizing and Counting the Reviews |
|
|
506 | (3) |
|
|
|
509 | (11) |
|
Improvement 1 Improving the Structs |
|
|
509 | (1) |
|
|
|
510 | (2) |
|
|
|
512 | (1) |
|
|
|
512 | (2) |
|
|
|
514 | (1) |
|
Improvement 2 Adding Custom Error and Exception Handling |
|
|
515 | (1) |
|
Improvement 3 Improving Tokenizing |
|
|
516 | (2) |
|
Improvement 4 Improving Word Counting |
|
|
518 | (2) |
|
Possible Further Improvements |
|
|
520 | (1) |
|
|
|
520 | (4) |
|
|
|
524 | (1) |
|
PART IV Advanced Topics for Co Development |
|
|
525 | (126) |
|
|
|
527 | (34) |
|
|
|
527 | (1) |
|
|
|
528 | (1) |
|
|
|
529 | (2) |
|
|
|
530 | (1) |
|
|
|
530 | (1) |
|
|
|
531 | (3) |
|
|
|
531 | (1) |
|
|
|
531 | (2) |
|
|
|
533 | (1) |
|
Tutorial: Test-Driven Development |
|
|
534 | (21) |
|
First Test: String Representation of Dollar Amount |
|
|
535 | (1) |
|
|
|
535 | (1) |
|
|
|
536 | (1) |
|
|
|
536 | (1) |
|
Second Test: Test with Other Values |
|
|
537 | (1) |
|
|
|
537 | (1) |
|
|
|
538 | (1) |
|
|
|
539 | (1) |
|
|
|
540 | (1) |
|
Third Test: Operation Output |
|
|
540 | (1) |
|
|
|
540 | (1) |
|
|
|
541 | (1) |
|
|
|
542 | (1) |
|
|
|
543 | (1) |
|
Refactor Subtract FormatAmount |
|
|
544 | (1) |
|
|
|
545 | (1) |
|
|
|
545 | (1) |
|
|
|
545 | (1) |
|
|
|
546 | (1) |
|
Fourth Test: Include Subtraction |
|
|
546 | (1) |
|
|
|
547 | (2) |
|
|
|
549 | (1) |
|
|
|
550 | (1) |
|
Final Tests: Look at input Values |
|
|
550 | (1) |
|
|
|
551 | (1) |
|
|
|
551 | (2) |
|
|
|
553 | (1) |
|
|
|
554 | (1) |
|
Behavior-Driven Development |
|
|
555 | (4) |
|
Goals of Behavior-Driven Development |
|
|
555 | (1) |
|
|
|
556 | (1) |
|
|
|
557 | (1) |
|
|
|
558 | (1) |
|
|
|
558 | (1) |
|
Executable Specifications |
|
|
558 | (1) |
|
|
|
559 | (1) |
|
|
|
559 | (2) |
|
Exercises 22.1 Breaking the Square |
|
|
559 | (1) |
|
Exercises 22.2 Adding More to Dollar |
|
|
559 | (2) |
|
Lesson 23 API Development Tutorial |
|
|
561 | (30) |
|
Overview and Requirements |
|
|
561 | (1) |
|
Step 1 Create the Dataset and a Simple API |
|
|
562 | (9) |
|
|
|
563 | (1) |
|
|
|
564 | (1) |
|
|
|
565 | (1) |
|
Handling and Routing Incoming Requests |
|
|
565 | (1) |
|
|
|
566 | (1) |
|
Executing the Request Handler |
|
|
566 | (2) |
|
|
|
568 | (3) |
|
Step 2 Add a Router Gorilla Mux |
|
|
571 | (3) |
|
|
|
574 | (4) |
|
Retrieving a Specific Record |
|
|
574 | (1) |
|
|
|
575 | (3) |
|
|
|
578 | (6) |
|
|
|
584 | (4) |
|
|
|
588 | (1) |
|
|
|
588 | (3) |
|
|
|
589 | (1) |
|
Exercises 23.2 Student Name |
|
|
589 | (1) |
|
Exercises 23.3 Going Local |
|
|
589 | (2) |
|
Lesson 24 Working with gRPC |
|
|
591 | (16) |
|
|
|
592 | (1) |
|
|
|
592 | (3) |
|
|
|
592 | (1) |
|
|
|
593 | (1) |
|
|
|
593 | (1) |
|
|
|
594 | (1) |
|
|
|
595 | (1) |
|
|
|
595 | (1) |
|
|
|
596 | (1) |
|
Creating the Chat Service |
|
|
597 | (2) |
|
Updating the Server Code to Include the Chat Service |
|
|
599 | (1) |
|
Creating the chat Package |
|
|
600 | (1) |
|
|
|
601 | (2) |
|
Running the Server and the Client |
|
|
603 | (1) |
|
|
|
604 | (1) |
|
|
|
604 | (3) |
|
Exercises 24.1 Chat Assistant |
|
|
604 | (1) |
|
Exercises 24.2 The Real Weather |
|
|
605 | (1) |
|
Exercises 24.3 Adding Stock |
|
|
605 | (2) |
|
Lesson 25 Pulling It All Together: Using Smart Data |
|
|
607 | (38) |
|
|
|
608 | (1) |
|
|
|
608 | (3) |
|
Implementing the gRPC Server |
|
|
611 | (24) |
|
The Geolocation Server Shell |
|
|
612 | (4) |
|
Accessing Google Location Data |
|
|
616 | (1) |
|
|
|
617 | (2) |
|
Updating client_geolocation.go |
|
|
619 | (2) |
|
|
|
621 | (3) |
|
Accessing Yahoo Finance Quotes |
|
|
624 | (3) |
|
Signing Up for a Yahoo Finance API Key |
|
|
627 | (1) |
|
Querying the Yahoo Finance API Programmatically |
|
|
627 | (4) |
|
|
|
631 | (2) |
|
|
|
633 | (2) |
|
|
|
635 | (9) |
|
Implementing the getCeoLocationData Endpoints |
|
|
637 | (1) |
|
Implementing the getQuote Endpoint |
|
|
638 | (1) |
|
|
|
639 | (5) |
|
|
|
644 | (1) |
|
|
|
645 | (6) |
|
Getting Started with Modules |
|
|
645 | (1) |
|
Step 1 Create the Project Directory |
|
|
645 | (1) |
|
Step 2 Create Your Program(s) |
|
|
646 | (1) |
|
Step 3 Create a Test Program |
|
|
647 | (1) |
|
Step 4 Create the go.modFile |
|
|
647 | (1) |
|
|
|
648 | (1) |
|
|
|
648 | (1) |
|
|
|
649 | (1) |
|
|
|
649 | (1) |
|
|
|
649 | (2) |
|
Exercises 26.1 Shouting Text |
|
|
650 | (1) |
|
Exercises 26.2 Shouting Correctly |
|
|
650 | (1) |
|
|
|
650 | (1) |
|
Exercises 26.4 On Your Own |
|
|
650 | (1) |
| Appendix: File Permissions and Access Rights |
|
651 | (4) |
| Index |
|
655 | |