Go Tool That Sorts Methods by Call Graph Analysis
Posted4 months agoActive4 months ago
pkg.go.devTechstory
calmpositive
Debate
0/100
Go Programming LanguageCode OrganizationCall Graph Analysis
Key topics
Go Programming Language
Code Organization
Call Graph Analysis
A Go tool that sorts methods by call graph analysis has been released, helping with code organization.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
N/A
Peak period
1
0-6h
Avg / period
1
Key moments
- 01Story posted
Sep 6, 2025 at 9:37 AM EDT
4 months ago
Step 01 - 02First comment
Sep 6, 2025 at 9:37 AM EDT
0s after posting
Step 02 - 03Peak activity
1 comments in 0-6h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 10, 2025 at 9:16 AM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45149157Type: storyLast synced: 11/17/2025, 6:01:29 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
The Problem: Methods in Go structs are often randomly ordered, making code hard to follow. You end up with public entry points scattered between private helpers.
The Solution: gomsort analyzes your call graphs and sorts methods by: 1. Public methods first 2. Entry points (low call depth) before helpers 3. Shared utilities (high in-degree) at the bottom
Example transformation:
Features: - Works like go fmt - recursive by default - Integrates with golangci-lint - Preserves comments and semantics - Configurable via .msort.jsonInstall: go install github.com/borovikovd/gomsort@latest
Repo: https://github.com/borovikovd/gomsort
What do you think? Would this help your codebases?