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
Tags
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…
Loading comments...
Reply to Comment
Edit Comment