Enforce use of any instead of interface{} (#30588)

Этот коммит содержится в:
Ben Schumacher
2025-03-31 10:44:34 +02:00
коммит произвёл GitHub
родитель 9aa4818c71
Коммит 166a676fe5
78 изменённых файлов: 268 добавлений и 262 удалений

Просмотреть файл

@@ -259,8 +259,8 @@ func Goto(toName Name) func(*Flow) (Name, State, error) {
}
}
func DialogGoto(toName Name) func(*Flow, map[string]interface{}) (Name, State, map[string]string, error) {
return func(_ *Flow, submitted map[string]interface{}) (Name, State, map[string]string, error) {
func DialogGoto(toName Name) func(*Flow, map[string]any) (Name, State, map[string]string, error) {
return func(_ *Flow, submitted map[string]any) (Name, State, map[string]string, error) {
stateUpdate := State{}
for k, v := range submitted {
stateUpdate[k] = fmt.Sprintf("%v", v)

Просмотреть файл

@@ -97,7 +97,7 @@ func (f *Flow) handleButton(fromName Name, selectedButton int, triggerID string)
}
func (f *Flow) handleDialog(
fromName Name, selectedButton int, submission map[string]interface{},
fromName Name, selectedButton int, submission map[string]any,
) (
*model.Post, map[string]string, error,
) {
@@ -105,7 +105,7 @@ func (f *Flow) handleDialog(
}
func (f *Flow) handle(
fromName Name, selectedButton int, submission map[string]interface{}, triggerID string, asButton bool,
fromName Name, selectedButton int, submission map[string]any, triggerID string, asButton bool,
) (
*model.Post, map[string]string, error,
) {

Просмотреть файл

@@ -9,7 +9,7 @@ import (
var errStateNotFound = errors.New("flow state not found")
// State is the "app"'s state
type State map[string]interface{}
type State map[string]any
func (s State) MergeWith(update State) State {
n := State{}

Просмотреть файл

@@ -50,7 +50,7 @@ type Button struct {
// Function that is called when the dialog box is submitted. It can return a
// general error, or field-specific errors. On success it returns the name
// of the next step, and the state updates to apply.
OnDialogSubmit func(f *Flow, submitted map[string]interface{}) (Name, State, map[string]string, error)
OnDialogSubmit func(f *Flow, submitted map[string]any) (Name, State, map[string]string, error)
}
func NewStep(name Name) Step {
@@ -229,7 +229,7 @@ func renderButton(b Button, stepName Name, i int, state State) *model.PostAction
Disabled: b.Disabled,
Style: string(b.Color),
Integration: &model.PostActionIntegration{
Context: map[string]interface{}{
Context: map[string]any{
contextStepKey: string(stepName),
contextButtonKey: strconv.Itoa(i),
},