home.social

#golang — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #golang, aggregated by home.social.

  1. I've been neck deep in the PNG spec writing the metadata decoder/encoder for EXIF, XMP, IPTC, and native text. I do enjoy me some byte-level work.

  2. Валидатор не нашёл поле is_admin, а Go его нашёл: пять ошибок при работе с JSON

    Один и тот же JSON может привести систему к разным выводам. Валидатор пропустит поле, которое Go‑сервис спокойно прочитает, nil ‑слайс превратится в неожиданный для клиента null , а ошибка в имени параметра останется незамеченной до самого продакшена. Разбираем пять случаев, где поведение encoding/json в Go способно создать расхождение между компонентами системы, и смотрим, что меняет переход на encoding/json/v2 . Узнать детали

    habr.com/ru/companies/otus/art

    #Go #Golang #JSON #API #backend #микросервисы #валидация_данных #сериализация #безопасность_приложений #разработка_ПО

  3. NginXplorer: Because Spinning Up a 2GB Grafana Stack Just to Watch Nginx Logs is Madness

    It usually starts with an innocent thought on a Friday evening. You’re logged into a low-powered VPS or your homelab machine, and you notice your blog is feeling a bit sluggish. Or maybe you noticed a suspicious spike in inbound network bandwidth and you just want to know: Who is hammering my web server right now, what URLs are they hitting, and how badly is my upstream PHP-FPM or reverse proxy sweating? Naturally, you look at your options in 2026: The “Modern Cloud-Native” […]

    schulz.dk/2026/09/14/nginxplor

  4. Most guides I found on Go backend services cover the code inside the service, with little on the production problems around it: configuration, lifecycle, observability, packaging, deployment.
    My new guide, Building a Production REST API in Go, covers all of these alongside a working example service: tecnick.com/guides/go-rest-api/
    #golang #restapi #backend #softwareengineering

  5. Hey #golang folks, I have a service listening on some port (say 4321) and the #systemd service file has
    ```
    SocketBindAllow=tcp:4321
    SocketBindDeny=any
    ```

    When my service makes an _outgoing_ connection by calling
    ```
    var dialer net.Dialer
    dialer.DialContext(ctx, "tcp", "somehost.example.com:5678")
    ```
    the service gets a permission error for violating the SocketBind* systemd restrictions.

    But only when using the cgo resolver. Setting `GODEBUG=netdns=go` fixes the error. So what is the cgo resolver doing that requires binding a socket?

  6. Hey folks, I have a service listening on some port (say 4321) and the service file has
    ```
    SocketBindAllow=tcp:4321
    SocketBindDeny=any
    ```

    When my service makes an _outgoing_ connection by calling
    ```
    var dialer net.Dialer
    dialer.DialContext(ctx, "tcp", "somehost.example.com:5678")
    ```
    the service gets a permission error for violating the SocketBind* systemd restrictions.

    But only when using the cgo resolver. Setting `GODEBUG=netdns=go` fixes the error. So what is the cgo resolver doing that requires binding a socket?

  7. Trying to understand #golang. It seems to have quite some "implicit (and short) is better than explicit (and longer)"-features 🙄

  8. WGX is now ihasvpn, and it's been rewritten from scratch.

    The old WGX was a Bash installer that assembled a VPN on your host. The new one is a WireGuard server of its own: one static Go binary in one container, driving kernel WireGuard over netlink, with a web console built in.

    Free software, AGPL-3.0.

    jcoffey.dev/articles/wgx-is-no

    #WireGuard #SelfHosted #Golang #OpenSource #VPN

  9. WGX is now ihasvpn, and it's been rewritten from scratch.

    The old WGX was a Bash installer that assembled a VPN on your host. The new one is a WireGuard server of its own: one static Go binary in one container, driving kernel WireGuard over netlink, with a web console built in.

    Free software, AGPL-3.0.

    jcoffey.dev/articles/wgx-is-no

    #WireGuard #SelfHosted #Golang #OpenSource #VPN

  10. WGX is now ihasvpn, and it's been rewritten from scratch.

    The old WGX was a Bash installer that assembled a VPN on your host. The new one is a WireGuard server of its own: one static Go binary in one container, driving kernel WireGuard over netlink, with a web console built in.

    Free software, AGPL-3.0.

    jcoffey.dev/articles/wgx-is-no

    #WireGuard #SelfHosted #Golang #OpenSource #VPN

  11. I'm sure many older programmers will grunt at seeing this mentioned, but as much as AI annoys me just as much as the next guy (because of AI slop, increased hardware costs and stuff like that)...

    ... I can't deny that it feels like it's easier than ever to start learning to program these days.

    You've got yourself a personal tutor who guides you through step by step and answers all of your questions you might be wondering.

    You'll never be completely stuck.

    Learning #Golang with Gemini atm

  12. After reading about Hyrum-proofing in encoding/json/v2 I made a tiny errors compatible module doing exactly that.

    codeberg.org/vyskocilm/herrors

    #golang

  13. Документация, которая не врёт

    С документацией к API есть две крайности, и обе плохие: написанная руками врёт через полгода, сгенерированная целиком стирает всё осмысленное, что в неё написали. Я перестал выбирать между ними и поделил файл: структура принадлежит коду и синхронизируется без спроса, проза принадлежит человеку и не трогается никогда. Заодно оказалось, что документацию можно проверять как golden-файл, и что проверить нельзя прозу, а вот её отсутствие можно.

    habr.com/ru/articles/1080460/

    #openapi #swagger #go #golang #документация_api #кодогенерация #rest_api #golden_tests #рефлексия #gorib

  14. Документация, которая не врёт

    С документацией к API есть две крайности, и обе плохие: написанная руками врёт через полгода, сгенерированная целиком стирает всё осмысленное, что в неё написали. Я перестал выбирать между ними и поделил файл: структура принадлежит коду и синхронизируется без спроса, проза принадлежит человеку и не трогается никогда. Заодно оказалось, что документацию можно проверять как golden-файл, и что проверить нельзя прозу, а вот её отсутствие можно.

    habr.com/ru/articles/1080460/

    #openapi #swagger #go #golang #документация_api #кодогенерация #rest_api #golden_tests #рефлексия #gorib

  15. Документация, которая не врёт

    С документацией к API есть две крайности, и обе плохие: написанная руками врёт через полгода, сгенерированная целиком стирает всё осмысленное, что в неё написали. Я перестал выбирать между ними и поделил файл: структура принадлежит коду и синхронизируется без спроса, проза принадлежит человеку и не трогается никогда. Заодно оказалось, что документацию можно проверять как golden-файл, и что проверить нельзя прозу, а вот её отсутствие можно.

    habr.com/ru/articles/1080460/

    #openapi #swagger #go #golang #документация_api #кодогенерация #rest_api #golden_tests #рефлексия #gorib

  16. zendis v0.4.0

    zendis is a disassembler for the Z80 and Z80N

    zendis is a new sibling to zen80 (a Z80/Z80N CPU core) to zenas (a Z80/Z80N assembler) and to ZenZX, the companion ZX Spectrum emulator that reuses the former.

    Its hex output format matches what zenas accepts as input, so a zendis listing can be fed straight back into zenas, it can interpret plain .bin files at a starting --org address, and it can reuse the zentools sibling library to import .tap, .tzx, .pzx .sna, .szx and .z80 Spectrum binaries.

    It supports various output formats, including formats compatible with other Z80 assemblers: plain / listing / json / zenas / pasmo / sjasmplus / snasm.
    The listing format is the default and it prefixes every line with the resulting memory address for each instruction (pictured below). The plain format is just the instructions without addresses. The JSON output format allows for feeding zendis output into other tooling and pipelines.

    Repo:
    github.com/ha1tch/zendis#readme

    Binaries released for 17 modern architecture/platform pairs
    github.com/ha1tch/zendis/relea

    #zenas #zendis #disassembler #disassembly #z80 #z80n #retrocomputing #golang #foss #programming

  17. zenas v0.11.2

    update:

    This version extends coverage of the Z80 instruction set implementing various undocumented instructions, and extends compatibility features with pasmo and sjasmplus, as well as some minor bugfixes.

    Binary releases for 17 modern architecture/platform pairs:
    github.com/ha1tch/zenas/releas

    #zenas #assembler #Z80 #Z80N #assembly #asm #golang #foss

  18. Как лень довела меня до написания кодогенератора

    Лень — двигатель прогресса. Я очень ленив, поэтому прогресс должен был выйти впечатляющим. Спойлер: он и вышел, но с ленью что-то пошло не так. Началось с того, что я предложил взять go-playground/validator — и услышал, что рефлексия нас замедлит. Бенчмарки показали единицы микросекунд на структуру: примерно столько же, сколько json.Unmarshal того же тела, и на три порядка меньше похода в базу двумя строками ниже. Решение всё равно осталось прежним. Поэтому я убрал рантайм целиком: разбор запроса и валидация генерируются из тегов структуры на этапе сборки. Опечатка в теге стала ошибкой генерации, а не пропущенной проверкой. Транспорт и вовсе оказался ни при чём. Ниже — как это выглядит, чего генератор делать отказывается и чем я за это заплатил.

    habr.com/ru/articles/1077792/

    #go #golang #кодогенерация #валидация #рефлексия

  19. Как лень довела меня до написания кодогенератора

    Лень — двигатель прогресса. Я очень ленив, поэтому прогресс должен был выйти впечатляющим. Спойлер: он и вышел, но с ленью что-то пошло не так. Началось с того, что я предложил взять go-playground/validator — и услышал, что рефлексия нас замедлит. Бенчмарки показали единицы микросекунд на структуру: примерно столько же, сколько json.Unmarshal того же тела, и на три порядка меньше похода в базу двумя строками ниже. Решение всё равно осталось прежним. Поэтому я убрал рантайм целиком: разбор запроса и валидация генерируются из тегов структуры на этапе сборки. Опечатка в теге стала ошибкой генерации, а не пропущенной проверкой. Транспорт и вовсе оказался ни при чём. Ниже — как это выглядит, чего генератор делать отказывается и чем я за это заплатил.

    habr.com/ru/articles/1077792/

    #go #golang #кодогенерация #валидация #рефлексия

  20. Как лень довела меня до написания кодогенератора

    Лень — двигатель прогресса. Я очень ленив, поэтому прогресс должен был выйти впечатляющим. Спойлер: он и вышел, но с ленью что-то пошло не так. Началось с того, что я предложил взять go-playground/validator — и услышал, что рефлексия нас замедлит. Бенчмарки показали единицы микросекунд на структуру: примерно столько же, сколько json.Unmarshal того же тела, и на три порядка меньше похода в базу двумя строками ниже. Решение всё равно осталось прежним. Поэтому я убрал рантайм целиком: разбор запроса и валидация генерируются из тегов структуры на этапе сборки. Опечатка в теге стала ошибкой генерации, а не пропущенной проверкой. Транспорт и вовсе оказался ни при чём. Ниже — как это выглядит, чего генератор делать отказывается и чем я за это заплатил.

    habr.com/ru/articles/1077792/

    #go #golang #кодогенерация #валидация #рефлексия

  21. Разработчику нужно знать семь языков. Python, Go и Java в этот список не входят

    Бывает так: код хороший, задачи закрыты, к технической части претензий нет. Но и повышения тоже нет. Или идею не взяли. А на интервью — отказ без внятной причины. Каждый раз я понимал, что дело не в инженерных скиллах. Только понимал медленно — на каждый такой инсайт уходили месяцы и годы. И стоило разобраться с одной ситуацией, как наваливалась следующая, где работал совсем другой механизм. 7 уроков

    habr.com/ru/articles/1074648/

    #Golang #Java #Python #CEO #CTO #карьера_программиста #факапы