Interesting reading about a tool that examines your Go code and recommends optimal struct field arrangements to help improve memory efficiency:
https://medium.com/orijtech-developers/efficient-struct-packing-guided-pass-for-go-92255872ec72
https://medium.com/orijtech-developers/efficient-struct-packing-guided-pass-for-go-92255872ec72
Medium
Efficient struct packing guided pass for Go
TL;DR: at Orijtech, we’ve developed a static analysis pass called “structslop” that can run through your Go programs and recommend for you…
👏1
Making SQLite faster in Go 🚀
The most popular way of using sqlite in Go happens to also be the slowest when using it in a concurrent application like a web app. Roll your own connection pool to speed things up.
https://turriate.com/articles/making-sqlite-faster-in-go
The most popular way of using sqlite in Go happens to also be the slowest when using it in a concurrent application like a web app. Roll your own connection pool to speed things up.
https://turriate.com/articles/making-sqlite-faster-in-go
Sandro Turriate
Making SQLite faster in Go
Make sqlite faster with a connection pool and prepared statements.
👍1
Discovering and exploring
https://brunocalza.me/discovering-and-exploring-mmap-using-go/
mmap(memory-mapped files) using Go
mmapis a system call for mapping files into memory which can provide a neat abstraction for working with both. Here’s how to use it in Go along with when you shouldn’t.
https://brunocalza.me/discovering-and-exploring-mmap-using-go/
Bruno Calza
Discovering and exploring mmap using Go
Recently I've come to know the concept of memory-mapped files while watching a lecture of the course Intro to Database Systems of Andy Pavlo on database storage. One of the main problems a database storage engine has to solve is how to deal with data in disk…
Go 1.16 Release Candidate 1 is released!
Go 1.16, due to have its final release in February, is now taking its final form and is ready for your production testing, say the Go team.
>>>
It is cut from release-branch.go1.16 at the revision tagged go1.16rc1. Please try your production load tests and unit tests with the new version, your help testing these pre-release versions is invaluable.
Report any problems using the issue tracker: https://golang.org/issue/new
If you have Go installed already, the easiest way to try go1.16rc1 is by using the go command:
You can download binary and source distributions from the usual place: https://golang.org/dl/#go1.16rc1
To find out what has changed in Go 1.16, read the draft release notes: https://tip.golang.org/doc/go1.16
Source: https://groups.google.com/g/golang-announce/c/U_FUHY4wuSc/m/3_Vw3oqpAgAJ
Go 1.16, due to have its final release in February, is now taking its final form and is ready for your production testing, say the Go team.
>>>
It is cut from release-branch.go1.16 at the revision tagged go1.16rc1. Please try your production load tests and unit tests with the new version, your help testing these pre-release versions is invaluable.
Report any problems using the issue tracker: https://golang.org/issue/new
If you have Go installed already, the easiest way to try go1.16rc1 is by using the go command:
$ go get golang.org/dl/go1.16rc1
$ go1.16rc1 download
You can download binary and source distributions from the usual place: https://golang.org/dl/#go1.16rc1
To find out what has changed in Go 1.16, read the draft release notes: https://tip.golang.org/doc/go1.16
Source: https://groups.google.com/g/golang-announce/c/U_FUHY4wuSc/m/3_Vw3oqpAgAJ
Hello 👋 Recently I've stumbled upon the blog post about //go:embed directive usage: a new feature introduced in Go 1.16,
>> that allows you to include the contents of arbitrary files and directories in your Go application.
Looks quite interesting, have a look:
https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/
>> that allows you to include the contents of arbitrary files and directories in your Go application.
Looks quite interesting, have a look:
https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/
blog.carlana.net
How to Use //go:embed
A how-to for embedding files and directories in Go applications
The Go Wiki includes a slice trick on filtering slices without allocating
.
filtered := items[:0]
for _, x := range items {
if condition(x) {
filtered = append(filtered, x)
}
}
This post will attempt to explain how that works: https://abhinavg.net/posts/zero-alloc-slice-filter/GitHub
SliceTricks
The Go programming language. Contribute to golang/go development by creating an account on GitHub.
🔥1
How to work with context.Context: an official blog post.
The documentation for context states:
“Contexts should not be stored inside a struct type, but instead passed to each function that needs it.”
This article expands on that advice with reasons and examples describing why it's important to pass Context rather than store it in another type.
https://blog.golang.org/context-and-structs
The documentation for context states:
“Contexts should not be stored inside a struct type, but instead passed to each function that needs it.”
This article expands on that advice with reasons and examples describing why it's important to pass Context rather than store it in another type.
https://blog.golang.org/context-and-structs
go.dev
Contexts and structs - The Go Programming Language
👍1
Introduction to generics from “Learn Go with tests”: A nice tutorial that takes a step approach to teach generics starting from duplicating code for types, then to interface{}, and finally to generics. And you can run it all in the go2go playground.
https://quii.gitbook.io/learn-go-with-tests/meta/intro-to-generics
https://quii.gitbook.io/learn-go-with-tests/meta/intro-to-generics
👍1
A lot of projects use gRPC framework nowadays to build an efficient cross-service communication layer., and usually the calls between services are fast, frequent, and expected to have low latencies.
But what if we have a bit different problem to solve, e.g. handling long-lived streams?
In this article Omri Cohen walk us through an excellent tutorial about how to design gRPC long-lived streaming. Take a look: https://dev.bitolog.com/grpc-long-lived-streaming/
But what if we have a bit different problem to solve, e.g. handling long-lived streams?
In this article Omri Cohen walk us through an excellent tutorial about how to design gRPC long-lived streaming. Take a look: https://dev.bitolog.com/grpc-long-lived-streaming/
Code The Cloud
gRPC Long-lived Streaming - Code The Cloud
Implementing gRPC long-lived streaming - a tool for cloud native applications. Use it to create watch APIs and notifications infrastructures.
👍1🤔1
Between Go and Elixir
"Reason wanted me to make a choice, and I am so glad I didn’t. Because the more I kept delving into both Elixir and Go, the more I found out how complementary the two can be to one another."
https://preslav.me/2021/04/23/between-golang-and-elixir/
"Reason wanted me to make a choice, and I am so glad I didn’t. Because the more I kept delving into both Elixir and Go, the more I found out how complementary the two can be to one another."
https://preslav.me/2021/04/23/between-golang-and-elixir/
👍3
Top 5 Lessons I learned while working with Go for two years.
In the article, Sayed Alesawy is sharing some of the mistakes and the lessons they faced by doing GoLang development for 2 years:
“ I have been writing Go services for like two years now, both professionally and as personal projects. Using a certain language in numerous projects over an extended period of time allows you to make mistakes, fix them, realize it's still not the best way to do it, fix them again and generally get better the more you get to re-do stuff because each time you try to avoid a mistake you made the last time that caused you a headache throughout that project.”
TLDR;
1. Take the Go highway to Concurrency
2. If it can be singleton, then make it singleton, but do it right!
3. Beware of Blocking Code
4. Graceful Termination and Clean Up
5. Go Modules FTW.
Read more at:
https://sayedalesawy.hashnode.dev/top-5-lessons-i-learned-while-working-with-go-for-two-years
In the article, Sayed Alesawy is sharing some of the mistakes and the lessons they faced by doing GoLang development for 2 years:
“ I have been writing Go services for like two years now, both professionally and as personal projects. Using a certain language in numerous projects over an extended period of time allows you to make mistakes, fix them, realize it's still not the best way to do it, fix them again and generally get better the more you get to re-do stuff because each time you try to avoid a mistake you made the last time that caused you a headache throughout that project.”
TLDR;
1. Take the Go highway to Concurrency
2. If it can be singleton, then make it singleton, but do it right!
3. Beware of Blocking Code
4. Graceful Termination and Clean Up
5. Go Modules FTW.
Read more at:
https://sayedalesawy.hashnode.dev/top-5-lessons-i-learned-while-working-with-go-for-two-years
👍4🤔1
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
👍2👎1
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/
👍13👏1
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
👍7
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
👍6🔥2🤯1
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
👍8🤯1
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
🔥320👍94❤54👏29👎5🤯3💩3🤔2