Updating the Go Memory Model
The final post in a three-part series that culminates with the outline of a proposal to change Go’s memory model.
Link: https://research.swtch.com/gomm
This post is very technical but the specific changes are clear and accessible. If this proposal is anything like Russ’s previous efforts, be prepared to see changes in Go before long :)
Previous parts of the Memory Models series:
Part 1: Hardware Memory Models;
Part 2: Programming Language Memory Models
The final post in a three-part series that culminates with the outline of a proposal to change Go’s memory model.
Link: https://research.swtch.com/gomm
This post is very technical but the specific changes are clear and accessible. If this proposal is anything like Russ’s previous efforts, be prepared to see changes in Go before long :)
Previous parts of the Memory Models series:
Part 1: Hardware Memory Models;
Part 2: Programming Language Memory Models
Hello, everyone! Here's a great post about what functional options are in Go, and how we can use the options pattern to implement them.
Functional options take the form of extra arguments to a function, that extend or modify its behavior. Here’s an example which uses functional options to create a new House struct:
Take a look at https://www.sohamkamani.com/golang/options-pattern/
Functional options take the form of extra arguments to a function, that extend or modify its behavior. Here’s an example which uses functional options to create a new House struct:
h := NewHouse(
WithConcrete(),
WithoutFireplace(),
)
Take a look at https://www.sohamkamani.com/golang/options-pattern/
Wondering how to make
https://medium.com/@matryer/make-ctrl-c-cancel-the-context-context-bd006a8ad6ff
Ctrl+C
safely stop the program in Go? Here’s a short blog post about syscalls handling and cancellation of context.Context
: https://medium.com/@matryer/make-ctrl-c-cancel-the-context-context-bd006a8ad6ff
Let’s talk about logging
This is a post inspired by a thread that Nate Finch started on the Go Forum. This post focuses on Go, but if you can see your way past that, I think the ideas presented here are widely applicable.
https://dave.cheney.net/2015/11/05/lets-talk-about-logging
This is a post inspired by a thread that Nate Finch started on the Go Forum. This post focuses on Go, but if you can see your way past that, I think the ideas presented here are widely applicable.
https://dave.cheney.net/2015/11/05/lets-talk-about-logging
When More Parallelism != More Performance
This is an important reading especially for beginners in Go to understand the pros and especially the cons of parallel computing in Go. The post shows by example how concurrency could lead into a bad performance and what one should pay attention to when working on concurrent/parallel computing
https://convey.earth/conversation?id=44
This is an important reading especially for beginners in Go to understand the pros and especially the cons of parallel computing in Go. The post shows by example how concurrency could lead into a bad performance and what one should pay attention to when working on concurrent/parallel computing
https://convey.earth/conversation?id=44
Go 1.18 is released!
The Go Team
15 March 2022
Today the Go team is thrilled to release Go 1.18, which you can get by visiting the download page.
Go 1.18 is a massive release that includes new features, performance improvements, and our biggest change ever to the language. It isn’t a stretch to say that the design for parts of Go 1.18 started over a decade ago when we first released Go.
Generics
In Go 1.18, we’re introducing new support for generic code using parameterized types. Supporting generics has been Go’s most often requested feature, and we’re proud to deliver the generic support that the majority of users need today. Subsequent releases will provide additional support for some of the more complicated generic use cases. We encourage you to get to know this new feature using our generics tutorial, and to explore the best ways to use generics to optimize and simplify your code today. The release notes have more details about using generics in Go 1.18.
Fuzzing
With Go 1.18, Go is the first major language with fuzzing fully integrated into its standard toolchain. Like generics, fuzzing has been in design for a long time, and we’re delighted to share it with the Go ecosystem with this release. Please check out our fuzzing tutorial to help you get started with this new feature.
Workspaces
Go modules have been almost universally adopted, and Go users have reported very high satisfaction scores in our annual surveys. In our 2021 user survey, the most common challenge users identified with modules was working across multiple modules. In Go 1.18, we’ve addressed this with a new Go workspace mode, which makes it simple to work with multiple modules.
20% Performance Improvements
Apple M1, ARM64, and PowerPC64 users rejoice! Go 1.18 includes CPU performance improvements of up to 20% due to the expansion of Go 1.17’s register ABI calling convention to these architectures. Just to underscore how big this release is, a 20% performance improvement is the fourth most important headline!
For a more detailed description of everything that’s in 1.18, please consult the release notes.
Go 1.18 is a huge milestone for the entire Go community. We want to thank every Go user who filed a bug, sent in a change, wrote a tutorial, or helped in any way to make Go 1.18 a reality. We couldn’t do it without you. Thank you.
Enjoy Go 1.18!
The Go Team
15 March 2022
Today the Go team is thrilled to release Go 1.18, which you can get by visiting the download page.
Go 1.18 is a massive release that includes new features, performance improvements, and our biggest change ever to the language. It isn’t a stretch to say that the design for parts of Go 1.18 started over a decade ago when we first released Go.
Generics
In Go 1.18, we’re introducing new support for generic code using parameterized types. Supporting generics has been Go’s most often requested feature, and we’re proud to deliver the generic support that the majority of users need today. Subsequent releases will provide additional support for some of the more complicated generic use cases. We encourage you to get to know this new feature using our generics tutorial, and to explore the best ways to use generics to optimize and simplify your code today. The release notes have more details about using generics in Go 1.18.
Fuzzing
With Go 1.18, Go is the first major language with fuzzing fully integrated into its standard toolchain. Like generics, fuzzing has been in design for a long time, and we’re delighted to share it with the Go ecosystem with this release. Please check out our fuzzing tutorial to help you get started with this new feature.
Workspaces
Go modules have been almost universally adopted, and Go users have reported very high satisfaction scores in our annual surveys. In our 2021 user survey, the most common challenge users identified with modules was working across multiple modules. In Go 1.18, we’ve addressed this with a new Go workspace mode, which makes it simple to work with multiple modules.
20% Performance Improvements
Apple M1, ARM64, and PowerPC64 users rejoice! Go 1.18 includes CPU performance improvements of up to 20% due to the expansion of Go 1.17’s register ABI calling convention to these architectures. Just to underscore how big this release is, a 20% performance improvement is the fourth most important headline!
For a more detailed description of everything that’s in 1.18, please consult the release notes.
Go 1.18 is a huge milestone for the entire Go community. We want to thank every Go user who filed a bug, sent in a change, wrote a tutorial, or helped in any way to make Go 1.18 a reality. We couldn’t do it without you. Thank you.
Enjoy Go 1.18!
go.dev
All releases - The Go Programming Language
Hello everyone 👋
Today’s post is about finding Golang jobs abroad.
A friend of mine is operating developer job board Relocate.me. The project is built around and focused entirely on tech jobs that offer visa sponsorship/relocation assistance.
If working abroad is smth you're interested in, consider checking it out.
Here's a link to the Golang jobs that are currently on offer - https://relocate.me/search/golang
Also, subscribe to their Telegram channel to get alerts of new jobs - @relocateme
Today’s post is about finding Golang jobs abroad.
A friend of mine is operating developer job board Relocate.me. The project is built around and focused entirely on tech jobs that offer visa sponsorship/relocation assistance.
If working abroad is smth you're interested in, consider checking it out.
Here's a link to the Golang jobs that are currently on offer - https://relocate.me/search/golang
Also, subscribe to their Telegram channel to get alerts of new jobs - @relocateme
Relocate.me
Developer Job Search Abroad | Relocate.me
Your dream developer job abroad awaits you. Browse through hundreds of handpicked IT jobs with relocation included and find the perfect match for you on Relocate.me!
Breaking the Monolith at Twitch: Part One
Twitch is one of a large group of successful companies that began life running as a monolithic Ruby on Rails app but they’ve written about where they went from there, how Go entered the picture, and their current practices.
About the Author: My name is Mario Izquierdo, and I’ve been a Full Stack Engineer at Twitch since 2017. I’ve worked in a variety of systems in my time here, including the public API, infrastructure, and tools for services.
From the author: This is Part One (of two) of our story chronicling Twitch’s journey from monolithic architecture to microservices. In Part One, you’ll learn about our early days, from our rapid growth to the performance bottlenecks that pushed us to find better solutions. Part Two, covers “Wexit,” our migration to microservices and all the challenges and benefits that came with the switch.
https://blog.twitch.tv/en/2022/03/30/breaking-the-monolith-at-twitch/
Enjoy! 🤩
Twitch is one of a large group of successful companies that began life running as a monolithic Ruby on Rails app but they’ve written about where they went from there, how Go entered the picture, and their current practices.
About the Author: My name is Mario Izquierdo, and I’ve been a Full Stack Engineer at Twitch since 2017. I’ve worked in a variety of systems in my time here, including the public API, infrastructure, and tools for services.
From the author: This is Part One (of two) of our story chronicling Twitch’s journey from monolithic architecture to microservices. In Part One, you’ll learn about our early days, from our rapid growth to the performance bottlenecks that pushed us to find better solutions. Part Two, covers “Wexit,” our migration to microservices and all the challenges and benefits that came with the switch.
https://blog.twitch.tv/en/2022/03/30/breaking-the-monolith-at-twitch/
Enjoy! 🤩
Backward compatibility in Go: discussion
>>>
We now have about ten years of experience with Go 1 compatibility.
In general it works very well for the Go team and for users. However, there are also practices we've developed since then that it doesn't capture (specifically
I think it is worth extending our approach to try to break programs even less often, as well as to explicitly codify
>>>
by Russ Cox
Join the discussion if you wish https://github.com/golang/go/discussions/55090
>>>
We now have about ten years of experience with Go 1 compatibility.
In general it works very well for the Go team and for users. However, there are also practices we've developed since then that it doesn't capture (specifically
GODEBUG
settings), and there are still times when users’ programs break. I think it is worth extending our approach to try to break programs even less often, as well as to explicitly codify
GODEBUG
settings and clarify when they are and are not appropriate.>>>
by Russ Cox
Join the discussion if you wish https://github.com/golang/go/discussions/55090
GitHub
extending Go backward compatibility · golang/go · Discussion #55090
This discussion is about backward compatibility, meaning new versions of Go compiling older Go code. For the problem of old versions of Go compiling newer Go code, see this other discussion about f...
A bit of a clickbait title, but still an interesting finding: https://hmarr.com/blog/go-allocation-hunting/
Hmarr
Making a Go program run 1.7x faster with a one character change • Harry Marr
Programmer and engineering manager working at GitHub. Co-founded Dependabot, and helped build Monzo and GoCardless.
Error handling in Go is a little different than other mainstream programming languages like Java, JavaScript, or Python. Go’s built-in errors don’t contain stack traces, nor do they support conventional try/catch methods to handle them. Instead, errors in Go are just values returned by functions, and they can be treated in much the same way as any other datatype - leading to a surprisingly lightweight and simple design.
In this article, Brandon Schurman demonstrates the basics of handling errors in Go, as well as some simple strategies you can follow in your code to ensure your program is robust and easy to debug.
https://earthly.dev/blog/golang-errors/
In this article, Brandon Schurman demonstrates the basics of handling errors in Go, as well as some simple strategies you can follow in your code to ensure your program is robust and easy to debug.
https://earthly.dev/blog/golang-errors/
Earthly Blog
Effective Error Handling in Golang
Learn how to effectively handle errors in Go with this informative article. Discover the basics of error handling in Go, strategies for robust code...
User or *User - Do We Need Struct Pointers Everywhere?
The answer, as you might’ve guessed, is “no.” But, it’s also more nuanced due to the lifetime of a struct, its usage, and other aspects that boil this down to general guidelines and case-by-case analysis.
https://preslav.me/2023/02/06/golang-do-we-need-struct-pointers-everywhere/
The answer, as you might’ve guessed, is “no.” But, it’s also more nuanced due to the lifetime of a struct, its usage, and other aspects that boil this down to general guidelines and case-by-case analysis.
https://preslav.me/2023/02/06/golang-do-we-need-struct-pointers-everywhere/
Preslav Rachev
User or *User - Do We Need Struct Pointers Everywhere?
A bit of up-front thinking can help make our Go code cleaner and more performant.
This media is not supported in your browser
VIEW IN TELEGRAM
Memory leaks can be a significant issue in any programming language, and Go is no exception. Despite being a garbage-collected language, Go is still susceptible to memory leaks, which can lead to performance degradation and cause your operating system to run out of memory.
To defend itself, the Linux operating system implements an Out-of-Memory (OOM) killer that identifies and terminates processes that consume too much memory and cause the system to become unresponsive.
In this blog post, we’ll explore the most common causes of memory leaks in Go and demonstrate how to use Grafana Pyroscope, an open source continuous profiling solution, to find and fix these leaks.
https://grafana.com/blog/2023/04/19/how-to-troubleshoot-memory-leaks-in-go-with-grafana-pyroscope/
To defend itself, the Linux operating system implements an Out-of-Memory (OOM) killer that identifies and terminates processes that consume too much memory and cause the system to become unresponsive.
In this blog post, we’ll explore the most common causes of memory leaks in Go and demonstrate how to use Grafana Pyroscope, an open source continuous profiling solution, to find and fix these leaks.
https://grafana.com/blog/2023/04/19/how-to-troubleshoot-memory-leaks-in-go-with-grafana-pyroscope/
Go Sync or Go Home: WaitGroup
Go’s goroutines, channels, and mutexes make it easy to develop complex concurrency systems. Most problems can be solved using these three mechanisms, but you might be asking yourself — what else is out there?
https://medium.com/@yardenlaif/go-sync-or-go-home-waitgroup-5f074a03776e
Go’s goroutines, channels, and mutexes make it easy to develop complex concurrency systems. Most problems can be solved using these three mechanisms, but you might be asking yourself — what else is out there?
https://medium.com/@yardenlaif/go-sync-or-go-home-waitgroup-5f074a03776e
Medium
Go Sync or Go Home: WaitGroup
What does WaitGroup have that channels don’t?
Logging in Go: A Comparison of the Top 8 Libraries
There's probably a 99% chance that if you're logging in Go, you're using a third-party logging framework since the built-in log package lacks even the most basic features required for production logging. This recently changed with the release of Go 1.21 where the new log/slog package for structured, leveled, and context-aware logging was one of the major highlights.
https://betterstack.com/community/guides/logging/best-golang-logging-libraries/
There's probably a 99% chance that if you're logging in Go, you're using a third-party logging framework since the built-in log package lacks even the most basic features required for production logging. This recently changed with the release of Go 1.21 where the new log/slog package for structured, leveled, and context-aware logging was one of the major highlights.
https://betterstack.com/community/guides/logging/best-golang-logging-libraries/
Betterstack
Logging in Go: A Comparison of the Top 9 Libraries | Better Stack Community
This article compares 9 Go logging libraries, discussing and comparing their features, performance, pros and cons, to determine which library is right for you
https://threedots.tech/post/making-games-in-go/
Miłosz uses the much loved Ebitengine to create a simple Asteroids game. There’s a lot to cover, but the steps are small and easy to digest if you’re looking to understand how games are made.
Miłosz uses the much loved Ebitengine to create a simple Asteroids game. There’s a lot to cover, but the steps are small and easy to digest if you’re looking to understand how games are made.
threedots.tech
Making Games in Go for Absolute Beginners
Here’s a rant I often see in developer communities:
I used to love programming because I like building stuff. But my full-time job killed my passion. I spend more time in meetings, fighting over deadlines, and arguing in reviews than working with code. Am…
I used to love programming because I like building stuff. But my full-time job killed my passion. I spend more time in meetings, fighting over deadlines, and arguing in reviews than working with code. Am…
Initial Thoughts on Go 1.22 — 1.22 is due next month, but the release candidate gives us a look at plenty of changes and improvements coming down the pike, including new default behavior for loop variables in for loops, the ‘rangefunc’ experiment (more on that next), and even some performance improvements.
https://www.dolthub.com/blog/2024-01-12-golang-1-22rc/
https://www.dolthub.com/blog/2024-01-12-golang-1-22rc/
The Impact of Pre-Allocating Slice Memory on Performance — The author wanted to establish, in numbers, how pre-allocating memory improves performance using quantitative measurements and tools for automated detection.
Oilbeater's Study Room
The Impact of Pre-allocating Slice Memory on Performance in Golang | Oilbeater's Study Room
Mastering Maps in Go: Everything You Need to Know
Maps, also known as associative arrays or hash tables, are vital data structures for solving algorithmic problems in programming. Understanding their features, operations, time and space complexities, and implementation in code is crucial for developers. With this knowledge and practical experience, developers can effectively apply maps to problem-solving scenarios.
This article offers a comprehensive guide to using maps, covering their overview, implementation in Go programming, and strategies for using them in concurrent code.
Maps, also known as associative arrays or hash tables, are vital data structures for solving algorithmic problems in programming. Understanding their features, operations, time and space complexities, and implementation in code is crucial for developers. With this knowledge and practical experience, developers can effectively apply maps to problem-solving scenarios.
This article offers a comprehensive guide to using maps, covering their overview, implementation in Go programming, and strategies for using them in concurrent code.
Hackernoon
Mastering Maps in Go: Everything You Need to Know | HackerNoon
Learn about using maps in Go (golang), including associative arrays, hash maps, collision handling, and sync.Map, with practical code examples.