skip to main content
Skip header Section
The Go Programming LanguageNovember 2015
Publisher:
  • Addison-Wesley Professional
ISBN:978-0-13-419044-0
Published:05 November 2015
Pages:
400
Skip Bibliometrics Section
Bibliometrics
Skip Abstract Section
Abstract

The Go Programming Language is the authoritative resource for any programmer who wants to learn Go. It shows how to write clear and idiomatic Go to solve real-world problems. The book does not assume prior knowledge of Go nor experience with any specific language, so youll find it accessible whether youre most comfortable with JavaScript, Ruby, Python, Java, or C++. The first chapter is a tutorial on the basic concepts of Go, introduced through programs for file I/O and text processing, simple graphics, and web clients and servers. Early chapters cover the structural elements of Go programs: syntax, control flow, data types, and the organization of a program into packages, files, and functions. The examples illustrate many packages from the standard library and show how to create new ones of your own. Later chapters explain the package mechanism in more detail, and how to build, test, and maintain projects using the go tool. The chapters on methods and interfaces introduce Gos unconventional approach to object-oriented programming, in which methods can be declared on any type and interfaces are implicitly satisfied. They explain the key principles of encapsulation, composition, and substitutability using realistic examples. Two chapters on concurrency present in-depth approaches to this increasingly important topic. The first, which covers the basic mechanisms of goroutines and channels, illustrates the style known as communicating sequential processes for which Go is renowned. The second covers more traditional aspects of concurrency with shared variables. These chapters provide a solid foundation for programmers encountering concurrency for the first time. The final two chapters explore lower-level features of Go. One covers the art of metaprogramming using reflection. The other shows how to use the unsafe package to step outside the type system for special situations, and how to use the cgo tool to create Go bindings for C libraries. The book features hundreds of interesting and practical examples of well-written Go code that cover the whole language, its most important packages, and a wide range of applications. Each chapter has exercises to test your understanding and explore extensions and alternatives. Source code is freely available for download from http://gopl.io/ and may be conveniently fetched, built, and installed using the go get command.

