Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Caleb Doxsey

Rating No ratings yet

This book is a short, concise introduction to computer programming using the language Go. Designed by Google, Go is a general purpose programming language with modern features, clean syntax and a robust well-documented common library, making it an ideal language to learn as your first programming language. Contents 1 Getting Started 1 1.1 Files and Folders 2 1.2 The Terminal 5 1.3 Text Editors 9 1.4 Go Tools 13 2 Your First Program 15 2.1 How to Read a Go Program 17 3 Types 23 3.1 Numbers 24 3.2 Strings 29 3.3 Booleans 31 4 Variables 35 4.1 How to Name a Variable 39 4.2 Scope 40 4.3 Constants 43 4.4 Defining Multiple Variables 44 4.5 An Example Program 45 5 Control Structures 47 5.1 For 48 5.2 If 51 5.3 Switch 55 6 Arrays, Slices and Maps 58 6.1 Arrays 58 6.2 Slices 64 6.3 Maps 67 7 Functions 76 7.1 Your Second Function 77 7.2 Returning Multiple Values 82 7.3 Variadic Functions 82 7.4 Closure 84 7.5 Recursion 86 7.6 Defer, Panic & Recover 88 8 Pointers 92 8.1 The * and & operators 93 8.2 new 94 9 Structs and Interfaces 97 9.1 Structs 98 9.2 Methods 101 9.3 Interfaces 104 10 Concurrency 108 10.1 Goroutines 108 10.2 Channels 111 11 Packages 120 11.1 Creating Packages 121 11.2 Documentation 124 12 Testing 127 13 The Core Packages 132 13.1 Strings 132 13.2 Input / Output 134 13.3 Files & Folders 135 13.4 Errors 140 13.5 Containers & Sort 141 13.6 Hashes & Cryptography 144 13.7 Servers 147 13.8 Parsing Command Line Arguments 155 13.9 Synchronization Primitives 156 14 Next Steps 159 14.1 Study the Masters 159 14.2 Make Something 160 14.3 Team Up 161

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

Brief outline
【One-Line Pitch】 This book is a short, concise introduction to computer programming using the language Go. Designed by Google, Go is a… 【Book Arc】 - **Opening (~0%–12%)**: 书名: An Introduction to Programming in Go (Caleb Doxsey)(Z-Library) 作者: Caleb Doxsey This book is…; Like on Windows example.txt is the file name, it is contained in the folder john, which is in the folder Users. - **Early (~12%–35%)**: here and save it as main.go in the folder we just created.; If we wanted to use the Exit function from the os package what would we need to do? - **Middle (~35%–65%)**: If statements also have an optional else part.; ould also need to change both of these parts. - **Late (~65%–88%)**: One way to do this is to use a special data type known as a pointer: 92 Pointers 94 variable.; or der they were defined: i с : Circle{e, е, 5} Fields We сап access fields using the . - **Ending (~88%–100%)**: nil { return } defer dir.Close() fileInfos, err : dir.Readdir(-1) if err !; The non-cryptographic hash functions can be found underneath the hash package and include adler32, crc32, crc64 and fnv. 【Key Takeaways】 - **书名: An Introduction to…** (Opening): 书名: An Introduction to Programming in Go (Caleb Doxsey)(Z-Library) 作者: Caleb Doxsey This book is… - **Like on Windows exampl…** (Opening): Like on Windows example.txt is the file name, it is contained in the folder john, which is in the folder Users. - **is: By default the ter…** (Opening): is: By default the terminal starts in your home directory. - **here and save it as ma…** (Early): here and save it as main.go in the folder we just created. - **If we wanted to use th…** (Early): If we wanted to use the Exit function from the os package what would we need to do? - **Try running the following** (Early): Try running the following: 39 Variables x : "Hello World" Notice the : before the and that no type was speci- fied. 【Reading Tips】 - Use Passage locations below to jump into the text and set reading anchors - Chinese and English guides are each generated once, then served from local cache without calling the model again 【Coverage Limits】 Compressed outline without the model (~21 index chunks). Full structured guide needs AI available.
Page 4
Creating Packages 121 11.2 Documentation 124 12 Testing 127 13 The Core Packages 132 13.1 Strings 132 13.2 Input / Output 134 13.3 Files & Folders 135 13.4 E...
View in text
Excerpt 2
n the fmt package. If we wanted to use the Exit function from the os package what would we need to do? 5. Modify the program we wrote so that instead of prin...
View in text
Excerpt 3
hat other functions can access this variable: Variables 44 const x string = "Hello World" x = "Some other string" Results in a compile-time error: .\main.go:...
View in text
Excerpt 4
Go includes two built-in functions to assist with slices: append and copy. Here is an example of append: func main() { slice1 := []int{1,2,3} slice2 := appen...
View in text
Excerpt 5
total } func main() { fmt.Println(add(1,2,3)) } By using ... before the type name of the last parame- ter you can indicate that it takes zero or more of thos...
View in text
Excerpt 6
ge programs are often made ир of many smaller sub-programs. For example а web server handles re quests made from web browsers and serves ир HTML web pages in...
View in text
Excerpt 7
le to make sure the file is closed as soon as the function 139 The Core Packages package main import ( "fmt" "os" ) func main() { dir, err := os.Open(".") if...
View in text
Excerpt 8
this with the go command: go run myfile.go run and myfile.go are arguments. We can also pass flags to a command: go run -v myfile.go The flag package allows...
View in text
Tags
AI categories
AI
ISBN: 1478355824
Publish Year: 2012
Language: English
Pages: 165
File Format: PDF
File Size: 11.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…