Skip to content

Commit 5934553

Browse files
committed
opts: remove deprecated NewNamedListOptsRef, NewNamedMapOpts
These were deprecated in 6f0c66c and are no longer used. This removes the deprecated: - `NewNamedListOptsRef` - `NewNamedMapOpts` - `NamedListOpts` - `NamedMapOpts` - `NamedOption` Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent a056cc6 commit 5934553

File tree

2 files changed

+0
-98
lines changed

2 files changed

+0
-98
lines changed

opts/opts.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -125,43 +125,6 @@ func (opts *ListOpts) WithValidator(validator ValidatorFctType) *ListOpts {
125125
return opts
126126
}
127127

128-
// NamedOption is an interface that list and map options
129-
// with names implement.
130-
//
131-
// Deprecated: NamedOption is no longer used and will be removed in the next release.
132-
type NamedOption interface {
133-
Name() string
134-
}
135-
136-
// NamedListOpts is a ListOpts with a configuration name.
137-
// This struct is useful to keep reference to the assigned
138-
// field name in the internal configuration struct.
139-
//
140-
// Deprecated: NamedListOpts is no longer used and will be removed in the next release.
141-
type NamedListOpts struct {
142-
name string
143-
ListOpts
144-
}
145-
146-
var _ NamedOption = &NamedListOpts{}
147-
148-
// NewNamedListOptsRef creates a reference to a new NamedListOpts struct.
149-
//
150-
// Deprecated: NewNamedListOptsRef is no longer used and will be removed in the next release.
151-
func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctType) *NamedListOpts {
152-
return &NamedListOpts{
153-
name: name,
154-
ListOpts: *NewListOptsRef(values, validator),
155-
}
156-
}
157-
158-
// Name returns the name of the NamedListOpts in the configuration.
159-
//
160-
// Deprecated: NamedListOpts is no longer used and will be removed in the next release.
161-
func (o *NamedListOpts) Name() string {
162-
return o.name
163-
}
164-
165128
// MapOpts holds a map of values and a validation function.
166129
type MapOpts struct {
167130
values map[string]string
@@ -208,35 +171,6 @@ func NewMapOpts(values map[string]string, validator ValidatorFctType) *MapOpts {
208171
}
209172
}
210173

211-
// NamedMapOpts is a MapOpts struct with a configuration name.
212-
// This struct is useful to keep reference to the assigned
213-
// field name in the internal configuration struct.
214-
//
215-
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
216-
type NamedMapOpts struct {
217-
name string
218-
MapOpts
219-
}
220-
221-
var _ NamedOption = &NamedMapOpts{}
222-
223-
// NewNamedMapOpts creates a reference to a new NamedMapOpts struct.
224-
//
225-
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
226-
func NewNamedMapOpts(name string, values map[string]string, validator ValidatorFctType) *NamedMapOpts {
227-
return &NamedMapOpts{
228-
name: name,
229-
MapOpts: *NewMapOpts(values, validator),
230-
}
231-
}
232-
233-
// Name returns the name of the NamedMapOpts in the configuration.
234-
//
235-
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
236-
func (o *NamedMapOpts) Name() string {
237-
return o.name
238-
}
239-
240174
// ValidatorFctType defines a validator function that returns a validated string and/or an error.
241175
type ValidatorFctType func(val string) (string, error)
242176

opts/opts_test.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -360,38 +360,6 @@ func sampleValidator(val string) (string, error) {
360360
return "", fmt.Errorf("invalid key %s", k)
361361
}
362362

363-
func TestNamedListOpts(t *testing.T) {
364-
var v []string
365-
o := NewNamedListOptsRef("foo-name", &v, nil)
366-
367-
o.Set("foo")
368-
if o.String() != "[foo]" {
369-
t.Errorf("%s != [foo]", o.String())
370-
}
371-
if o.Name() != "foo-name" {
372-
t.Errorf("%s != foo-name", o.Name())
373-
}
374-
if len(v) != 1 {
375-
t.Errorf("expected foo to be in the values, got %v", v)
376-
}
377-
}
378-
379-
func TestNamedMapOpts(t *testing.T) {
380-
tmpMap := make(map[string]string)
381-
o := NewNamedMapOpts("max-name", tmpMap, nil)
382-
383-
o.Set("max-size=1")
384-
if o.String() != "map[max-size:1]" {
385-
t.Errorf("%s != [map[max-size:1]", o.String())
386-
}
387-
if o.Name() != "max-name" {
388-
t.Errorf("%s != max-name", o.Name())
389-
}
390-
if _, exist := tmpMap["max-size"]; !exist {
391-
t.Errorf("expected map-size to be in the values, got %v", tmpMap)
392-
}
393-
}
394-
395363
func TestValidateMACAddress(t *testing.T) {
396364
if _, err := ValidateMACAddress(`92:d0:c6:0a:29:33`); err != nil {
397365
t.Fatalf("ValidateMACAddress(`92:d0:c6:0a:29:33`) got %s", err)

0 commit comments

Comments
 (0)