@@ -7,21 +7,21 @@ import (
7
7
)
8
8
9
9
// TimeValue adapts time.Time for use as a flag.
10
- type TimeValue struct {
10
+ type timeValue struct {
11
11
* time.Time
12
12
formats []string
13
13
}
14
14
15
- func newTimeValue (val time.Time , p * time.Time , formats []string ) * TimeValue {
15
+ func newTimeValue (val time.Time , p * time.Time , formats []string ) * timeValue {
16
16
* p = val
17
- return & TimeValue {
17
+ return & timeValue {
18
18
Time : p ,
19
19
formats : formats ,
20
20
}
21
21
}
22
22
23
23
// Set time.Time value from string based on accepted formats.
24
- func (d * TimeValue ) Set (s string ) error {
24
+ func (d * timeValue ) Set (s string ) error {
25
25
s = strings .TrimSpace (s )
26
26
for _ , f := range d .formats {
27
27
v , err := time .Parse (f , s )
@@ -44,11 +44,11 @@ func (d *TimeValue) Set(s string) error {
44
44
}
45
45
46
46
// Type name for time.Time flags.
47
- func (d * TimeValue ) Type () string {
47
+ func (d * timeValue ) Type () string {
48
48
return "time"
49
49
}
50
50
51
- func (d * TimeValue ) String () string { return d .Time .Format (time .RFC3339Nano ) }
51
+ func (d * timeValue ) String () string { return d .Time .Format (time .RFC3339Nano ) }
52
52
53
53
// GetTime return the time value of a flag with the given name
54
54
func (f * FlagSet ) GetTime (name string ) (time.Time , error ) {
@@ -63,7 +63,7 @@ func (f *FlagSet) GetTime(name string) (time.Time, error) {
63
63
return time.Time {}, err
64
64
}
65
65
66
- val , ok := flag .Value .(* TimeValue )
66
+ val , ok := flag .Value .(* timeValue )
67
67
if ! ok {
68
68
return time.Time {}, fmt .Errorf ("value %s is not a time" , flag .Value )
69
69
}
0 commit comments