Cited By

  1. ACM
    Tang W, Hillerström D, Lindley S and Morris J (2024). Soundly Handling Linearity, Proceedings of the ACM on Programming Languages, 8:POPL, (1600-1628), Online publication date: 5-Jan-2024.
  2. Santos J, Wang C, Wauters T and De Turck F (2023). Diktyo: Network-Aware Scheduling in Container-Based Clouds, IEEE Transactions on Network and Service Management, 20:4, (4461-4477), Online publication date: 1-Dec-2023.
  3. ACM
    Avishahar-Zeira A and Lorenz D Could No-Code Be Code? Toward a No-Code Programming Language for Citizen Developers Proceedings of the 2023 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, (103-119)
  4. ACM
    Andin I, Niskanen R, Dimitrov P and Fernandez-Reyes K TLS the Erlang/OTP Way (Experience Report) Proceedings of the 22nd ACM SIGPLAN International Workshop on Erlang, (2-13)
  5. ACM
    Li B, Xiang Z, Wang X, Ruan H, Zhou J and Tan K FastWake: Revisiting Host Network Stack for Interrupt-mode RDMA Proceedings of the 7th Asia-Pacific Workshop on Networking, (1-7)
  6. ACM
    Custódio R, Paulino H and Rito G Efficient Synchronization-Light Work Stealing Proceedings of the 35th ACM Symposium on Parallelism in Algorithms and Architectures, (39-49)
  7. ACM
    Wu Q, Ekanayake A, Li R, Beard J and John L SPAMeR: Speculative Push for Anticipated Message Requests in Multi-Core Systems Proceedings of the 51st International Conference on Parallel Processing, (1-12)
  8. Miller B, Zhang M and Heymann E (2022). The Relevance of Classic Fuzz Testing: Have We Solved This One?, IEEE Transactions on Software Engineering, 48:6, (2028-2039), Online publication date: 1-Jun-2022.
  9. ACM
    Cox R, Griesemer R, Pike R, Taylor I and Thompson K (2022). The Go programming language and environment, Communications of the ACM, 65:5, (70-78), Online publication date: 1-Apr-2022.
  10. ACM
    Rivera E, Mergendahl S, Shrobe H, Okhravi H and Burow N Keeping Safe Rust Safe with Galeed Proceedings of the 37th Annual Computer Security Applications Conference, (824-836)
  11. ACM
    Popescu N, Xu Z, Apostolakis S, August D and Levy A (2021). Safer at any speed: automatic context-aware safety enhancement for Rust, Proceedings of the ACM on Programming Languages, 5:OOPSLA, (1-23), Online publication date: 20-Oct-2021.
  12. ACM
    Hartman J and Kopič D Scaling TensorFlow to 300 million predictions per second Proceedings of the 15th ACM Conference on Recommender Systems, (595-597)
  13. ACM
    Bak S, Hernandez O, Gates M, Luszczek P and Sarkar V Task-graph scheduling extensions for efficient synchronization and communication Proceedings of the ACM International Conference on Supercomputing, (88-101)
  14. Dähling S, Razik L and Monti A (2021). Enabling scalable and fault-tolerant multi-agent systems by utilizing cloud-native computing, Autonomous Agents and Multi-Agent Systems, 35:1, Online publication date: 1-Apr-2021.
  15. ACM
    Shiina S, Iwasaki S, Taura K and Balaji P Lightweight preemptive user-level threads Proceedings of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, (374-388)
  16. Sun X, Zou J, Li L and Luo M (2021). A blockchain-based online language learning system, Telecommunications Systems, 76:2, (155-166), Online publication date: 1-Feb-2021.
  17. Taha S, Wolff B and Ye L Philosophers May Dine - Definitively! Integrated Formal Methods, (419-439)
  18. ACM
    Brito R and Valente M RefDiff4Go Proceedings of the 14th Brazilian Symposium on Software Components, Architectures, and Reuse, (101-110)
  19. Gottlob G, Lanzinger M, Longo D, Okulmus C and Pichler R The HyperTrac Project: Recent Progress and Future Research Directions on Hypergraph Decompositions Integration of Constraint Programming, Artificial Intelligence, and Operations Research, (3-21)
  20. Quenum J and Ishuuwa G Abstracting Containerisation and Orchestration for Cloud-Native Applications Cloud Computing – CLOUD 2020, (164-180)
  21. ACM
    Farvardin K and Reppy J From folklore to fact: comparing implementations of stacks and continuations Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, (75-90)
  22. Garcia-Contreras I, Morales J and Hermenegildo M Incremental Analysis of Logic Programs with Assertions and Open Predicates Logic-Based Program Synthesis and Transformation, (36-56)
  23. ACM
    Nicol D Simulation-based Analysis of Network Rules Matching Proceedings of the 2019 ACM SIGSIM Conference on Principles of Advanced Discrete Simulation, (49-60)
  24. ACM
    Rosa N, Campos G and Cavalcanti D An adaptive middleware in Go Proceedings of the 19th Workshop on Adaptive and Reflexive Middleware, (1-6)
  25. ACM
    Andersen M, Kolb J, Chen K, Fierro G, Culler D and Katz R (2018). Democratizing Authority in the Built Environment, ACM Transactions on Sensor Networks, 14:3-4, (1-26), Online publication date: 30-Nov-2018.
  26. Marchiori M and Vieno E Negapedia Proceedings of the 2018 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining, (210-213)
  27. ACM
    Valkov I, Chechina N and Trinder P Comparing languages for engineering server software Proceedings of the 33rd Annual ACM Symposium on Applied Computing, (218-225)
  28. ACM
    Fürlinger K, Kowalewski R, Fuchs T and Lehmann B Investigating the performance and productivity of DASH using the Cowichan problems Proceedings of Workshops of HPC Asia, (11-20)
  29. ACM
    Trinder P, Chechina N, Papaspyrou N, Sagonas K, Thompson S, Adams S, Aronis S, Baker R, Bihari E, Boudeville O, Cesarini F, Stefano M, Eriksson S, fördős V, Ghaffari A, Giantsios A, Green R, Hoch C, Klaftenegger D, Li H, Lundin K, Mackenzie K, Roukounaki K, Tsiouris Y and Winblad K (2017). Scaling Reliably, ACM Transactions on Programming Languages and Systems, 39:4, (1-46), Online publication date: 31-Dec-2018.
  30. ACM
    Ionkov L, Maltzahn C and Lang M Optimized scatter/gather data operations for parallel storage Proceedings of the 2nd Joint International Workshop on Parallel Data Storage & Data Intensive Scalable Computing Systems, (1-6)
  31. ACM
    Andersen M, Kolb J, Chen K, Culler D and Katz R Democratizing authority in the built environment Proceedings of the 4th ACM International Conference on Systems for Energy-Efficient Built Environments, (1-10)
  32. ACM
    Algehed M and Jansson P VisPar: visualising dataflow graphs from the Par Monad Proceedings of the 6th ACM SIGPLAN International Workshop on Functional High-Performance Computing, (24-29)
  33. Chen L (2017). Continuous Delivery, Journal of Systems and Software, 128:C, (72-86), Online publication date: 1-Jun-2017.
  34. Tsvetkov L and Spivak A Localising Unsafe Software Resource Usage with Typed Code Model Proceedings of the 20th Conference of Open Innovations Association FRUCT, (466-471)
  35. ACM
    Gil Y and Orrú M Code Spartanization Proceedings of the Symposium on Applied Computing, (1615-1622)
  36. Ferreira R, Bonadio Í and Durham A Secretary pattern Proceedings of the 11th Latin-American Conference on Pattern Languages of Programming, (1-11)
  37. Andersen M and Culler D BTrDB Proceedings of the 14th Usenix Conference on File and Storage Technologies, (39-52)
  38. Steffen M A Small-Step Semantics of a Concurrent Calculus with Goroutines and Deferred Functions Essays Dedicated to Frank de Boer on Theory and Practice of Formal Methods - Volume 9660, (393-406)
