Chapter 1 ◾ Getting Started with Go
Go PROGRAMMING FEATURES
WHY IS GoLang BETTER THAN THE OTHER PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGES?
BEGINNING WITH Go
INSTALL Go ON WINDOWS
WRITING THE FIRST Go PROGRAM
TERMINAL
INSTALL Go ON MAC
IN GoLang, HOW DO WE CREATE AN EMPTY FILE?
CREATE A DIRECTORY IN Go
Chapter 2 ◾ GoLang Tools
HOW TO READ AND WRITE PROGRAMS IN Go
IN GoLang, HOW TO RENAME AND MOVE A FILE
HOW TO READ FILES LINE BY LINE TO STRING
Chapter 3 ◾ Data Types
BASIC SYNTAX
Tokens
Line Separator
Comments
Identifiers
Keywords
Whitespace
DATA TYPES IN Go
Numbers
Floating Point Numbers
Complex Numbers
Booleans
Strings
Chapter 4 ◾ Variables and Constants
VARIABLES IN Go
Declaring a Variable
Using the var Keyword
Using the Short Variable Declaration
CONSTANTS
How Should We Declare?
Untyped and Typed Numeric Constants
Numeric Constant
String Literals
Boolean Constant
VARIABLE SCOPE IN Go
Local Variables
Global Variables
DECLARATION OF MULTIPLE VARIABLES
Shorthand Declaration
Chapter 5 ◾ Operators and Control Structures
OPERATORS IN Go
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc Operators
CONTROL STATEMENTS
if Statement
if...else Statement
Nested if Statement
if..else..if Ladder
Go LANGUAGE LOOPS
Go SWITCH STATEMENT
Expression Switch
Type Switch
Chapter 6 ◾ Arrays, Slices, and Maps
ARRAYS
SLICES
STRINGS
MAPS
Chapter 7 ◾ Functions and Recursion
Go LANGUAGE FUNCTIONS
FUNCTION RETURNING MULTIPLE VALUES
VARIADIC FUNCTIONS
DEFER KEYWORD
PANIC IN GoLang
RECOVER
CLOSURE
RECURSION
Chapter 8 ◾ Pointers
GoLang POINTERS
POINTERS TO A FUNCTION
POINTER TO A STRUCT
POINTER TO POINTER (DOUBLE POINTER) IN Go
COMPARING POINTERS
Chapter 9 ◾ Structs and Interfaces
GoLang STRUCTURES
GoLang’s NESTED STRUCTURE
GoLang’s ANONYMOUS STRUCTURE AND FIELD
GoLang METHODS
INTERFACES
EMBEDDING INTERFACES
INHERITANCE
POLYMORPHISM USING INTERFACES
Chapter 10 ◾ Concurrency and Goroutines
GOROUTINES – CONCURRENCY IN GoLang
SELECT STATEMENT
MULTIPLE GOROUTINES
GoLang CHANNEL
UNIDIRECTIONAL CHANNEL
Chapter 11 ◾ Packages in GoLang
PACKAGES IN GoLang
Workspace
Packages
Main Package
Importing Packages
Installing Third-Party Packages
Init Function
Important Considerations
Giving the Packages Names
Code Exported
DOCUMENTATION
Chapter 12 ◾ The Core Packages
STRING
INPUT/OUTPUT (I/O)
FILES AND FOLDERS
ERRORS
CONTAINERS AND SORTING
List
SORT
HASHES AND CRYPTOGRAPHY
SERVERS
HTTP
RPC
PARSING THE COMMAND LINE ARGUMENTS
SYNCHRONIZATION PRIMITIVES
Mutexes
Mastering GoLang helps readers quickly understand the core concepts and then move on to practical projects using the Go programming language.
GoLang is often dubbed a game-changer in the world of programming languages. Instead of starting from scratch, Go was created using the C programming language. GoLang inherits C’s disciplined grammar but with specific tweaks and enhancements to properly manage memory. This lessens the memory leakage problems that developers tend to face with C.
Go borrows and adapts notions from various programming languages while skipping characteristics that result in complicated, insecure, and unpredictable code. Go’s concurrency features are well-suited to build the infrastructure for gigantic projects such as networking systems and distributed hardware. Go is also often employed in domains such as visuals, mobile applications, and Machine Learning.
Even though GoLang is a relatively new language, it has been adopted by several major organizations owing to its benefits, which include code clarity, custom libraries, adaptability, multithreading, and a simple build process. Because Go is gaining traction in the development community, learning GoLang can open up new avenues across various fields and career trajectories.
Since it is still a relatively newer language, quality literature pertaining to Go is often hard to find. This particular book covers all the bases that you might need, and is an ideal companion for beginner-level developers looking to master Go programming.
With Mastering GoLang, learning GoLang becomes an easy task, and learners can use their skills to create innovative projects.
The Mastering Computer Science series is edited by Sufyan bin Uzayr, a writer and educator with over a decade of experience in the computing field.