summaryrefslogtreecommitdiff
path: root/libgo/go/flag/flag.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-11 14:53:56 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-11 15:01:19 -0800
commit8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch)
tree43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/flag/flag.go
parent9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff)
downloadgcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz
libgo: update to Go1.18beta2
gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/flag/flag.go')
-rw-r--r--libgo/go/flag/flag.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/libgo/go/flag/flag.go b/libgo/go/flag/flag.go
index 885a4c83696..4e2af450c50 100644
--- a/libgo/go/flag/flag.go
+++ b/libgo/go/flag/flag.go
@@ -122,7 +122,7 @@ func (b *boolValue) Set(s string) error {
return err
}
-func (b *boolValue) Get() interface{} { return bool(*b) }
+func (b *boolValue) Get() any { return bool(*b) }
func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
@@ -152,7 +152,7 @@ func (i *intValue) Set(s string) error {
return err
}
-func (i *intValue) Get() interface{} { return int(*i) }
+func (i *intValue) Get() any { return int(*i) }
func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
@@ -173,7 +173,7 @@ func (i *int64Value) Set(s string) error {
return err
}
-func (i *int64Value) Get() interface{} { return int64(*i) }
+func (i *int64Value) Get() any { return int64(*i) }
func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
@@ -194,7 +194,7 @@ func (i *uintValue) Set(s string) error {
return err
}
-func (i *uintValue) Get() interface{} { return uint(*i) }
+func (i *uintValue) Get() any { return uint(*i) }
func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
@@ -215,7 +215,7 @@ func (i *uint64Value) Set(s string) error {
return err
}
-func (i *uint64Value) Get() interface{} { return uint64(*i) }
+func (i *uint64Value) Get() any { return uint64(*i) }
func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
@@ -232,7 +232,7 @@ func (s *stringValue) Set(val string) error {
return nil
}
-func (s *stringValue) Get() interface{} { return string(*s) }
+func (s *stringValue) Get() any { return string(*s) }
func (s *stringValue) String() string { return string(*s) }
@@ -253,7 +253,7 @@ func (f *float64Value) Set(s string) error {
return err
}
-func (f *float64Value) Get() interface{} { return float64(*f) }
+func (f *float64Value) Get() any { return float64(*f) }
func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
@@ -274,7 +274,7 @@ func (d *durationValue) Set(s string) error {
return err
}
-func (d *durationValue) Get() interface{} { return time.Duration(*d) }
+func (d *durationValue) Get() any { return time.Duration(*d) }
func (d *durationValue) String() string { return (*time.Duration)(d).String() }
@@ -305,7 +305,7 @@ type Value interface {
// by this package satisfy the Getter interface, except the type used by Func.
type Getter interface {
Value
- Get() interface{}
+ Get() any
}
// ErrorHandling defines how FlagSet.Parse behaves if the parse fails.
@@ -456,7 +456,7 @@ func isZeroValue(flag *Flag, value string) bool {
// This works unless the Value type is itself an interface type.
typ := reflect.TypeOf(flag.Value)
var z reflect.Value
- if typ.Kind() == reflect.Ptr {
+ if typ.Kind() == reflect.Pointer {
z = reflect.New(typ.Elem())
} else {
z = reflect.Zero(typ)
@@ -895,7 +895,7 @@ func Var(value Value, name string, usage string) {
}
// sprintf formats the message, prints it to output, and returns it.
-func (f *FlagSet) sprintf(format string, a ...interface{}) string {
+func (f *FlagSet) sprintf(format string, a ...any) string {
msg := fmt.Sprintf(format, a...)
fmt.Fprintln(f.Output(), msg)
return msg
@@ -903,7 +903,7 @@ func (f *FlagSet) sprintf(format string, a ...interface{}) string {
// failf prints to standard error a formatted error and usage message and
// returns the error.
-func (f *FlagSet) failf(format string, a ...interface{}) error {
+func (f *FlagSet) failf(format string, a ...any) error {
msg := f.sprintf(format, a...)
f.usage()
return errors.New(msg)