# Rust vs Go: source lines of code compared

The Rust vs Go comparison on OctoCounts shows side-by-side source line counts for rust-lang/rust and golang/go, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-20, rust-lang/rust contains 3,191,058 total lines (2,727,335 code) across 8,423 files, while golang/go contains 2,917,461 total lines (2,074,528 code) across 9,264 files as of 2026-09-16. rust-lang/rust is about 1.3x the size of golang/go by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [rust-lang/rust](https://octocounts.com/github/rust-lang/rust) | [golang/go](https://octocounts.com/github/golang/go) |
| --- | ---: | ---: |
| Files | 8,423 | 9,264 |
| Total lines | 3,191,058 | 2,917,461 |
| Code lines | 2,727,335 | 2,074,528 |
| Comment lines | 218,820 | 613,153 |
| Blank lines | 244,903 | 229,780 |
| Languages counted | 12 | 12 |

Top languages in rust-lang/rust: Rust (76.4% of code), JSON (12.9% of code), XML (5.8% of code). Top languages in golang/go: Go (91.0% of code), GNU Style Assembly (6.8% of code), Snakemake (1.0% of code). JSON, YAML appear in both top language lists; Rust, XML, Shell appear only in rust-lang/rust's top languages; Go, GNU Style Assembly, Snakemake appear only in golang/go's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. rust-lang/rust was counted at ref main (commit bba531001d4d) on 2026-09-20; golang/go was counted at ref ffd88e127c37923e6fe2e43f7fde7e5d1501094c (commit ffd88e127c37) on 2026-09-16. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

rust-lang/rust counts the Rust repository: the compiler (largely Rust itself), standard library, tooling, and a very large test suite. golang/go counts the Go repository: compiler toolchain, standard library, and runtime, also with its own test suites. Both are language toolchain monorepos, counted with the same engine and configuration on the dates above, which makes this one of the more like-for-like comparisons on this site.

Both repositories are self-hosting toolchains whose counted code is dominated by each project's own language, as the per-language tables show; the shares of C and assembly that remain mark the bootstrap and runtime boundaries each project still maintains by hand.

A large fraction of both trees is test material — the rustc test suite and the Go toolchain tests — so both counts substantially measure correctness infrastructure, not just shipped compiler code.

_Compiler repository size does not measure language quality, compile speed, or runtime performance — those are properties of the shipped toolchain and the programs it produces, not of the source tree's line count._

Sources: [rust-lang/rust repository](https://github.com/rust-lang/rust) · [golang/go repository](https://github.com/golang/go). Statements verified 2026-09-08.

Evidence and next steps:

- [rust-lang/rust SLOC report](https://octocounts.com/github/rust-lang/rust)
- [golang/go SLOC report](https://octocounts.com/github/golang/go)
- [Compare rust-lang/rust and golang/go interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Frust-lang%2Frust&right=https%3A%2F%2Fgithub.com%2Fgolang%2Fgo)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, rust-lang/rust or golang/go?

rust-lang/rust has more code: 2,727,335 code lines versus 2,074,528 for golang/go, about 1.3x as much, based on cached OctoCounts reports as of 2026-09-20.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for rust-lang/rust, golang/go, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. rust-lang/rust was counted at ref main (commit bba531001d4d) on 2026-09-20; golang/go was counted at ref ffd88e127c37923e6fe2e43f7fde7e5d1501094c (commit ffd88e127c37) on 2026-09-16. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
