Details

Practical Go


Practical Go

Building Scalable Network and Non-Network Applications
1. Aufl.

von: Amit Saha

25,99 €

Verlag: Wiley
Format: PDF
Veröffentl.: 08.11.2021
ISBN/EAN: 9781119773825
Sprache: englisch
Anzahl Seiten: 416

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<p><b>YOUR PRACTICAL, HANDS-ON GUIDE TO WRITING APPLICATIONS USING GO</b></p> <p>Google announced the Go programming language to the public in 2009, with the version 1.0 release announced in 2012. Since its announcement to the community, and the compatibility promise of the 1.0 release, the Go language has been used to write scalable and high-impact software programs ranging from command-line applications and critical infrastructure tools to large-scale distributed systems. It’s speed, simplicity, and reliability make it a perfect choice for developers working in various domains.</p> <p>In <i>Practical Go - Building Scalable Network + Non-Network Applications</i>, you will learn to use the Go programming language to build robust, production-ready software applications. You will learn just enough to building command line tools and applications communicating over HTTP and gRPC.</p> <p>This practical guide will cover:</p> <ul> <li>Writing command line applications</li> <li>Writing a HTTP services and clients</li> <li>Writing RPC services and clients using gRPC</li> <li>Writing middleware for network clients and servers</li> <li>Storing data in cloud object stores and SQL databases</li> <li>Testing your applications using idiomatic techniques</li> <li>Adding observability to your applications</li> <li>Managing configuration data from your applications</li> </ul> <p>You will learn to implement best practices using hands-on examples written with modern practices in mind. With its focus on using the standard library packages as far as possible, <i>Practical Go</i> will give you a solid foundation for developing large applications using Go leveraging the best of the language’s ecosystem.</p>
<p>Introduction xvii</p> <p>Getting Started xxi</p> <p><b>Chapter 1 Writing Command-Line Applications 1</b></p> <p>Your First Application 1</p> <p>Writing Unit Tests 8</p> <p>Using the Flag Package 14</p> <p>Testing the Parsing Logic 20</p> <p>Improving the User Interface 22</p> <p>Removing Duplicate Error Messages 23</p> <p>Customizing Usage Message 24</p> <p>Accept Name via a Positional Argument 25</p> <p>Updating the Unit Tests 28</p> <p>Summary 32</p> <p><b>Chapter 2 Advanced Command-Line Applications 33</b></p> <p>Implementing Sub-commands 33</p> <p>An Architecture for Sub-command-Driven Applications 37</p> <p>Testing the Main Package 43</p> <p>Testing the Cmd Package 45</p> <p>Making Your Applications Robust 47</p> <p>User Input with Deadlines 48</p> <p>Handling User Signals 52</p> <p>Summary 56</p> <p><b>Chapter 3 Writing HTTP Clients 57</b></p> <p>Downloading Data 57</p> <p>Testing the Data Downloader 59</p> <p>Deserializing Received Data 61</p> <p>Sending Data 66</p> <p>Working with Binary Data 72</p> <p>Summary 80</p> <p><b>Chapter 4 Advanced HTTP Clients 81</b></p> <p>Using a Custom HTTP Client 81</p> <p>Downloading from an Overloaded Server 81</p> <p>Testing the Time-Out Behavior 85</p> <p>Configuring the Redirect Behavior 88</p> <p>Customizing Your Requests 91</p> <p>Implementing Client Middleware 92</p> <p>Understanding the RoundTripper Interface 93</p> <p>A Logging Middleware 94</p> <p>Add a Header to All Requests 96</p> <p>Connection Pooling 99</p> <p>Configuring the Connection Pool 103</p> <p>Summary 104</p> <p><b>Chapter 5 Building HTTP Servers 105</b></p> <p>Your First HTTP Server 105</p> <p>Setting Up Request Handlers 108</p> <p>Handler Functions 109</p> <p>Testing Your Server 112</p> <p>The Request Struct 114</p> <p>Method 115</p> <p>Url 115</p> <p>Proto, ProtoMajor, and ProtoMinor 116</p> <p>Header 116</p> <p>Host 116</p> <p>Body 116</p> <p>Form, PostForm 116</p> <p>MultipartForm 117</p> <p>Attaching Metadata to a Request 118</p> <p>Processing Streaming Requests 121</p> <p>Streaming Data as Responses 126</p> <p>Summary 132</p> <p><b>Chapter 6 Advanced HTTP Server Applications 133</b></p> <p>The Handler Type 133</p> <p>Sharing Data across Handler Functions 134</p> <p>Writing Server Middleware 139</p> <p>Custom HTTP Handler Technique 139</p> <p>The HandlerFunc Technique 140</p> <p>Chaining Middleware 142</p> <p>Writing Tests for Complex Server Applications 147</p> <p>Code Organization 147</p> <p>Testing the Handler Functions 153</p> <p>Testing the Middleware 155</p> <p>Testing the Server Startup 157</p> <p>Summary 159</p> <p><b>Chapter 7 Production- Ready HTTP Servers 161</b></p> <p>Aborting Request Handling 161</p> <p>Strategies to Abort Request Processing 165</p> <p>Handling Client Disconnects 169</p> <p>Server-Wide Time- Outs 173</p> <p>Implement a Time- Out for All Handler Functions 173</p> <p>Implementing Server Time- Out 174</p> <p>Implementing Graceful Shutdown 179</p> <p>Securing Communication with TLS 184</p> <p>Configuring TLS and HTTP/2 184</p> <p>Testing TLS Servers 188</p> <p>Summary 192</p> <p><b>Chapter 8 Building RPC Applications with gRPC 193</b></p> <p>gRPC and Protocol Buffers 193</p> <p>Writing Your First Service 197</p> <p>Writing the Server 198</p> <p>Writing a Client 203</p> <p>Testing the Server 207</p> <p>Testing the Client 211</p> <p>A Detour into Protobuf Messages 214</p> <p>Marshalling and Unmarshalling 214</p> <p>Forward and Backward Compatibility 219</p> <p>Multiple Services 220</p> <p>Error Handling 226</p> <p>Summary 228</p> <p><b>Chapter 9 Advanced gRPC Applications 229</b></p> <p>Streaming Communication 229</p> <p>Server- Side Streaming 230</p> <p>Client- Side Streaming 237</p> <p>Bidirectional Streaming 239</p> <p>Receiving and Sending Arbitrary Bytes 247</p> <p>Implementing Middleware Using Interceptors 256</p> <p>Client- Side Interceptors 257</p> <p>Server- Side Interceptors 263</p> <p>Wrapping Streams 269</p> <p>Chaining Interceptors 271</p> <p>Summary 272</p> <p><b>Chapter 10 Production- Ready gRPC Applications 275</b></p> <p>Securing Communication with TLS 275</p> <p>Robustness in Servers 278</p> <p>Implementing Health Checks 278</p> <p>Handling Runtime Errors 286</p> <p>Aborting Request Processing 289</p> <p>Robustness in Clients 297</p> <p>Improving Connection Setup 298</p> <p>Handling Transient Failures 300</p> <p>Setting Time- Outs for Method Calls 305</p> <p>Connection Management 306</p> <p>Summary 309</p> <p><b>Chapter 11 Working with Data Stores 311</b></p> <p>Working with Object Stores 312</p> <p>Integration with Package Server 313</p> <p>Testing Package Uploads 323</p> <p>Accessing Underlying Driver Types 325</p> <p>Working with Relational Databases 327</p> <p>Integration with Package Server 328</p> <p>Testing Data Storage 339</p> <p>Data Type Conversions 343</p> <p>Using Database Transactions 346</p> <p>Summary 348</p> <p>Appendix A Making Your Applications Observable 349</p> <p>Logs, Metrics, and Traces 349</p> <p>Emitting Telemetry Data 352</p> <p>Command- Line Applications 352</p> <p>HTTP Applications 360</p> <p>gRPC Applications 364</p> <p>Summary 366</p> <p>Appendix B Deploying Applications 367</p> <p>Managing Configuration 367</p> <p>Distributing Your Application 370</p> <p>Deploying Server Applications 372</p> <p>Summary 373</p> <p>Index 375</p>
<p><b>Amit Saha</b> is a software engineer at Atlassian, located in Sydney, Australia. He has written <i>Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More!</i> (No Starch Press, 2015) and <i>Write Your First Program</i> (PHI Learning, 2013). His other writings have been published in technical magazines, conference proceedings, and research journals. He can be found <b>online at https://echorand.me</b></p>
<p><b>YOUR PRACTICAL, HANDS-ON GUIDE TO BUILDING APPLICATIONS USING GO</b></p> <p>Google announced the Go programming language to the public in 2009, with the version 1.0 release announced in 2012. Since its announcement to the community, and the compatibility promise of the 1.0 release, the Go language has been used to write scalable and high-impact software programs ranging from command-line applications and critical infrastructure tools to large-scale distributed systems. Its simplicity, rich standard library and a burgeoning ecosystem of third-party packages make it a perfect choice as a general purpose language for software developers.. <p>In <i>Practical Go: Building Scalable Network & Non-Network Applications, </i>you will learn to use the Go programming language to build robust, production-ready software applications. You will learn just enough to building command line tools and applications communicating over HTTP and gRPC. <p><b>This practical guide will cover:</b> <ul><li><b>Writing command line applications</li> <li>Writing HTTP services and clients</li> <li>Writing RPC applications using gRPC</li> <li>Writing middleware for network clients and servers</li> <li>Storing data in cloud object stores and SQL databases</li> <li>Testing your applications using idiomatic techniques</li> <li>Adding observability to your applications</li> <li>Managing configuration data from your applications</b></li></ul>

Diese Produkte könnten Sie auch interessieren:

Domain Architectures
Domain Architectures
von: Daniel J. Duffy
PDF ebook
31,99 €