Contributors
  • MIT Computer Science & Artificial Intelligence Laboratory
  • Princeton University

Recommendations

Reviews

Christopher Fox

In 1978, Brian Kernighan and Dennis Ritchie published The C programming language [1], the first book about C and the definitive guide to the language for decades. Kernighan has now teamed up with Alan Donovan to write The Go programming language , which, while not the first book about Go, is likely to play the same role for Go as its predecessor did for C. The two books are similar in more ways than just their titles. Like the C book, the first chapter of the Go book is a tutorial survey of the language that covers its main features, gives a flavor of the language, and shows off some of its capabilities. The chapters that follow in both books focus on particular aspects of the languages. In the Go book, these chapters discuss program structure, basic data types, composite types, functions, methods, interfaces, goroutines and channels, concurrency with shared variables, packages and the Go tool, testing, reflection, and low-level programming. The C book has a C reference manual as its appendix; the Go reference manual is online (https://golang.org/). Both books have extensive indices. Both books also have many code examples-in fact, many examples from the C book reappear in the Go book-and exercises at the ends of some sections. Even the cover, typography, and overall design of the Go book echo the C book. The similarity of these books seems meant to suggest that Go is a modern replacement for C. Go was developed by a team at Google whose core is Rob Pike, Ken Thompson, and Robert Griesemer (and it now includes Donovan). Thompson and Pike, along with Kernighan, were part of the group at Bell Labs that developed Unix and C and promulgated an approach to software development based on the tools and languages in that environment. This philosophy emphasized simplicity and parsimony, and that sensibility is evident in the design of Go. Go is a small language that offers much of the power of large modern languages like Java and C++ without the complexity that comes with size. In many ways, it is a reaction to the complex type systems of object-oriented languages with parametric polymorphism (that is, generics or templates). On the other hand, Go incorporates the lessons learned and the changes in computing since C was invented: it is strongly typed and has a rich type system, interfaces (but no classes), pointers (but no pointer arithmetic), garbage collection, packages, reflection, and concurrency modeled on Hoare's communicating sequential processes (CSP). Go also comes with a toolset that supports testing, benchmarking, profiling, code formatting and refactoring, and builds without makefiles. Go takes its operators and control structures from C; its packages, type declarations, and methods from Oberon; and its concurrency constructs from Newsqueak. It is thus a C-like language superficially, but incorporates many features from other languages. Also like C, it can be used for both systems programming and more general-purpose development. In summary, the book makes the case that Go is a simple, powerful language suitable for systems programming whose design reflects what we have learned about programming languages design since the 1970s, and is thus a suitable replacement for C. Despite the similarities between the C and Go books, there are many differences as well. The C book (second edition) has 274 pages, but the Go book is a dense 380. Although Go is a small language, it is sophisticated and subtle, requiring considerable explanation and examples. Furthermore, Go has a greater variety of features than C, such as concurrency, reflection, and packages, which require explanation. Finally, Go comes with a sophisticated toolset that must be explained to take full advantage of the language. Although the Go book and the C book use some of the same examples, the Go book features examples using things not available in 1978, such as the web, scalable vector graphics (SVG), JSON parsers, and Extensible Markup Language (XML) processors. These examples are interesting and demonstrate the capabilities of both the language and its libraries. Reference materials about the language and its packages (and of course the languages itself) are available online (https://golang.org/), and the book assumes this environment. The book also takes advantage of the web by providing all of its examples in a GitHub repository that can be downloaded (in one line) using the Go tool. Again like its predecessor, this book is written for experienced programmers. For example, there is no section about Go control structures: the reader is presented with examples and expected to recognize common control structures like for loops and conditionals. Differences from standard C control structures are discussed as they come up throughout the book. One of the strongest features of the book is its frequent discussion of Go idioms and language design decisions. This material is valuable even to someone who already knows Go, because it is the only way (short of poring over Go source code) to become truly proficient in the language. The book is also very strong in considering (almost) all features of the language precisely and in detail. Although the language specification is online, it is invaluable to have extensive discussion and examples of puzzling features. There are several other Go language books on the market. The completeness of coverage, level of detail, richness of examples, elegance of exposition, and the authors' intimate knowledge of the language make this book stand out from the rest as the definitive guide to the Go programming language. If you are interested in Go, this is the most important book to own. More reviews about this item: Amazon , Goodreads Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.