🇺🇦 Go на двоих

@golang_for_two


Канал о трюках и инженерных практиках на языке программирования Go за чашкой кофе ☕️.

Автор: @a_soldatenko
Сайт: https://asoldatenko.org

#golang #go

🇺🇦 Go на двоих

25 Sep, 17:58


TIL: strings.Split returns [""] if s does not contain sep and sep is not empty 😅

package main

import (
"fmt"
"strings"
)

func main() {
fmt.Printf("%q\n", strings.Split("", ","))
}


Split returns a slice of length 1 whose only element is s:

[""]

🇺🇦 Go на двоих

19 Sep, 17:55


Dont forget to share your feedback about developing with Go ✍️

https://go.dev/blog/survey2024-h2

🇺🇦 Go на двоих

19 Sep, 10:40


Providing context to cancellations in Go 1.20 with the new context WithCause API

https://josephwoodward.co.uk/2023/01/context-cancellation-cause-with-cancel-cause

and proposal https://github.com/golang/go/issues/51365

🇺🇦 Go на двоих

11 Sep, 07:51


Some pitfalls about generating Kubernetes Custom Resources with `controller-gen` over the years, and how to do more rigid validation and defaulting with it:

https://ahmet.im/blog/crd-generation-pitfalls/

🇺🇦 Go на двоих

11 Sep, 07:51


Old but still worth to read about why one shouldn;t defer Close() on writable files:

https://www.joeshaw.org/dont-defer-close-on-writable-files/

🇺🇦 Go на двоих

27 Aug, 18:02


_4chan := make(chan chan chan chan int)


😅😅😅

https://www.dolthub.com/blog/2024-08-23-the-4-chan-go-programmer/

🇺🇦 Go на двоих

20 Aug, 11:22


For all GO haters :) https://juli1.substack.com/p/why-i-fell-in-love-with-go

Nice quote and summary:
>Technologies like JavaScript or Go are like a good burger: it’s an option that the majority understand and choose regularly. It may not be the most elegant option, but it does the job and allows us to focus on problems that matter.

🇺🇦 Go на двоих

14 Aug, 08:09


https://tip.golang.org/doc/go1.23#iterators uhhhh 🙃🙃🙃🙃

🇺🇦 Go на двоих

19 Jun, 09:13


How do you track code coverage for OSS projects?

codecov seems very flaky, (will provide some details in thread)

wdyt about https://github.com/vladopajic/go-test-coverage?tab=readme-ov-file

🇺🇦 Go на двоих

22 May, 14:43


TIL: a % 128 = 0 is the same as a & 127 = 0

'Which is a faster operation since it just requires doing the AND and not the whole division and remainder comparison' @jesusvazquezp

from https://github.com/prometheus/prometheus/pull/14118#pullrequestreview-2068077407

🇺🇦 Go на двоих

16 May, 08:41


proposal: reflect: add TypeAssert likely accepted 🎉 ')

https://github.com/golang/go/issues/62121

🇺🇦 Go на двоих

07 Feb, 16:58


Collections what's new in Go 1.22:

- slices.Concat https://blog.carlana.net/post/2024/golang-slices-concat/
- reflect.TypeFor https://blog.carlana.net/post/2024/golang-reflect-type-for/
- https://pkg.go.dev/cmp#Or
- https://pkg.go.dev/net/http@master#FileServerFS
- https://pkg.go.dev/database/sql#Null

🇺🇦 Go на двоих

30 Jan, 14:24


https://blog.carlana.net/post/2024/golang-slices-concat/

🇺🇦 Go на двоих

25 Jan, 14:57


Hiring Challenge: Smallest #golang Websocket Client

https://dyte.io/blog/hiring-challenge-smallest-golang-websocket-client/ by @dyte_io

🇺🇦 Go на двоих

09 Jan, 16:27


Go’s CompareAndSwap is not always Compare-and-swap

>Go's standard package sync/atomics provides programmers with functions to use the underlying CPU-level atomic operations such as compare-and-swap (CAS), through atomic.CompareAndSwapT (where T is an integer type).

> Problem: Not all CPU architectures offers a CAS instruction to rely on to implement atomic.CompareAndSwapT. However, Go must compile that function code to something semantically equivalent—let's see what.

https://lu.sagebl.eu/notes/go-cas/

🇺🇦 Go на двоих

05 Jan, 08:30


Discussion of 1BRC in Go https://github.com/gunnarmorling/1brc/discussions/67

Context: https://twitter.com/gunnarmorling posted a problem https://www.morling.dev/blog/one-billion-row-challenge/ the idea is pretty simple and from another side not so simple:

>write a Java program for retrieving temperature measurement values from a text file and calculating the min, mean, and max temperature per weather station. There’s just one caveat: the file has 1,000,000,000 rows!

🇺🇦 Go на двоих

19 Dec, 15:27


https://x.com/mholt6/status/1736940692486897775?s=46

🇺🇦 Go на двоих

28 Sep, 08:14


Slides of my talk from #kcdaustria about debugging #golang apps inside #k8s cluster

https://drive.google.com/file/d/1-6ERQda23o7OiLHziz4wwgvdFWS0kyv8/view

And repo with samples/Dockerfiles for try it out!

https://github.com/andriisoldatenko/debugging-containerized-go-applications