Skip to content

Commit 7cc25e3

Browse files
authored
Don't export TimeValue (yet)
1 parent d15848d commit 7cc25e3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

time.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import (
77
)
88

99
// TimeValue adapts time.Time for use as a flag.
10-
type TimeValue struct {
10+
type timeValue struct {
1111
*time.Time
1212
formats []string
1313
}
1414

15-
func newTimeValue(val time.Time, p *time.Time, formats []string) *TimeValue {
15+
func newTimeValue(val time.Time, p *time.Time, formats []string) *timeValue {
1616
*p = val
17-
return &TimeValue{
17+
return &timeValue{
1818
Time: p,
1919
formats: formats,
2020
}
2121
}
2222

2323
// 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 {
2525
s = strings.TrimSpace(s)
2626
for _, f := range d.formats {
2727
v, err := time.Parse(f, s)
@@ -44,11 +44,11 @@ func (d *TimeValue) Set(s string) error {
4444
}
4545

4646
// Type name for time.Time flags.
47-
func (d *TimeValue) Type() string {
47+
func (d *timeValue) Type() string {
4848
return "time"
4949
}
5050

51-
func (d *TimeValue) String() string { return d.Time.Format(time.RFC3339Nano) }
51+
func (d *timeValue) String() string { return d.Time.Format(time.RFC3339Nano) }
5252

5353
// GetTime return the time value of a flag with the given name
5454
func (f *FlagSet) GetTime(name string) (time.Time, error) {
@@ -63,7 +63,7 @@ func (f *FlagSet) GetTime(name string) (time.Time, error) {
6363
return time.Time{}, err
6464
}
6565

66-
val, ok := flag.Value.(*TimeValue)
66+
val, ok := flag.Value.(*timeValue)
6767
if !ok {
6868
return time.Time{}, fmt.Errorf("value %s is not a time", flag.Value)
6969
}

0 commit comments

Comments
 (0)