Beego — Dependencies#
Module info#
- Module:
github.com/beego/beego/v2 - Go version: 1.24.2
- Direct dependencies: 38
- Indirect dependencies: 40 (go.sum has 322 lines ≈ 161 unique entries, each line appears twice)
Dependency categories#
Core infrastructure#
github.com/mitchellh/mapstructurev1.5.0 — decoding map values into structs; used in the etcd config driver to unmarshal etcd key-value pairs into Go config structs.github.com/pelletier/go-tomlv1.9.5 — TOML format support forcore/config/tomldriver.gopkg.in/yaml.v3v3.0.1 — YAML format support forcore/config/yamldriver.github.com/beego/x2jv0.0.0-20131220205130 — XML-to-JSON conversion; used by the XML config driver.github.com/shiena/ansicolorv0.0.0-20230509 — ANSI colour codes on Windows forcore/logscoloured console output.github.com/google/uuidv1.6.0 — UUID generation for session IDs and request tracing.github.com/hashicorp/golang-lruv1.0.2 — LRU cache implementation; backing store for in-memory LRU cache adapter.github.com/valyala/bytebufferpoolv1.0.0 — pooled byte buffers for the ORM internal buffer subsystem (client/orm/internal/buffers).
Networking / HTTP#
google.golang.org/grpcv1.72.1 — gRPC transport used by the etcd client (etcd v3 speaks gRPC), also exposed viagrpc-ecosystem/go-grpc-prometheus.google.golang.org/protobufv1.36.6 — protobuf serialization, pulled in by grpc and used for the Alibaba log sink’s.pb.gofile (core/logs/alils/log.pb.go).github.com/gogo/protobufv1.3.2 — legacy protobuf library; pulled in as a transitive dependency of older components.github.com/grpc-ecosystem/go-grpc-prometheusv1.2.0 — Prometheus metrics middleware for the gRPC connection to etcd.golang.org/x/syncv0.14.0 —errgroup,singleflight, andsemaphoreutilities;client/cache/singleflight.gowrapssingleflight.Groupfor stampede protection.golang.org/x/cryptov0.38.0 — cryptographic primitives; used in session handling (bcrypt, HMAC) and TLS utilities.
Data / Storage#
github.com/go-sql-driver/mysqlv1.9.2 — MySQL driver for ORM (client/orm); registered via blank import.github.com/lib/pqv1.10.9 — PostgreSQL driver for ORM.github.com/mattn/go-sqlite3v1.14.28 — SQLite driver (CGO) for ORM; makes the module require CGO.github.com/gomodule/redigov1.8.8 (pinned viareplace) — classic Redis client; used byclient/cache/redisandserver/web/sessionRedis backend.github.com/redis/go-redis/v9v9.8.0 — modern Redis client; likely the newer session/cache backend introduced in v2.- **
github.com/bradfitz/gomemcachev0.0.0-20250403— Memcache client forclient/cache/memcache` and session Memcache backend. github.com/couchbase/go-couchbasev0.1.1 — Couchbase client for the Couchbase cache driver.- **
github.com/ledisdb/ledisdbv0.0.0-20200510— LedisDB embedded NoSQL; supportsclient/cache` LedisDB backend. - **
github.com/ssdb/gossdbv0.0.0-20180723` — SSDB client for the SSDB cache backend. github.com/elastic/go-elasticsearch/v6v6.8.10 — Elasticsearch v6 client for thecore/logs/eslog appender.github.com/bits-and-blooms/bloom/v3v3.5.0 — probabilistic bloom filter; used byclient/cacheto implement a cache stampede/miss protection bloom filter.- **
github.com/cloudflare/golz4v0.0.0-20240916` — LZ4 compression; used in the LedisDB backend or cache serialization path. github.com/elazarl/go-bindata-assetfsv1.0.1 — embeds static files (Swagger UI assets) into binary forserver/web/swagger.
Observability#
go.opentelemetry.io/otelv1.35.0 +/otel/trace+/otel/sdk+/otel/exporters/stdout/stdouttrace— OpenTelemetry tracing; integrated directly intoserver/web/filter/andclient/orm/filter/as first-class filter packages.github.com/opentracing/opentracing-gov1.2.0 — legacy OpenTracing API;server/web/filter/opentracing/,client/orm/filter/opentracing/, andclient/httplib/filter/opentracing/all implement OpenTracing filters alongside their OTel equivalents.github.com/prometheus/client_golangv1.22.0 — Prometheus metrics exposition;server/web/filter/prometheus/filter.gorecords HTTP request latency histograms.github.com/go-kit/kitv0.13.0 +github.com/go-kit/logv0.2.1 — go-kit log adapter for structured logging in components that want structured log output.
Authorization#
github.com/casbin/casbinv1.9.1 — RBAC/ABAC policy enforcement;server/web/filter/authz/authz.gowraps casbin as an HTTP filter to gate request authorization by policy.
Testing#
github.com/stretchr/testifyv1.10.0 —assertandrequirefor unit tests throughout the repo.
Config backends (distributed)#
go.etcd.io/etcd/client/v3v3.6.0 — etcd v3 client forcore/config/etcd— allows distributed config loading from an etcd cluster.
Stdlib reliance#
Beego leans heavily on the Go standard library for its core HTTP serving and routing path. Key stdlib packages in heavy use:
net/http— the entire web server builds directly on stdlib’s HTTP server; no third-party HTTP framework is used internally.database/sql— ORM sits directly atopdatabase/sql, using it for connection pooling and query execution.encoding/json,encoding/xml— config parsers and ORM serialization.context— propagated through ORM queries, HTTP handlers, and cache operations.sync,sync/atomic— session store locking, LRU cache concurrency, once-initialization of Prometheus vectors.html/template,text/template— template rendering in the web server.crypto/tls,crypto/hmac,crypto/sha256— session security and HTTPS.
Third-party dependencies are largely additive backends/drivers/adapters, not replacements for stdlib. The HTTP and ORM core stays on stdlib; third-party packages enter as drivers (MySQL, Redis) or optional integrations (OTel, Prometheus).
Shared dependencies#
Several of beego’s direct dependencies are also widely used across the 50-project corpus:
google.golang.org/grpc— shared with Consul, Vault, Nomad, etcd, Dapr, Istio, gRPC-gateway.google.golang.org/protobuf— shared with nearly all gRPC-using projects.go.opentelemetry.io/otel— shared with Dapr, Nomad, modern Consul builds.github.com/prometheus/client_golang— shared with almost every server-side project in the corpus.github.com/stretchr/testify— near-universal across the corpus.gopkg.in/yaml.v3— shared with Helm, Kubernetes-adjacent projects.golang.org/x/crypto— shared with Vault, Consul, most projects doing TLS.github.com/hashicorp/golang-lru— shared with Consul, Vault (HashiCorp ecosystem), though here adopted outside it.go.etcd.io/etcd/client/v3— shared with Nomad, Consul backends.
Vendoring#
Beego does not vendor its dependencies. There is no vendor/ directory. This is consistent with a framework library that expects consumers to manage their own module graphs. The one notable exception to “plain” module behavior is a replace directive pinning github.com/gomodule/redigo to v1.8.8, suggesting the transitive dependency graph pulls in an incompatible newer version that beego needed to lock down.
Notable dependency decisions#
Dual Redis clients (redigo + go-redis/v9): Beego ships both the classic
redigo(viareplacepin) and the moderngo-redis/v9. This reflects an evolutionary migration: the cache layer’sredissub-package still usesredigo, while newer session or cache backends were added usinggo-redis/v9. Thereplacedirective is a code smell —redigochanged its module path, forcing the pin.Dual tracing stacks (OpenTracing + OTel): Rather than migrating from OpenTracing to OpenTelemetry, beego ships both. This is intentional: users on legacy OpenTracing setups still work, while new users can adopt OTel. The cost is carrying both as direct deps.
CGO dependency (go-sqlite3):
github.com/mattn/go-sqlite3requires CGO. This is an unusual choice for a framework that otherwise compiles cleanly. It meansCGO_ENABLED=0builds (common in Docker) will fail if the SQLite driver package is included. Beego mitigates this by making drivers blank-import-based — SQLite support only activates if the user imports it.Niche storage backends as direct deps (LedisDB, SSDB, CouchBase): These are obscure datastores with low community adoption outside China. Their presence as direct deps (not optional sub-modules) bloats the module graph for users who need none of these backends. This is a known architectural tension in “batteries-included” frameworks — the cost of convenience is a heavier transitive graph.
Casbin for authz as a first-class filter: Rather than leaving authorization to the user, beego bundles casbin integration directly. This is unusual — most frameworks treat auth/authz as a community concern. It reflects beego’s enterprise-targeting philosophy.
go-kit/kit for structured logging integration:
go-kit/kitis a microservices toolkit, not just a logger. Beego pulls it in specifically for itsloginterface adapters, suggesting interoperability with go-kit service architectures was a design goal — a niche choice that adds a heavyweight transitive graph for logging alone.