Releases: gotd/td
v0.155.0
v0.154.0
Highlights
This release replaces the hard dependency on go.uber.org/zap
with the minimal, dependency-free github.com/gotd/log logging
port across all packages. This is a breaking change for any code that sets Logger on
telegram.Options (or any other gotd option struct that exposes a logger).
Why
zap leaked into the core dependency graph of every gotd consumer. gotd/log is a two-method
port (Enabled/Log) with no third-party dependencies; the concrete backend is chosen by the
consumer through a separate adapter module, so the backend's dependency never enters the core
graph. Levels match log/slog and scalar attributes avoid boxing on hot paths.
Migrating your loggers
The Logger fields changed type from *zap.Logger to github.com/gotd/log.Logger. Pick the
migration path that matches the logger you already use.
Keeping zap (smallest change)
Wrap your existing *zap.Logger with the logzap adapter:
import (
"go.uber.org/zap"
"github.com/gotd/log/logzap"
"github.com/gotd/td/telegram"
)
zapLog, _ := zap.NewProduction()
client := telegram.NewClient(appID, appHash, telegram.Options{
Logger: logzap.New(zapLog), // was: Logger: zapLog
})Add the adapter module to your build:
go get github.com/gotd/log/logzap@latestUsing the standard library log/slog (no extra deps beyond stdlib)
import (
"log/slog"
"github.com/gotd/log/logslog"
"github.com/gotd/td/telegram"
)
client := telegram.NewClient(appID, appHash, telegram.Options{
Logger: logslog.New(slog.Default()),
})Other backends
Drop-in adapter modules ship for the common loggers — import only the one you use, and its
dependency stays out of your core graph:
| Backend | Adapter module |
|---|---|
go.uber.org/zap |
github.com/gotd/log/logzap |
stdlib log/slog |
github.com/gotd/log/logslog |
github.com/rs/zerolog |
github.com/gotd/log/logzerolog |
github.com/sirupsen/logrus |
github.com/gotd/log/loglogrus |
No logger at all
If you previously passed zap.NewNop() (or nothing), no change is required — nil now defaults
to log.Nop, which discards every record. You can also pass log.Nop explicitly:
import "github.com/gotd/log"
telegram.Options{Logger: log.Nop}Writing your own log call sites
If your application logged through the same *zap.Logger you handed to gotd, you can keep using
zap directly — the migration only affects the value you pass into gotd options. If you want to log
against the gotd/log port itself, use the Helper for ergonomic call sites:
import "github.com/gotd/log"
h := log.For(l) // log.For(nil) is a no-op Helper
h.Info(ctx, "connected", log.String("dc", dc))What's Changed
Full Changelog: v0.153.0...v0.154.0
v0.153.0
What's Changed
- chore(deps): bump golang.org/x/tools from 0.45.0 to 0.46.0 in /_tools in the golang group by @dependabot[bot] in #1768
- chore(deps): bump golang.org/x/tools from 0.45.0 to 0.46.0 in the golang group by @dependabot[bot] in #1767
- Update Telegram schema to the latest layer by @gotd-bot[bot] in #1769
Full Changelog: v0.152.0...v0.153.0
v0.152.0
What's Changed
- feat(auth): safer 2FA password handling via protected memory (memguard) by @ernado in #1758
- feat(message): add sticker source helpers to send stickers by @ernado in #1759
- feat(faketls): generate browser-like ClientHello via uTLS by @ernado in #1760
- feat(peers): add channel/supergroup admin helpers by @ernado in #1761
- feat(peers): add channel recommendations helper by @ernado in #1762
- ci(coverage): run on self-hosted ubuntu runner by @ernado in #1763
- fix(calls): drain ICE notifier goroutines on Conn.Close by @ernado in #1764
- feat(tgtest): add personal-messages service by @ernado in #1765
- feat(message): add rich message builder and parsers by @ernado in #1766
Full Changelog: v0.151.0...v0.152.0
v0.151.0
What's Changed
- feat(message): link preview options (InvertMedia, WebPage builder) by @ernado in #1744
- feat(query): add GetMediaGroup helper for albums by @ernado in #1745
- feat(message): expose Spoiler option on media builders by @ernado in #1743
- feat(auth): add password recovery helpers by @ernado in #1746
- feat(clock): add NTP-calibrated network clock by @ernado in #1747
- feat(updates): add state-load failure callbacks by @ernado in #1748
- fix(telegram): retry requests on new connection after connection loss by @ernado in #1749
- feat(telegram): add connection state hook by @ernado in #1750
- feat(uploader): compute part size automatically for large files by @ernado in #1751
- feat(query): add GetMessages by-id helper by @ernado in #1752
- fix(tdesktop): prefer modern key_datas file over legacy 0/1 by @ernado in #1754
- feat(calls): 1:1 and group voice/video calls by @ernado in #1755
- chore(deps): bump golang.org/x/net from 0.55.0 to 0.56.0 in the golang group by @dependabot[bot] in #1756
Full Changelog: v0.150.0...v0.151.0
v0.150.0
v0.149.0
v0.148.0
What's Changed
- fix(message): propagate common send options by @expary in #1733
- fix(message): correct error wrap message in forward path by @ernado in #1734
- chore(deps): bump the golang group with 2 updates by @dependabot[bot] in #1735
Full Changelog: v0.147.0...v0.148.0
v0.147.0
v0.146.0
What's Changed
- chore(deps): bump codecov/codecov-action from 6 to 7 by @dependabot[bot] in #1727
- chore(deps): bump github.com/go-openapi/inflect from 0.21.5 to 0.21.6 by @dependabot[bot] in #1728
- fix(faketls): handle extra handshake and large records by @zenrot in #1729
- feat(updates): add OnTooLong hook for updates.differenceTooLong by @ernado in #1731
New Contributors
Full Changelog: v0.145.2...v0.146.0