mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-04 05:16:23 +08:00
Merge pull request #1183 from wking/remove-core-commands-internal-slice_util
core/commands/internal/slice_util: Remove this unused package
This commit is contained in:
@ -1,31 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
|
|
||||||
u "github.com/ipfs/go-ipfs/util"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CastToReaders(slice []interface{}) ([]io.Reader, error) {
|
|
||||||
readers := make([]io.Reader, 0)
|
|
||||||
for _, arg := range slice {
|
|
||||||
reader, ok := arg.(io.Reader)
|
|
||||||
if !ok {
|
|
||||||
return nil, u.ErrCast()
|
|
||||||
}
|
|
||||||
readers = append(readers, reader)
|
|
||||||
}
|
|
||||||
return readers, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CastToStrings(slice []interface{}) ([]string, error) {
|
|
||||||
strs := make([]string, 0)
|
|
||||||
for _, maybe := range slice {
|
|
||||||
str, ok := maybe.(string)
|
|
||||||
if !ok {
|
|
||||||
return nil, u.ErrCast()
|
|
||||||
}
|
|
||||||
strs = append(strs, str)
|
|
||||||
}
|
|
||||||
return strs, nil
|
|
||||||
}
|
|
Reference in New Issue
Block a user