mirror of
https://github.com/octoleo/restic.git
synced 2024-06-08 03:50:49 +00:00
avoid "index out of range" error
in case of len(format) == 0, we will get an "index out of range" error Usage of strings.HasSuffix is allowing to avoid that
This commit is contained in:
parent
38ddfbc4d3
commit
688014487b
|
@ -232,7 +232,7 @@ func Warnf(format string, args ...interface{}) {
|
|||
// Exitf uses Warnf to write the message and then terminates the process with
|
||||
// the given exit code.
|
||||
func Exitf(exitcode int, format string, args ...interface{}) {
|
||||
if format[len(format)-1] != '\n' {
|
||||
if !(strings.HasSuffix(format, "\n")) {
|
||||
format += "\n"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user