Skip to content

cmd/dist: use of elf package adds 300k to dist binary size #15180

Description

@bradfitz

The cmd/dist binary imports the elf package (and thus the dwarf) binary, just for one use:

                case strings.Contains(out, "mips64"):
                        file, err := elf.Open(os.Args[0])
                        if err != nil {
                                fatal("failed to open %s to determine endianness: %v", os.Args[0], err)
                        }
                        if file.FileHeader.ByteOrder == binary.BigEndian {
                                gohostarch = "mips64"
                        } else {
                                gohostarch = "mips64le"
                        }

... for detecting the host architecture.

Can that be done cheaper?

(noticed while looking at reducing the GOROOT_BOOTSTRAP tarball size sent to builders)

Not super high priority, of course.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions