Commit Graph
4 Commits
Author SHA1 Message Date
Kir Kolyshkin 49e43beba3 Add urfave_cli_no_docs build tag
This removes the resulting binary dependency on cpuguy83/md2man and
russross/blackfriday, which saves more than 400 KB (more than 300 KB
once stripped) from the resulting binary.

Document this in README.
2022-04-25 10:16:31 -07:00
Kir Kolyshkin aabfea87c8 Move some test helpers from docs_test to fish_test
This is in preparation to make docs optional.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-25 10:04:40 -07:00
Kir Kolyshkin 81cb783759 Fix strconv.ParseFloat usage (#1335)
The bitSize argument of ParseFloat should either be 32 or 64, not 10.

Found by staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-02-16 21:29:15 -05:00
Kir Kolyshkin 3df9a3cd86 Don't call open("") (#1336)
strings.Split(s, sep) returns a slice of a single element containing s
if sep is not found in s. This is true even if s is empty.

As a result, every call to flagFromEnvOrFile results in an attempt to
open a file with empty name. This is seen from strace as

[pid 3287620] openat(AT_FDCWD, "", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3287620] openat(AT_FDCWD, "", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
...

To fix, check if the string is empty before calling ReadFile.

This also fixes cases where filePath is non-empty but has extra commas.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-02-15 08:28:44 -05:00