File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ func newCLIOption() *cliOption {
1414return & cliOption {
1515root : "" ,
1616create : false ,
17- stages : & optionSet {elements : make (map [ string ] struct {} )},
18- refreshes : & optionSet {elements : make (map [ string ] struct {} )},
19- only : & optionSet {elements : make (map [ string ] struct {} )},
20- exclude : & optionSet {elements : make (map [ string ] struct {} )},
17+ stages : & optionSet {elements : make ([] string , 0 )},
18+ refreshes : & optionSet {elements : make ([] string , 0 )},
19+ only : & optionSet {elements : make ([] string , 0 )},
20+ exclude : & optionSet {elements : make ([] string , 0 )},
2121}
2222}
2323
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ type migrationOption struct {
77
88func newOption () * migrationOption {
99return & migrationOption {
10- only : & optionSet {elements : make (map [ string ] struct {} )},
11- exclude : & optionSet {elements : make (map [ string ] struct {} )},
10+ only : & optionSet {elements : make ([] string , 0 )},
11+ exclude : & optionSet {elements : make ([] string , 0 )},
1212}
1313}
1414
Original file line number Diff line number Diff line change @@ -3,18 +3,21 @@ package migration
33import (
44"path/filepath"
55"regexp"
6+ "slices"
67"strings"
78
89"github.com/spf13/cobra"
910)
1011
1112type optionSet struct {
12- elements map [ string ] struct {}
13+ elements [] string
1314}
1415
1516func (s * optionSet ) Add (elements ... string ) {
1617for _ , element := range elements {
17- s .elements [element ] = struct {}{}
18+ if ! slices .Contains (s .elements , element ) {
19+ s .elements = append (s .elements , element )
20+ }
1821}
1922}
2023
@@ -23,11 +26,7 @@ func (s *optionSet) Size() int {
2326}
2427
2528func (s * optionSet ) Elements () []string {
26- keys := make ([]string , 0 , len (s .elements ))
27- for key := range s .elements {
28- keys = append (keys , key )
29- }
30- return keys
29+ return append ([]string {}, s .elements ... )
3130}
3231
3332// normalizePath join and normalize file path.
You can’t perform that action at this time.
0 commit comments