Go
19.5K subscribers
14 photos
143 links
// admin @denniselite
go func() { channel <- news }()
news := <-channel
fmt.Sprintf("%s", news)
Download Telegram
Hello, channel. Recently I’ve played with concurrency data processing in go: let’s say how to split a bunch of data to 1,2...N pieces and process it concurrently and then once everything is done continue normal execution. For those types of issues I used `channels` before and tried to design my own solution every time. But somehow, suddenly, I found a good explanation of how to use `sync.WaitGroup` and it looks like a charm! It’s not a new feature, really easy to use, but by some reason I’ve never tried to use it for some reason 😀 So here is an article:
https://tutorialedge.net/golang/go-waitgroup-tutorial/
and a short example of how it could be ▶️ https://gist.github.com/denniselite/b9c62ee0366d3f63f9f6015a68af1db3
If you feel like you mastered Go, you might want to expand your skillset. Guys from @thefrontend share a lot of useful tips and tricks, inspirational UI/UX, news and throw occasional quizzes around web and mobile dev for you to participate!

Have a quick look🔥

t.iss.one/thefrontend
A quite interesting proposal was raised last month regarding error handling in Go:
The try built-in function takes n+1 arguments (where n may be zero) where the last argument must be of type error. It returns the first n arguments (if any) if the (final) error argument is nil, otherwise it returns from the enclosing function with that error. For instance, code such as
f, err := os.Open(filename)
if err != nil {
return …, err // zero values for other results, if any
}

can be simplified to
f := try(os.Open(filename))

Check it out:
https://github.com/golang/go/issues/32437
Full proposal description is located here: https://github.com/golang/proposal/blob/master/design/32437-try-builtin.md
Golang 1.13 has been released last week! 🚀
Feel free to check the updates by the link:
https://blog.golang.org/go1.13
In short, there is a list of major changes:
- The go command now downloads and authenticates modules using the Go module mirror and Go checksum database by default
- Improvements to number literals
- Error wrapping
- TLS 1.3 on by default
- Improved modules support

PS In my point of view, Error handling is one of the most important syntax changes, so I’d just want to highlight it here:
The error wrapping support follows the initial proposal described https://go.googlesource.com/proposal/+/master/design/29934-error-values.md, it adds a new Wrapper() interface:
An error that wraps another error should implement Wrapper by defining an Unwrap method.

type Wrapper interface {
// Unwrap returns the next error in the error chain.
// If there is no next error, Unwrap returns nil.
Unwrap() error
}


Also, to support wrapping, fmt.Errorf now has a %w verb for creating wrapped errors, and three new functions in the errors package ( errors.Unwrap, errors.Is and errors.As ) simplify unwrapping and inspecting wrapped errors.

Thanks for your attention 🙂

PPS Given the summer is gone, I’ll try to post more news and interesting things to the channel in the future 🙂
Quite interesting reading about versioning principles in Go and how the team came up with Go modules in the end: https://research.swtch.com/vgo-principles

>>> This blog post is about how we added package versioning to Go, in the form of Go modules, and the reasons we made the choices we did. It is adapted and updated from a talk I gave at GopherCon Singapore in 2018
Serverless tech stack is becoming more and more popular, so, in case you never tried AWS Lambda functions together with Go 💙 I’d suggest you take a look at the article: this quite simple reading allows you to get the idea of the technology.
https://read.acloud.guru/serverless-golang-api-with-aws-lambda-34e442385a6a
Hello, there 👋
Today I’d like to share a really good project I’ve recently found on GitHub: *Awesome Go Storage*. You’re probably familiar with Awesome-Go project (https://github.com/avelino/awesome-go): curated list of awesome Go frameworks, libraries and software. The next repo has the same idea but more specific topic: storages and databases. I’d suggest to put it in your bookmarks 😉

========================
A curated list of awesome Go storage projects and libraries. Inspired by awesome-go repository.
========================
Table of contents:
- Storage Servers implemented in Go.
- Key-Value Store implemented in Go.
- File Systems implemented in Go.
- Databases implemented in Go (schema migration, tools, engines, query builders);
- DB drivers and libraries (SQL; NoSQL libraries for connecting and operating databases + search and Analytic Databases)

https://github.com/gostor/awesome-go-storage
Hi, channel 👋
You probably know, how to deal with WebSockets in Go, don’t you?
But what if we need to handle millions of them? In the following well-written article an approach is described which could help us to handle up to 3 million online connections 😱

https://www.freecodecamp.org/news/million-websockets-and-go-cc58418460bb/
👍31🔥1👏1
Happy New year for everyone 😀🎉 that's an interesting stuff I've found recently: how Grab deals with event sourcing and stream processing pipelines in Go. Worth to read especially the system design parts. Enjoy 🙌 https://engineering.grab.com/plumbing-at-scale
How much do you know about defers in Go?

https://rakyll.org/inlined-defers/

> An optimization in 1.14 and later for simple use cases with defer that removes most of the performance hit for deferred functions, complete with the how and the why.
An overview and first impressions of Go made by an advanced JS engineer

>> As an advanced JavaScript developer, The more I work with JavaScript the more I understand the advantages of a statically typed language.

JavaScript is fascinating but sometimes you want to try something else and broaden your horizon.

This article will be a brain dump of all I’ve learned so far about Google’s Go language (I will update it as I go, pun intended).

I assume you have installed the Go binaries on your computer.

https://itnext.io/googles-go-essentials-for-node-js-javascript-developers-6d71f08d2531
👋 In case you're still not using Go interfaces or you're curious how they could be applied, check this small post out:
https://medium.com/better-programming/a-real-world-example-of-go-interfaces-98e89b2ddb67
(Only 2 mins read)
Good day for everyone 👋 I kinda missed the news for a bit, but no worries, here we are: a new interesting post comes up recently from Go dev team, check it out:

A new Go API for Protocol Buffers
Joe Tsai, Damien Neil, and Herbie Ong

Introduction: We are pleased to announce the release of a major revision of the Go API for protocol buffers, Google's language-neutral data interchange format.
https://blog.golang.org/protobuf-apiv2
“How We Created a Realtime Patient Monitoring System With Go and Vue in 3 days”

The risk of handling a Covid-19 ward

The deadly virus can infect you with a very small mistake. As healthcare workers, our frontline has to wander around the isolation wards to check vital signs of a patient from time to time. This task involves disposing of the protective gear after a visit. All just to check some reading on a device.

A request from health authorities reached us to develop a remote monitoring system for isolation wards. There are expensive softwares to remotely monitor them. But Sri Lanka might not be that rich to spend such amount of money.

https://kasvith.me/posts/how-we-created-a-realtime-patient-monitoring-system-with-go-and-vue/