Learning Go programming : an insightful guide to learning the Go programming language /
Annotation
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt,
2016.
|
Temas: | |
Acceso en línea: | Texto completo Texto completo |
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.
- 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.