Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Go
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mastering Go

Mastering Go - Second Edition

By : Mihalis Tsoukalos
4.1 (33)
close
close
Mastering Go

Mastering Go

4.1 (33)
By: Mihalis Tsoukalos

Overview of this book

Often referred to (incorrectly) as Golang, Go is the high-performance systems language of the future. Mastering Go, Second Edition helps you become a productive expert Go programmer, building and improving on the groundbreaking first edition. Mastering Go, Second Edition shows how to put Go to work on real production systems. For programmers who already know the Go language basics, this book provides examples, patterns, and clear explanations to help you deeply understand Go’s capabilities and apply them in your programming work. The book covers the nuances of Go, with in-depth guides on types and structures, packages, concurrency, network programming, compiler design, optimization, and more. Each chapter ends with exercises and resources to fully embed your new knowledge. This second edition includes a completely new chapter on machine learning in Go, guiding you from the foundation statistics techniques through simple regression and clustering to classification, neural networks, and anomaly detection. Other chapters are expanded to cover using Go with Docker and Kubernetes, Git, WebAssembly, JSON, and more. If you take the Go programming language seriously, the second edition of this book is an essential guide on expert techniques.
Table of Contents (15 chapters)
close
close

Finding unreachable Go code

Go code that cannot be executed is a logical error, and therefore it is pretty difficult to reveal it with developers or a normal execution of the Go compiler. Put simply, there is nothing wrong with unreachable code, apart from the fact that there is no way for this code to get executed.

Take a look at the following Go code, which is saved as cannotReach.go:

package main 
import ( 
    "fmt" 
) 
 
func f1() int { 
    fmt.Println("Entering f1()") 
    return -10 
    fmt.Println("Exiting f1()") 
    return -1 
} 
 
func f2() int { 
    if true { 
        return 10 
    } 
    fmt.Println("Exiting f2()") 
    return 0 
} 
 
func main() { 
    fmt.Println(f1()) 
    fmt.Println("Exiting program...") 
} 

There is nothing syntactically incorrect with the Go code of cannotReach.go. As a result, you can execute...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering Go
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon