Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10472700
format.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
668 B
Subscribers
None
format.go
View Options
package
multierror
import
(
"fmt"
"strings"
)
// ErrorFormatFunc is a function callback that is called by Error to
// turn the list of errors into a string.
type
ErrorFormatFunc
func
([]
error
)
string
// ListFormatFunc is a basic formatter that outputs the number of errors
// that occurred along with a bullet point list of the errors.
func
ListFormatFunc
(
es
[]
error
)
string
{
if
len
(
es
)
==
1
{
return
fmt
.
Sprintf
(
"1 error occurred:\n\t* %s\n\n"
,
es
[
0
])
}
points
:=
make
([]
string
,
len
(
es
))
for
i
,
err
:=
range
es
{
points
[
i
]
=
fmt
.
Sprintf
(
"* %s"
,
err
)
}
return
fmt
.
Sprintf
(
"%d errors occurred:\n\t%s\n\n"
,
len
(
es
),
strings
.
Join
(
points
,
"\n\t"
))
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 22, 6:52 AM (15 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3155456
Attached To
rWCLI writeas-cli
Event Timeline
Log In to Comment