Replacing interface{} with any everywhere (except generated mocks) (#29446)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a21d470bee
Коммит
d316df6d28
@@ -92,7 +92,7 @@ func parseLogMessage(msg string) (result LogEntry, err error) {
|
||||
result.Caller = s
|
||||
|
||||
default:
|
||||
var p interface{}
|
||||
var p any
|
||||
if err2 := dec.Decode(&p); err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
@@ -167,7 +167,7 @@ func numberToTime(v json.Number) (time.Time, error) {
|
||||
|
||||
// Decodes a value from JSON, coercing it to a string value as necessary
|
||||
func decodeAsString(dec *json.Decoder) (s string, err error) {
|
||||
var v interface{}
|
||||
var v any
|
||||
if err = dec.Decode(&v); err != nil {
|
||||
return s, err
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ type Printer struct { //nolint
|
||||
templateFuncs template.FuncMap
|
||||
pager bool
|
||||
Quiet bool
|
||||
Lines []interface{}
|
||||
Lines []any
|
||||
ErrorLines []string
|
||||
|
||||
cmd *cobra.Command
|
||||
@@ -85,7 +85,7 @@ func SetNoNewline(no bool) {
|
||||
printer.NoNewline = no
|
||||
}
|
||||
|
||||
func SetTemplateFunc(name string, f interface{}) {
|
||||
func SetTemplateFunc(name string, f any) {
|
||||
printer.templateFuncs[name] = f
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func SetSingle(single bool) {
|
||||
// PrintT prints an element. Depending on the format, the element can be
|
||||
// formatted and printed as a structure or used to populate the
|
||||
// template
|
||||
func PrintT(templateString string, v interface{}) {
|
||||
func PrintT(templateString string, v any) {
|
||||
if printer.Quiet {
|
||||
return
|
||||
}
|
||||
@@ -118,7 +118,7 @@ func PrintT(templateString string, v interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func PrintPreparedT(tpl *template.Template, v interface{}) {
|
||||
func PrintPreparedT(tpl *template.Template, v any) {
|
||||
if printer.Quiet {
|
||||
return
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func PrintPreparedT(tpl *template.Template, v interface{}) {
|
||||
// Print an element. If the format requires a template, the element
|
||||
// will be printed as a structure with field names using the print
|
||||
// verb %+v
|
||||
func Print(v interface{}) {
|
||||
func Print(v any) {
|
||||
PrintT("{{printf \"%+v\" .}}", v)
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ func Flush() error {
|
||||
printer.printErrors()
|
||||
|
||||
defer func() {
|
||||
printer.Lines = []interface{}{}
|
||||
printer.Lines = []any{}
|
||||
printer.ErrorLines = []string{}
|
||||
}()
|
||||
|
||||
@@ -231,12 +231,12 @@ func Flush() error {
|
||||
|
||||
// Clean resets the printer's accumulated lines
|
||||
func Clean() {
|
||||
printer.Lines = []interface{}{}
|
||||
printer.Lines = []any{}
|
||||
printer.ErrorLines = []string{}
|
||||
}
|
||||
|
||||
// GetLines returns the printer's accumulated lines
|
||||
func GetLines() []interface{} {
|
||||
func GetLines() []any {
|
||||
return printer.Lines
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user