Skip to content

Documentation on optimizing binary size #2365

Closed

Description

@abitrolly

In #2304 we've tried to trace what happened to build flags that helped to reduce binary size. The information in the thread appeared quite valuable to me, and I thought that urfave/cli is popular enough among Go beginners to share a tutorial on where the binary size comes from, and how to prove and optimize it (if possible).

I am not sure I am capable to write it myself in a concise and visually pleasing way with dumps, pictures and commands. So I leave this issue here to challenge other Go hackers.

Activity

  1. abitrolly commented on Jun 17, 2026

    @abitrolly
    ContributorAuthor

    #2366 solves 80% of the issue. The rest is using https://github.com/Zxilly/go-size-analyzer to see where bloat comes from. Then explain some techniques like syncing go.mod files to have the same dependency versions for different modules. Maybe something else, like why and how introspection bloats, how to remove it. Also how to remove templates that trigger introspection.

  2. imsumedhaa commented on Sep 12, 2026

    @imsumedhaa
    Contributor

    @abitrolly Hi! I'd like to work on this issue.
    I've started looking into the remaining parts from #2366, especially using go-size-analyzer to investigate binary size, and understanding the impact of dependency versions, reflection/introspection, and templates.

  3. kolyshkin commented on Sep 24, 2026

    @kolyshkin
    Contributor

    Related: #2441 / #2442

  4. linked a pull request that will close this issueAdd urfave_cli_no_template build tag #2441on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions