Gogs — Dependencies#
Module info#
- Module:
gogs.io/gogs - Go version: 1.26.0
- Direct dependencies: 54
- Indirect dependencies: 75 (638 go.sum entries)
Dependency categories#
Core infrastructure#
gopkg.in/macaron.v1— Martini-inspired HTTP framework; the central web layer for routing, middleware, and renderinggithub.com/go-macaron/*(8 packages: binding, cache, captcha, csrf, gzip, i18n, session, toolbox) — the Macaron middleware ecosystem; form binding, session storage, CSRF, gzip compression, captcha, i18n, and debug toolboxgithub.com/urfave/cli/v3— CLI framework for top-level command parsing (serve, admin, backup, etc.)gopkg.in/ini.v1— INI file parsing forapp.ini; Gogs’ primary configuration formatunknwon.dev/clog/v2— structured logger maintained by the same community as several other unknwon.* depsgithub.com/cockroachdb/errors— error wrapping with stack traces and Sentry integration; mandated by CLAUDE.mdgithub.com/gogs/cron— cron scheduler for background jobs (own fork pinned to a 2017 commit)github.com/google/uuid— UUID generation for tokens and identifiers
Networking/HTTP#
golang.org/x/crypto— SSH server implementation, bcrypt password hashing, and other crypto primitivesgolang.org/x/net— net utilities (HTML parsing, HTTP/2 support via macaron)github.com/wneessen/go-mail— outbound email (SMTP) for notifications and invitesgithub.com/go-ldap/ldap/v3— LDAP authentication for enterprise deploymentsgithub.com/msteinert/pam— PAM authentication (Linux pluggable auth modules)github.com/google/go-github— GitHub OAuth integration (login via GitHub)github.com/pquerna/otp— TOTP/HOTP 2FA support; generates and validates OTP codes
Data/Storage#
gorm.io/gorm+gorm.io/driver/mysql+gorm.io/driver/postgres— primary ORM now (30 files); actively replacing xormxorm.io/xorm+xorm.io/core+xorm.io/builder— legacy ORM (15 files); still in use for older database models and schema migrationsgithub.com/glebarez/sqlite+github.com/glebarez/go-sqlite— CGo-free SQLite via modernc; the preferred SQLite path for cross-compilationgithub.com/go-redis/redis/v8(indirect via go-macaron/cache) — Redis backend for session/cachegithub.com/bradfitz/gomemcache(indirect via go-macaron/cache) — Memcache backend
Content rendering#
github.com/russross/blackfriday— Markdown to HTML rendering (v1; notably not v2)github.com/microcosm-cc/bluemonday— HTML sanitizer to prevent XSS in rendered Markdowngithub.com/niklasfasching/go-org— Org-mode document renderinggithub.com/sergi/go-diff— diff computation for inline diff display in PRsgithub.com/editorconfig/editorconfig-core-go/v2— EditorConfig detection for repository browsergithub.com/inbucket/html2text— HTML to plaintext conversion for email bodiesgithub.com/olekukonko/tablewriter— table formatting (used in CLI output)
Git integration#
github.com/gogs/git-module— Gogs’ own Git library; wrapsgitCLI commands for repository operations (clone, log, blame, diff, etc.)github.com/sourcegraph/run— command execution (used internally by git-module)github.com/Masterminds/semver/v3— semantic versioning for release tag handling
Identity and avatars#
github.com/gogs/chardet— character encoding detection (own fork of a Python port)github.com/gogs/go-libravatar— Libravatar/Gravatar URL generation for user avatarsgithub.com/issue9/identicon— default identicon generation for users without avatarsgolang.org/x/image— image decoding/resizing for uploaded avatarsgithub.com/unknwon/cae— ZIP/TAR archive extraction (for repository archives)
Internationalization#
github.com/unknwon/i18n+github.com/go-macaron/i18n— dual i18n layers (library + middleware)golang.org/x/text— Unicode normalization and encoding conversion
Observability#
github.com/prometheus/client_golang— Prometheus metrics exposition (/metricsendpoint)
Testing#
github.com/stretchr/testify— test assertions (requireandassert); mandated by CLAUDE.mdgithub.com/DATA-DOG/go-sqlmock— SQL mock for database unit testsgithub.com/derision-test/go-mockgen/v2— mock code generation for interfaces
Other#
github.com/gogs/minwinsvc— Windows service support (rare in Go web apps)github.com/unknwon/com— common utility functions (string, file, etc.)github.com/unknwon/paginater— pagination helper for list views
Stdlib reliance#
Gogs uses stdlib heavily. The most-referenced packages across internal/ are strings, fmt, time, net/http, context, os, path/filepath, and strconv. Because Macaron wraps net/http rather than replacing it, all HTTP handlers still operate on http.ResponseWriter and *http.Request directly. File I/O for repository operations also relies on os and path/filepath extensively. The project leans on stdlib as its foundation with third-party deps filling specific gaps (ORM, auth protocols, markup rendering).
Shared dependencies#
Dependencies likely to appear in other projects in the 50-project set:
github.com/stretchr/testify— near-universal in Go projectsgolang.org/x/crypto— common in any project doing SSH, TLS, or hashinggolang.org/x/net— commongolang.org/x/text— common where Unicode handling mattersgithub.com/prometheus/client_golang— standard in server-side Go servicesgorm.io/gorm— popular ORM shared with many web servicesgithub.com/google/uuid— very widely usedgopkg.in/ini.v1— appears in older Go projects (Gitea also uses it)github.com/cockroachdb/errors— less common but growing; shared with CockroachDB itselfgithub.com/urfave/cli/v3— popular CLI framework alternative to cobra
Vendoring#
No vendor/ directory. Gogs uses the Go module proxy. This is straightforward for a project with 54 direct deps, though the dual-ORM situation adds some module complexity. The absence of vendoring means build reproducibility relies on module proxy and go.sum integrity.
Notable dependency decisions#
Dual ORM in transition: Both
gorm.io/gorm(30 files) andxorm.io/xorm(15 files) are active simultaneously. GORM is clearly winning — new stores use GORM exclusively — but xorm remains for legacy models and the migration subsystem. This is a prolonged, careful migration rather than a flag-day switch, resulting in elevated dependency weight and two competing DB abstraction layers.Own ecosystem (
gogs/*): Gogs maintainsgit-module,chardet,cron,go-libravatar, andminwinsvcunder its own GitHub org. This gives tight control over Git integration and avoids depending on third-party libraries that might have different release cadences or break APIs. The tradeoff is maintenance burden on a small team.Blackfriday v1 (not v2): The project uses
russross/blackfridayv1 (2018-era), not v2. This is a legacy choice — v1 and v2 have incompatible APIs. Upgrading would require a larger refactor of the markup pipeline.CGo-free SQLite path:
glebarez/sqlite(modernc-based, pure Go) is listed as a direct dependency alongside the legacy CGomattn/go-sqlite3(indirect). This suggests an ongoing migration toward a pure-Go build for easier cross-compilation, particularly relevant for Raspberry Pi / ARM targets in Gogs’ core audience.cockroachdb/errorsas mandatory: The CLAUDE.md mandatescockroachdb/errorsfor all error handling. This is a sophisticated choice — it provides stack traces, Sentry integration (via the indirectgetsentry/sentry-go), sentinel error types, anderrors.Is/errors.Ascompatibility. It’s heavier thanpkg/errorsbut aligns with Gogs’ quality push.Windows service support:
gogs/minwinsvcenables Gogs to run as a native Windows service — an unusual capability for a Go web application, reflecting the project’s commitment to cross-platform self-hosted deployment.