Table of Contents
List of Tables
- Chapter 1
List of Illustrations
- Chapter 2
- Chapter 5
- Chapter 6
- Chapter 7
- Chapter 8
- Chapter 9
- Chapter 10
- Chapter 11
Guide
Pages
Practical Go
Building Scalable Network and Non-Network Applications
Amit Saha
Copyright 2022 by John Wiley & Sons, Inc. All rights reserved.
Published by John Wiley & Sons, Inc., Hoboken, New Jersey.
Published simultaneously in Canada.
978-1-119-77381-8
978-1-119-77382-5 (ebk.)
978-1-119-77383-2 (ebk.)
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at www.copyright.com
. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permission
.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware the Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com
.
Library of Congress Control Number: 2021948021
Trademarks: WILEY and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
Cover image: cthoman/Getty Images
Cover design: Wiley
I dedicate this book to all those who are working hard every day to find the right balance between the feeling of Yes, I got this! and What am I even doing? and continuing the battle that we call living.
About the Author
Amit Saha is a software engineer at Atlassian, located in Sydney, Australia. He has written Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More! (No Starch Press, 2015) and Write Your First Program (PHI Learning, 2013). His other writings have been published in technical magazines, conference proceedings, and research journals. He can be found online at https://echorand.me
.
About the Technical Editor
John Arundel is a well-known Go writer, teacher, and mentor. He has been writing software for 40 years, and he thinks he's finally starting to figure out how to do it. You can find out more about John at bitfieldconsulting.com
.
John lives in a fairytale cottage in Cornwall, England, surrounded by woods, wildlife, and a slowly deepening silence.
Acknowledgments
I want to thank the entire team at Wiley that made this book possible. First, Jim Minatel, who responded to my initial email expressing interest in publishing a book with Wiley. Jim then connected me with Devon Lewis, with whom I discussed the book proposal and who was instrumental in commissioning this book and overseeing the entire process. Next, I would like to thank Gary Schwartz, who in his capacity as project manager guided me throughout the entire project, ensuring that I was on track with my delivery of the chapters. Thank you, Judy Flynn, for your meticulousness in your role as the copyeditor. Finally, thank you, Barath Kumar Rajasekaran, for overseeing the proofreading process. Working with this team of fine folks was my version of a Ulysses pact.
John Arundel was kind enough to accept my request to be the technical reviewer of this book, and his insights and comments greatly helped to make the book better as well as making me a better Go programmer.
I want to thank all the community members on the Golang nuts and gRPC mailing lists who were always helpful in answering my questions and clarifying my doubts. My initial days of learning Go were mostly spent copying and pasting code from the Go by example project at https://gobyexample.com
; hence I would like to acknowledge the efforts of the creator and maintainers of this project for their super-helpful resource.
Finally, I appreciate the efforts of the folks at Cooperpress who publish Golang Weekly (and the authors of the articles to which they linked) and The Go Time podcast. They helped me in learning Go and staying up to date with the latest happenings in the Go community.
Amit Saha
NOTEA glossary of relevant terms is available for free download from the book's web page: https://www.wiley.com/go/practicalgo
.
Introduction
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. The Go language has made a huge contribution to the growth of a number of modern software success stories. For a number of years, my personal interest in Go has been due to its, for the lack of a better word,
Next page