Zxilly/go-size-analyzer

Starting without file path should raise different error

Closed this issue · 2 comments

Right now, if you run gsa --help, you'll see that file argument marked as optional:

Usage:
  gsa [OPTIONS] [file]

However, if you actually launch it without providing a file, you get nondescript error:
level=ERROR msg="Error: open : no such file or directory"

Well, it's kinda says what is wrong, but it doesn't say how you fix it.

Essentially, an error comes from the fact that file is not optional and should be mandatory and invalid usage (without file name and possibly with multiple file inputs) should print usage instead

This has been fixed in the latest version, but for the time being I haven't released it because there is one other serious bug that prevents it.

In the new version, will see

Usage: gsa <file> [flags]

A tool for analysing the size of dependencies in compiled Golang binaries,
providing insight into their impact on the final build.

Arguments:
  <file>    Binary file to analyze

...[Collapsed]...

and a empty input will results to

Usage: gsa <file> [flags]

A tool for analysing the size of dependencies in compiled Golang binaries,
providing insight into their impact on the final build.

Arguments:
  <file>    Binary file to analyze

Flags:
  -h, --help             Show context-sensitive help.
      --verbose          Verbose output
  -f, --format="text"    Output format, possible values: text,json,html
      --hide-progress    Hide progress bar for disassembly
      --no-disasm        Skip disassembly pass
      --no-symbol        Skip symbol pass
  -o, --output=STRING    Write to file
      --version          Show version

Text output options
  --hide-sections    Hide sections
  --hide-main        Hide main package
  --hide-std         Hide standard library

Json output options
  --indent=INDENT    Indentation for json output

Web explorer options
  --web               use web interface to explore the details
  --listen=":8080"    listen address
  --open              Open browser

gsa: error: expected "<file>"