mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/flagutil: remove unused package
This commit is contained in:
parent
86d3d907a5
commit
6d6c9eb1f8
2 changed files with 0 additions and 52 deletions
|
@ -1,18 +0,0 @@
|
|||
package flagutil
|
||||
|
||||
import "strings"
|
||||
|
||||
// Array holds an array of flag values
|
||||
type Array []string
|
||||
|
||||
// String implements flag.Value interface
|
||||
func (a *Array) String() string {
|
||||
return strings.Join(*a, ",")
|
||||
}
|
||||
|
||||
// Set implements flag.Value interface
|
||||
func (a *Array) Set(value string) error {
|
||||
values := strings.Split(value, ",")
|
||||
*a = append(*a, values...)
|
||||
return nil
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package flagutil
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var fooFlag Array
|
||||
|
||||
func init() {
|
||||
os.Args = append(os.Args, "--fooFlag=foo", "--fooFlag=bar")
|
||||
flag.Var(&fooFlag, "fooFlag", "test")
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestArray(t *testing.T) {
|
||||
expected := map[string]struct{}{
|
||||
"foo": {},
|
||||
"bar": {},
|
||||
}
|
||||
if len(expected) != len(fooFlag) {
|
||||
t.Errorf("len array flag (%d) is not equal to %d", len(fooFlag), len(expected))
|
||||
}
|
||||
for _, i := range fooFlag {
|
||||
if _, ok := expected[i]; !ok {
|
||||
t.Errorf("unexpected item in array %v", i)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue