Learning Go programming an insightful guide to learning the Go programming language

An insightful guide to learning the Go programming language About This Book Insightful coverage of Go programming syntax, constructs, and idioms to help you understand Go code effectively Push your Go skills, with topics such as, data types, channels, concurrency, object-oriented Go, testing, and ne...

Descripción completa

Detalles Bibliográficos
Otros Autores: Vivien, Vladimir, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England ; Mumbai, India : Packt Publishing 2016.
Edición:1st edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630165906719
Tabla de Contenidos:
  • Cover
  • Copyright
  • Credits
  • About the Author
  • About the Reviewers
  • www.PacktPub.com
  • Table of Contents
  • Preface
  • Chapter 1: A First Step in Go
  • The Go programming language
  • Playing with Go
  • No IDE required
  • Installing Go
  • Source code examples
  • Your first Go program
  • Go in a nutshell
  • Functions
  • Packages
  • The workspace
  • Strongly typed
  • Composite types
  • The named type
  • Methods and objects
  • Interfaces
  • Concurrency and channels
  • Memory management and safety
  • Fast compilation
  • Testing and code coverage
  • Documentation
  • An extensive library
  • The Go Toolchain
  • Summary
  • Chapter 2: Go Language Essentials
  • The Go source file
  • Optional semicolon
  • Multiple lines
  • Go identifiers
  • The blank identifier
  • Muting package imports
  • Muting unwanted function results
  • Built-in identifiers
  • Types
  • Values
  • Functions
  • Go variables
  • Variable declaration
  • The zero-value
  • Initialized declaration
  • Omitting variable types
  • Short variable declaration
  • Restrictions for short variable declaration
  • Variable scope and visibility
  • Variable declaration block
  • Go constants
  • Constant literals
  • Typed constants
  • Untyped constants
  • Assigning untyped constants
  • Constant declaration block
  • Constant enumeration
  • Overriding the default enumeration type
  • Using iota in expressions
  • Skipping enumerated values
  • Go operators
  • Arithmetic operators
  • The increment and decrement operators
  • Go assignment operators
  • Bitwise operators
  • Logical Operators
  • Comparison operators
  • Operator precedence
  • Summary
  • Chapter 3: Go Control Flow
  • The if statement
  • The if statement initialization
  • Switch statements
  • Using expression switches
  • The fallthrough cases
  • Expressionless switches
  • Switch initializer
  • Type switches
  • The for statements
  • For condition.
  • Infinite loop
  • The traditional for statement
  • The for range
  • The break, continue, and goto statements
  • The label identifier
  • The break statement
  • The continue statement
  • The goto statement
  • Summary
  • Chapter 4: Data Types
  • Go types
  • Numeric types
  • Unsigned integer types
  • Signed integer types
  • Floating point types
  • Complex number types
  • Numeric literals
  • Boolean type
  • Rune and string types
  • The rune
  • The string
  • Interpreted and raw string literals
  • Pointers
  • The pointer type
  • The address operator
  • The new() function
  • Pointer indirection - accessing referenced values
  • Type declaration
  • Type conversion
  • Summary
  • Chapter 5: Functions in Go
  • Go functions
  • Function declaration
  • The function type
  • Variadic parameters
  • Function result parameters
  • Named result parameters
  • Passing parameter values
  • Achieving pass-by-reference
  • Anonymous Functions and Closures
  • Invoking anonymous function literals
  • Closures
  • Higher-order functions
  • Error signaling and handling
  • Signaling errors
  • Error handling
  • The error type
  • Deferring function calls
  • Using defer
  • Function panic and recovery
  • Function panic
  • Function panic recovery
  • Summary
  • Chapter 6: Go Packages and Programs
  • The Go package
  • Understanding the Go package
  • The workspace
  • Creating a workspace
  • The import path
  • Creating packages
  • Declaring the package
  • Multi-File packages
  • Naming packages
  • Use globally unique namespaces
  • Add context to path
  • Use short names
  • Building packages
  • Installing a package
  • Package visibility
  • Package member visibility
  • Importing package
  • Specifying package identifiers
  • The dot identifier
  • The blank identifier
  • Package initialization
  • Creating programs
  • Accessing program arguments
  • Building and installing programs
  • Remote packages.
  • Summary
  • Chapter 7: Composite Types
  • The array type
  • Array initialization
  • Declaring named array types
  • Using arrays
  • Array length and capacity
  • Array traversal
  • Array as parameters
  • The slice type
  • Slice initialization
  • Slice representation
  • Slicing
  • Slicing a slice
  • Slicing an array
  • Slice expressions with capacity
  • Making a slice
  • Using slices
  • Slices as parameters
  • Length and capacity
  • Appending to slices
  • Copying slices
  • Strings as slices
  • The map type
  • Map initialization
  • Making Maps
  • Using maps
  • Map traversal
  • Map functions
  • Maps as parameters
  • The struct type
  • Accessing struct fields
  • Struct initialization
  • Declaring named struct types
  • The anonymous field
  • Promoted fields
  • Structs as parameters
  • Field tags
  • Summary
  • Chapter 8: Methods, Interfaces, and Objects
  • Go methods
  • Value and pointer receivers
  • Objects in Go
  • The struct as object
  • Object composition
  • Field and method promotion
  • The constructor function
  • The interface type
  • Implementing an interface
  • Subtyping with Go interfaces
  • Implementing multiple interfaces
  • Interface embedding
  • The empty interface type
  • Type assertion
  • Summary
  • Chapter 9: Concurrency
  • Goroutines
  • The go statement
  • Goroutine scheduling
  • Channels
  • The Channel type
  • The send and receive operations
  • Unbuffered channel
  • Buffered channel
  • Unidirectional channels
  • Channel length and capacity
  • Closing a channel
  • Writing concurrent programs
  • Synchronization
  • Streaming data
  • Using for…range to receive data
  • Generator functions
  • Selecting from multiple channels
  • Channel timeout
  • The sync package
  • Synchronizing with mutex locks
  • Synchronizing access to composite values
  • Concurrency barriers with sync.WaitGroup
  • Detecting race conditions
  • Parallelism in Go
  • Summary.
  • Chapter 10: Data IO in Go
  • IO with readers and writers
  • The io.Reader interface
  • Chaining readers
  • The io.Writer interface
  • Working with the io package
  • Working with files
  • Creating and opening files
  • Function os.OpenFile
  • Files writing and reading
  • Standard input, output, and error
  • Formatted IO with fmt
  • Printing to io.Writer interfaces
  • Printing to standard output
  • Reading from io.Reader
  • Reading from standard input
  • Buffered IO
  • [Buffered writers and readers]
  • Buffered writers and readers
  • Scanning the buffer
  • In-memory IO
  • Encoding and decoding data
  • Binary encoding with gob
  • Encoding data as JSON
  • Controlling JSON mapping with struct tags
  • Custom encoding and decoding
  • Summary
  • Chapter 11: Writing Networked Services
  • The net package
  • Addressing
  • The net.Conn Type
  • Dialing a connection
  • Listening for incoming connections
  • Accepting client connections
  • A TCP API server
  • Connecting to the TCP server with telnet
  • Connecting to the TCP server with Go
  • The HTTP package
  • The http.Client type
  • Configuring the client
  • Handling client requests and responses
  • A simple HTTP server
  • The default server
  • Routing requests with http.ServeMux
  • The default ServeMux
  • A JSON API server
  • Testing the API server with cURL
  • An API server client in Go
  • A JavaScript API server client
  • Summary
  • Chapter 12: Code Testing
  • The Go test tool
  • Test file names
  • Test organization
  • Writing Go tests
  • The test functions
  • Running the tests
  • Filtering executed tests
  • Test logging
  • Reporting failure
  • Skipping tests
  • Table-driven tests
  • HTTP testing
  • Testing HTTP server code
  • Testing HTTP client code
  • Test coverage
  • The cover tool
  • Code benchmark
  • Running the benchmark
  • Skipping test functions
  • The benchmark report
  • Adjusting N.
  • Comparative benchmarks
  • Summary
  • Index.