Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorAgus Kurniawan

Go, commonly referred to as golang, is a programming language initially developed at Google in 2007. This book helps you to get started with Go programming. It describes all the elements of the language and illustrates their use with code examples. The following is highlight topics in this book: * Development Environment * Go Programming Language * Arrays, Slices and Maps * Functions * Pointers * Structs and Methods * String Operations * File Operations * Error Handling and Logging * Building Own Go Package * Concurrency * Encoding * Hashing and Cryptography * Database Programming * Socket Programming

AI Reading Assistant

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

AI guide
【One-Line Pitch】 A hands-on, example-first introduction to Go for programmers who want to get productive quickly: every concept is demonstrated with a short, runnable program you can build and run yourself. Best for developers new to Go who already know at least one programming language and prefer learning by typing code rather than reading theory. 【Book Arc】 - **Opening (~0%–11%)**: Sets up the Go toolchain and environment (installing Go, PATH/GOPATH configuration, editor choices like vim, nano, IntelliJ IDEA, Sublime), then introduces core language basics — variables, comments, math functions, decisions, loops, and break/continue. - **Early (~11%–28%)**: Moves into data structures and functions: arrays (including 2D), maps, simple and multi-return functions, variadic parameters, closures, and recursion (Fibonacci). - **Middle (~28%–44%)**: Covers pointers and a from-scratch singly linked list, structs and methods (with a Circle geometry example), and string operations — concatenation, parsing with Split, case conversion, length, slicing, and numeric-to-string conversion. - **Late (~44%–61%)**: Shifts to practical I/O and engineering topics: file read/write with the io/ioutil packages, error handling and logging (defer, panic, recover, log package), and building your own Go package/module using GOPATH layout. - **Ending (~61%–100%)**: Advanced applied topics — concurrency (goroutines, synchronization with locks, channels), encoding (Base64, hex, JSON, XML, CSV), hashing and cryptography (MD5, SHA256, HMAC, symmetric/asymmetric crypto), database programming, and socket programming. 【Key Takeaways】 - **Go basics are taught through runnable mini-projects** (Opening): variables, conditionals, loops, and math are each paired with a folder-based demo (e.g., mathdemo) you build and run with `go build` / `go run`. - **Collections and functions form the early core** (Early): arrays, maps, multi-return functions, variadic parameters, closures, and recursion are all illustrated with complete code, making this section the language's practical foundation. - **Pointers unlock data structures** (Middle): the book uses a singly linked list built from scratch to show how pointers and structs combine into real structures, not just syntax. - **Structs and methods model real objects** (Middle): a Circle example demonstrates defining methods, computing area/circumference, and mutating state via moveTo. - **String handling is treated as a practical toolkit** (Middle): concatenation, Split-based parsing, case conversion, slicing, and numeric conversion are shown as everyday operations. - **File I/O and error handling are the bridge to real programs** (Late): reading/writing files with ioutil, plus defer/panic/recover and the log package, move you beyond toy examples. - **Packaging is explained via GOPATH layout** (Late): creating reusable modules and importing them (simplemodule/simplemoduletest) teaches project organization. - **Concurrency is the book's advanced centerpiece** (Ending): goroutines, mutex-based synchronization, and channels are demonstrated with background tasks and shared-state examples. - **Applied domains round out the book** (Ending): encoding formats, hashing/cryptography, database access, and socket programming show Go's use beyond the language itself. 【Reading Tips】 - **Skim the environment setup** (Opening) if you already have Go installed; focus instead on the language chapters where the real learning happens. - **Type and run every example** — this is an example-driven book, and the value comes from executing the code, not just reading it. - **Deep-read concurrency and packaging** (Late/Ending): these are the hardest and most transferable topics; the goroutine/lock examples deserve careful tracing. - **Treat the applied chapters (encoding, crypto, database, sockets) as a menu** — read the ones relevant to your work rather than linearly. - **Watch for GOPATH-era conventions**: the packaging chapter reflects older Go tooling, so cross-check against modern Go modules if you're on a recent version. 【Coverage Limits】 This guide is based on stratified excerpts covering the book's table of contents and sample code through the concurrency chapter; the database and socket programming chapters are listed but their detailed content is not covered in the excerpts. Specific figures, outputs, and some chapter subsections are not fully represented.
Page 12
n add GO installation path, for instance my Go installation path is c:/go/bin, into PATH variable on Environment Variables. 1.2 Development Tools Basically,...
View in text
Excerpt 2
// insert data fmt.Println(">>>>>insert map data") products["product1"] = rand.Intn(100) products["product2"] = rand.Intn(100) customers["cust1"] = rand.Intn...
View in text
Excerpt 3
e a singly linked list from scratch. You can read your Data Structure book to understand what singly linked list is. You also read it on Wikipedia, http://en...
View in text
Excerpt 4
testgo.txt",bytes,0644) fmt.Println("created a file") } func readFile(){ data, _ := ioutil.ReadFile("d:/temp/testgo.txt") fmt.Println("file content:") fmt.Pr...
View in text
Excerpt 5
ultiply(5,3) fmt.Printf("multiply()=%d\n",c) } Save all. Now you can compile and run this program. $ cd simplemathtest $ go build $ go run main.go You can se...
View in text
Excerpt 6
\n",newEmp.Email) fmt.Printf("CountryCode: %s\n",newEmp.Country.CountryCode) fmt.Printf("CountryName: %s\n",newEmp.Country.CountryName) 12.6 CSV The last dem...
View in text
Excerpt 7
ey := "this is key 1234" message := "Hello world, go!" encrypted := encrypt_symmetric_crpyto(key,message) This code will generate two files, private.rsa.key...
View in text
Excerpt 8
if err != nil { fmt.Println("Error reading:", err.Error()) } fmt.Println("Received: ",string(buff[:msgLen])) conn.Close() } It uses port 9982. You can change...
View in text
Tags
AI categories
GoProgramming LanguageBackend
Publisher: PE Press
Publish Year: 2015
Language: English
Pages: 136
File Format: PDF
File Size: 5.5 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…