Получи случайную криптовалюту за регистрацию!

🇺🇦 Go на двоих

Логотип телеграм канала @golang_for_two — 🇺🇦 Go на двоих
Логотип телеграм канала @golang_for_two — 🇺🇦 Go на двоих
Адрес канала: @golang_for_two
Категории: Технологии
Язык: Русский
Количество подписчиков: 1.36K
Описание канала:

Канал о трюках и инженерных практиках на языке программирования Go за чашкой кофе ☕️.
Автор: @a_soldatenko
Сайт: https://asoldatenko.org
#golang #go

Рейтинги и Отзывы

3.00

3 отзыва

Оценить канал golang_for_two и оставить отзыв — могут только зарегестрированные пользователи. Все отзывы проходят модерацию.

5 звезд

1

4 звезд

0

3 звезд

1

2 звезд

0

1 звезд

1


Последние сообщения 4

2021-04-12 16:21:30 23 апреля приглашаем всех гоферов на GopherCon Russia 2021: online, бесплатно, лучшие доклады, стенды партнёров, горячие споры в чатах! Среди спикеров этого года Mat Ryer, Aaron Schlesinger и Felix Geisendörfer. А для тех, кто хочет не только пообщаться и послушать доклады, но и прокачать свои навыки на практике, подготовили 4 воркшопа: Kubernetes-операторы, линтеры с ruleguard, профилирование и оптимизация, Fuzz и Property-Based тесты. Все подробности регистрация на https://www.gophercon-russia.ru/
541 views13:21
Открыть/Комментировать
2021-03-25 19:04:31 Kubernetes deployment strategies

Коротко о том какие в k8s есть стратегии деплоя с примерами:

https://github.com/ContainerSolutions/k8s-deployment-strategies

tl;dr:
* recreate: terminate the old version and release the new one
* ramped: release a new version on a rolling update fashion, one after the other
* blue/green: release a new version alongside the old version then switch traffic
* canary: release a new version to a subset of users, then proceed to a full rollout
* a/b testing: release a new version to a subset of users in a precise way (HTTP headers, cookie, weight, etc.). This doesn’t come out of the box with Kubernetes, it imply extra work to setup a smarter loadbalancing system (Istio, Linkerd, Traeffik, custom nginx/haproxy, etc).
* shadow: release a new version alongside the old version. Incoming traffic is mirrored to the new version and doesn't impact the response.
3.7K views16:04
Открыть/Комментировать
2021-03-25 13:15:45 Practical Go Lessons Book

https://www.practical-go-lessons.com/

По словам автора, он начал писать эту книгу в 2018 по ночам и по выходным, а в конце 2020 года уволился с основной работы и начал писать книгу фул тайм . Огромный респект автору.
Книга подходит больше новичкам, мне очень понравились иллюстрации которых очень много! [405 штук]
823 views10:15
Открыть/Комментировать
2021-03-23 00:10:56 Code Review Checklist: Go Concurrency

https://github.com/code-review-checklists/go-concurrency

идет как дополнение к https://github.com/golang/go/wiki/CodeReviewComments
1.5K views21:10
Открыть/Комментировать
2021-03-22 20:52:54 The ecosystem of the Go programming language

https://henvic.dev/posts/go/
772 views17:52
Открыть/Комментировать
2021-03-21 22:36:06 Docker Security Cheat Sheet:

RULE #0 - Keep Host and Docker up to date
RULE #1 - Do not expose the Docker daemon socket (even to the containers)
RULE #2 - Set a user
RULE #3 - Limit capabilities (Grant only specific capabilities, needed by a container)
RULE #4 - Add –no-new-privileges flag
RULE #5 - Disable inter-container communication (--icc=false)
RULE #6 - Use Linux Security Module (seccomp, AppArmor, or SELinux)
RULE #7 - Limit resources (memory, CPU, file descriptors, processes, restarts)
RULE #8 - Set filesystem and volumes to read-only
RULE #9 - Use static analysis tools
RULE #10 - Set the logging level to at least INFO
Rule #11 - Lint the Dockerfile at build time

more details about each rule: https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html
Source: https://github.com/OWASP/CheatSheetSeries
2.3K views19:36
Открыть/Комментировать
2021-03-18 13:50:00 A Golang library for generating high-entropy random passwords similar to 1Password or LastPass.

Example passwords this library may generate:
0N[k9PhDqmmfaO`p_XHjVv`HTq|zsH4XiH8umjg9JAGJ#\Qm6lZ,28XF4{X?3sHj
7@90|0H7!4p\,cUlYuRtgqyWEivlXnLeBpZvIQ
Q795Im1VR5h363s48oZGaLDa
wpvbxlsc

https://github.com/sethvargo/go-password

Из интересного сразу идет моком для тестов:
// func MyFunc(p *password.Generator)
func MyFunc(p password.PasswordGenerator) {
// ...
}

func TestMyFunc(t *testing.T) {
gen := password.NewMockGenerator("canned-response", false)
MyFunc(gen)
}
903 views10:50
Открыть/Комментировать
2021-03-16 15:33:16 golang deep comparison for testing:

https://github.com/maxatome/go-testdeep

import (
"testing"
"time"
)

func TestCreateRecord(t *testing.T) {
before := time.Now().Truncate(time.Second)
record, err := CreateRecord()

if err != nil {
t.Errorf("An error occurred: %s", err)
} else {
expected := Record{Name: "Bob", Age: 23}

if record.Id == 0 {
t.Error("Id probably not initialized")
}
if before.After(record.CreatedAt) ||
time.Now().Before(record.CreatedAt) {
t.Errorf("CreatedAt field not expected: %s", record.CreatedAt)
}
if record.Name != expected.Name {
t.Errorf("Name field differs, got=%s, expected=%s",
record.Name, expected.Name)
}
if record.Age != expected.Age {
t.Errorf("Age field differs, got=%s, expected=%s",
record.Age, expected.Age)
}
}
}
можно переписать в:
import (
"testing"
"time"

"github.com/maxatome/go-testdeep/td"
)

func TestCreateRecord(t *testing.T) {
before := time.Now().Truncate(time.Second)
record, err := CreateRecord()

if td.CmpNoError(t, err) {
td.Cmp(t, record.Id, td.NotZero(), "Id initialized")
td.Cmp(t, record.Name, "Bob")
td.Cmp(t, record.Age, 23)
td.Cmp(t, record.CreatedAt, td.Between(before, time.Now()))
}
}

P.S. в проде не юзал но выглядит аккуратно, особенно когда происходит расхождение с ожидаемым результатом.
687 views12:33
Открыть/Комментировать
2021-03-16 13:37:08 Automatically Detecting and Fixing Concurrency Bugs in Go
Software Systems

https://songlh.github.io/paper/gcatch.pdf

Также у автора есть интересный репозиторий https://github.com/system-pclub/go-concurrency-bugs

Ну и список багов

https://docs.google.com/spreadsheets/d/1mDxB6IRxrTodF9CrmpUu72E6673y5s9BkjKuTjtx1qc/edit#gid=0

подсмотрел у https://twitter.com/dgryski
2.3K views10:37
Открыть/Комментировать
2021-03-15 20:10:55 Performance comparison: counting words in Python, Go, C++, C, AWK, Forth, and Rust

https://benhoyt.com/writings/count-words/
1.1K views17:10
Открыть/Комментировать