diff --git a/go.mod b/go.mod index d271be5b3..01dad7433 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( k8s.io/code-generator v0.30.3 k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 - mvdan.cc/sh/v3 v3.9.0 + mvdan.cc/sh/v3 v3.10.0 sigs.k8s.io/controller-runtime v0.18.5 sigs.k8s.io/controller-tools v0.15.0 sigs.k8s.io/yaml v1.4.0 @@ -257,7 +257,7 @@ require ( github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.3.1 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect diff --git a/go.sum b/go.sum index c8d4dc6fa..fc8171f7a 100644 --- a/go.sum +++ b/go.sum @@ -337,8 +337,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lV github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= -github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/creack/pty v1.1.23 h1:4M6+isWdcStXEf15G/RbrMPOQj1dZ7HPZCGwE4kOeP0= +github.com/creack/pty v1.1.23/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/daixiang0/gci v0.12.3 h1:yOZI7VAxAGPQmkb1eqt5g/11SUlwoat1fSblGLmdiQc= @@ -987,8 +987,8 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1873,8 +1873,8 @@ mvdan.cc/editorconfig v0.3.0 h1:D1D2wLYEYGpawWT5SpM5pRivgEgXjtEXwC9MWhEY0gQ= mvdan.cc/editorconfig v0.3.0/go.mod h1:NcJHuDtNOTEJ6251indKiWuzK6+VcrMuLzGMLKBFupQ= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= -mvdan.cc/sh/v3 v3.9.0 h1:it14fyjCdQUk4jf/aYxLO3FG8jFarR9GzMCtnlvvD7c= -mvdan.cc/sh/v3 v3.9.0/go.mod h1:cdBk8bgoiBI7lSZqK5JhUuq7OB64VQ7fgm85xelw3Nk= +mvdan.cc/sh/v3 v3.10.0 h1:v9z7N1DLZ7owyLM/SXZQkBSXcwr2IGMm2LY2pmhVXj4= +mvdan.cc/sh/v3 v3.10.0/go.mod h1:z/mSSVyLFGZzqb3ZIKojjyqIx/xbmz/UHdCSv9HmqXY= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6KGVTx3Yu+/Uu9Es254w= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/modules.txt b/vendor/modules.txt index 94faf7f98..8795adc9b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1014,8 +1014,8 @@ github.com/rivo/uniseg # github.com/rodaine/hclencoder v0.0.1 ## explicit; go 1.14 github.com/rodaine/hclencoder -# github.com/rogpeppe/go-internal v1.12.0 -## explicit; go 1.20 +# github.com/rogpeppe/go-internal v1.13.1 +## explicit; go 1.22 github.com/rogpeppe/go-internal/diff github.com/rogpeppe/go-internal/fmtsort # github.com/russross/blackfriday/v2 v2.1.0 @@ -2224,7 +2224,7 @@ mvdan.cc/gofumpt/internal/govendor/go/doc/comment mvdan.cc/gofumpt/internal/govendor/go/format mvdan.cc/gofumpt/internal/govendor/go/printer mvdan.cc/gofumpt/internal/version -# mvdan.cc/sh/v3 v3.9.0 +# mvdan.cc/sh/v3 v3.10.0 ## explicit; go 1.22 mvdan.cc/sh/v3/cmd/shfmt mvdan.cc/sh/v3/fileutil diff --git a/vendor/mvdan.cc/sh/v3/cmd/shfmt/Dockerfile b/vendor/mvdan.cc/sh/v3/cmd/shfmt/Dockerfile index 604bab48f..5cd1a8189 100644 --- a/vendor/mvdan.cc/sh/v3/cmd/shfmt/Dockerfile +++ b/vendor/mvdan.cc/sh/v3/cmd/shfmt/Dockerfile @@ -1,11 +1,11 @@ -FROM golang:1.23.0-alpine AS build +FROM golang:1.23.2-alpine AS build WORKDIR /src RUN apk add --no-cache git COPY . . RUN CGO_ENABLED=0 go build -ldflags "-w -s -extldflags '-static' -X main.version=$(git describe --always --dirty --tags)" ./cmd/shfmt -FROM alpine:3.19.1 AS alpine +FROM alpine:3.20.3 AS alpine COPY --from=build /src/shfmt /bin/shfmt COPY "./cmd/shfmt/docker-entrypoint.sh" "/init" ENTRYPOINT ["/init"] diff --git a/vendor/mvdan.cc/sh/v3/cmd/shfmt/main.go b/vendor/mvdan.cc/sh/v3/cmd/shfmt/main.go index 78a6b35ca..18e5bee93 100644 --- a/vendor/mvdan.cc/sh/v3/cmd/shfmt/main.go +++ b/vendor/mvdan.cc/sh/v3/cmd/shfmt/main.go @@ -136,12 +136,12 @@ directory, all shell scripts found under that directory will be used. -s, --simplify simplify the code -mn, --minify minify the code to reduce its size (implies -s) --apply-ignore always apply EditorConfig ignore rules + --filename str provide a name for the standard input file Parser options: -ln, --language-dialect str bash/posix/mksh/bats, default "auto" -p, --posix shorthand for -ln=posix - --filename str provide a name for the standard input file Printer options: @@ -158,7 +158,9 @@ Utilities: --to-json print syntax tree to stdout as a typed JSON --from-json read syntax tree from stdin as a typed JSON -For more information, see 'man shfmt' and https://github.com/mvdan/sh. +Formatting options can also be read from EditorConfig files; see 'man shfmt' +for a detailed description of the tool's behavior. +For more information and to report bugs, see https://github.com/mvdan/sh. `) } flag.Parse() @@ -359,9 +361,9 @@ var ecQuery = editorconfig.Query{ RegexpCache: make(map[string]*regexp.Regexp), } -func propsOptions(lang syntax.LangVariant, props editorconfig.Section) { +func propsOptions(lang syntax.LangVariant, props editorconfig.Section) (_ syntax.LangVariant, validLang bool) { // if shell_variant is set to a valid string, it will take precedence - lang.Set(props.Get("shell_variant")) + langErr := lang.Set(props.Get("shell_variant")) syntax.Variant(lang)(parser) size := uint(0) @@ -380,6 +382,8 @@ func propsOptions(lang syntax.LangVariant, props editorconfig.Section) { syntax.KeepPadding(props.Get("keep_padding") == "true")(printer) // TODO(v4): rename to func_next_line for consistency with flags syntax.FunctionNextLine(props.Get("function_next_line") == "true")(printer) + + return lang, langErr == nil } func formatPath(path string, checkShebang bool) error { @@ -446,12 +450,13 @@ func editorConfigLangs(l syntax.LangVariant) []string { } func formatBytes(src []byte, path string, fileLang syntax.LangVariant) error { + fileLangFromEditorConfig := false if useEditorConfig { props, err := ecQuery.Find(path, editorConfigLangs(fileLang)) if err != nil { return err } - propsOptions(fileLang, props) + fileLang, fileLangFromEditorConfig = propsOptions(fileLang, props) } else { syntax.Variant(fileLang)(parser) } @@ -466,6 +471,9 @@ func formatBytes(src []byte, path string, fileLang syntax.LangVariant) error { node, err = parser.Parse(bytes.NewReader(src), path) if err != nil { if s, ok := err.(syntax.LangError); ok && lang.val == syntax.LangAuto { + if fileLangFromEditorConfig { + return fmt.Errorf("%w (parsed as %s via EditorConfig)", s, fileLang) + } return fmt.Errorf("%w (parsed as %s via -%s=%s)", s, fileLang, lang.short, lang.val) } return err diff --git a/vendor/mvdan.cc/sh/v3/cmd/shfmt/shfmt.1.scd b/vendor/mvdan.cc/sh/v3/cmd/shfmt/shfmt.1.scd index e47790e94..c490c138c 100644 --- a/vendor/mvdan.cc/sh/v3/cmd/shfmt/shfmt.1.scd +++ b/vendor/mvdan.cc/sh/v3/cmd/shfmt/shfmt.1.scd @@ -54,6 +54,12 @@ predictable. Some aspects of the format can be configured via printer flags. Should be useful to any tools or editors which format stdin or a single file. When printing results to stdout, an ignored file results in no output at all. +*--filename* str + Provide a name for the standard input file. + + Use of this flag is necessary for EditorConfig support to work with stdin, + since EditorConfig files are found relative to the location of a script. + ## Parser flags *-ln*, *--language-dialect* @@ -70,12 +76,6 @@ predictable. Some aspects of the format can be configured via printer flags. *-p*, *--posix* Shorthand for *-ln=posix*. -*--filename* str - Provide a name for the standard input file. - - Use of this flag is necessary for EditorConfig support to work with stdin, - since EditorConfig files are found relative to the location of a script. - ## Printer flags *-i*, *--indent* @@ -93,6 +93,9 @@ predictable. Some aspects of the format can be configured via printer flags. *-kp*, *--keep-padding* Keep column alignment paddings. + This flag is *DEPRECATED* and will be removed in the next major version. + For more information, see: https://github.com/mvdan/sh/issues/658 + *-fn*, *--func-next-line* Function opening braces are placed on a separate line. diff --git a/vendor/mvdan.cc/sh/v3/syntax/lexer.go b/vendor/mvdan.cc/sh/v3/syntax/lexer.go index 28f96df62..b90e8e1cc 100644 --- a/vendor/mvdan.cc/sh/v3/syntax/lexer.go +++ b/vendor/mvdan.cc/sh/v3/syntax/lexer.go @@ -70,17 +70,24 @@ retry: if p.bsp < uint(len(p.bs)) { if b := p.bs[p.bsp]; b < utf8.RuneSelf { p.bsp++ - if b == '\x00' { + switch b { + case '\x00': // Ignore null bytes while parsing, like bash. + p.col++ goto retry - } - if b == '\\' { + case '\r': + if p.peekByte('\n') { // \r\n turns into \n + p.col++ + goto retry + } + case '\\': if p.r == '\\' { } else if p.peekByte('\n') { p.bsp++ p.w, p.r = 1, escNewl return escNewl - } else if p.peekBytes("\r\n") { + } else if p.peekBytes("\r\n") { // \\\r\n turns into \\\n + p.col++ p.bsp += 2 p.w, p.r = 2, escNewl return escNewl @@ -89,8 +96,8 @@ retry: p.bsp < uint(len(p.bs)) && bquoteEscaped(p.bs[p.bsp]) { // We turn backquote command substitutions into $(), // so we remove the extra backslashes needed by the backquotes. - // For good position information, we still include them in p.w. bquotes++ + p.col++ goto retry } } @@ -100,7 +107,7 @@ retry: if p.litBs != nil { p.litBs = append(p.litBs, b) } - p.w, p.r = 1+bquotes, rune(b) + p.w, p.r = 1, rune(b) return p.r } if !utf8.FullRune(p.bs[p.bsp:]) { @@ -820,9 +827,6 @@ func (p *Parser) newLit(r rune) { func (p *Parser) endLit() (s string) { if p.r == utf8.RuneSelf || p.r == escNewl { s = string(p.litBs) - } else if p.r == '`' && p.w > 1 { - // If we ended at a nested and escaped backquote, litBs does not include the backslash. - s = string(p.litBs[:len(p.litBs)-1]) } else { s = string(p.litBs[:len(p.litBs)-p.w]) } diff --git a/vendor/mvdan.cc/sh/v3/syntax/parser.go b/vendor/mvdan.cc/sh/v3/syntax/parser.go index 580dab713..0bc10e869 100644 --- a/vendor/mvdan.cc/sh/v3/syntax/parser.go +++ b/vendor/mvdan.cc/sh/v3/syntax/parser.go @@ -4,7 +4,6 @@ package syntax import ( - "bytes" "fmt" "io" "strconv" @@ -24,7 +23,7 @@ func KeepComments(enabled bool) ParserOption { } // LangVariant describes a shell language variant to use when tokenizing and -// parsing shell code. The zero value is LangBash. +// parsing shell code. The zero value is [LangBash]. type LangVariant int const ( @@ -63,7 +62,7 @@ const ( // commonly used by end-user applications like shfmt, // which can guess a file's language variant given its filename or shebang. // - // At this time, the Parser does not support LangAuto. + // At this time, [Variant] does not support LangAuto. LangAuto ) @@ -144,7 +143,7 @@ func StopAt(word string) ParserOption { return func(p *Parser) { p.stopAt = []byte(word) } } -// NewParser allocates a new Parser and applies any number of options. +// NewParser allocates a new [Parser] and applies any number of options. func NewParser(options ...ParserOption) *Parser { p := &Parser{} for _, opt := range options { @@ -804,25 +803,25 @@ type LangError struct { } func (e LangError) Error() string { - var buf bytes.Buffer + var sb strings.Builder if e.Filename != "" { - buf.WriteString(e.Filename + ":") + sb.WriteString(e.Filename + ":") } - buf.WriteString(e.Pos.String() + ": ") - buf.WriteString(e.Feature) + sb.WriteString(e.Pos.String() + ": ") + sb.WriteString(e.Feature) if strings.HasSuffix(e.Feature, "s") { - buf.WriteString(" are a ") + sb.WriteString(" are a ") } else { - buf.WriteString(" is a ") + sb.WriteString(" is a ") } for i, lang := range e.Langs { if i > 0 { - buf.WriteString("/") + sb.WriteString("/") } - buf.WriteString(lang.String()) + sb.WriteString(lang.String()) } - buf.WriteString(" feature") - return buf.String() + sb.WriteString(" feature") + return sb.String() } func (p *Parser) posErr(pos Pos, format string, a ...any) { @@ -1341,7 +1340,7 @@ func (p *Parser) paramExp() *ParamExp { p.curErr("not a valid parameter expansion operator: %v", p.tok) case pe.Excl && p.r == '}': if !p.lang.isBash() { - p.posErr(pe.Pos(), `"${!foo`+p.tok.String()+`}" is a bash feature`) + p.posErr(pe.Pos(), `"${!foo%s}" is a bash feature`, p.tok) } pe.Names = ParNamesOperator(p.tok) p.next() diff --git a/vendor/mvdan.cc/sh/v3/syntax/printer.go b/vendor/mvdan.cc/sh/v3/syntax/printer.go index 55cf69fc8..b42f6f1ba 100644 --- a/vendor/mvdan.cc/sh/v3/syntax/printer.go +++ b/vendor/mvdan.cc/sh/v3/syntax/printer.go @@ -55,6 +55,11 @@ func SpaceRedirects(enabled bool) PrinterOption { // Note that this feature is best-effort and will only keep the // alignment stable, so it may need some human help the first time it is // run. +// +// Deprecated: this formatting option is flawed and buggy, and often does +// not result in what the user wants when the code gets complex enough. +// The next major version, v4, will remove this feature entirely. +// See: https://github.com/mvdan/sh/issues/658 func KeepPadding(enabled bool) PrinterOption { return func(p *Printer) { if enabled && !p.keepPadding { diff --git a/vendor/mvdan.cc/sh/v3/syntax/simplify.go b/vendor/mvdan.cc/sh/v3/syntax/simplify.go index 34059c629..7eef65ef2 100644 --- a/vendor/mvdan.cc/sh/v3/syntax/simplify.go +++ b/vendor/mvdan.cc/sh/v3/syntax/simplify.go @@ -3,7 +3,7 @@ package syntax -import "bytes" +import "strings" // Simplify modifies a node to remove redundant pieces of syntax, and returns // whether any changes were made. @@ -99,7 +99,7 @@ parts: if lit == nil { break } - var buf bytes.Buffer + var sb strings.Builder escaped := false for _, r := range lit.Value { switch r { @@ -118,9 +118,9 @@ parts: } escaped = false } - buf.WriteRune(r) + sb.WriteRune(r) } - newVal := buf.String() + newVal := sb.String() if newVal == lit.Value { break } diff --git a/vendor/mvdan.cc/sh/v3/syntax/typedjson/json.go b/vendor/mvdan.cc/sh/v3/syntax/typedjson/json.go index c2cc46bca..2400edea0 100644 --- a/vendor/mvdan.cc/sh/v3/syntax/typedjson/json.go +++ b/vendor/mvdan.cc/sh/v3/syntax/typedjson/json.go @@ -144,16 +144,16 @@ func encodeValue(val reflect.Value) (reflect.Value, string) { var ( noValue reflect.Value - anyType = reflect.TypeOf((*any)(nil)).Elem() // any - anySliceType = reflect.SliceOf(anyType) // []any - posType = reflect.TypeOf((*syntax.Pos)(nil)).Elem() // syntax.Pos - exportedPosType = reflect.TypeOf((*exportedPos)(nil)) // *exportedPos + anyType = reflect.TypeFor[any]() + anySliceType = reflect.TypeFor[[]any]() + posType = reflect.TypeFor[syntax.Pos]() + exportedPosType = reflect.TypeFor[*exportedPos]() // TODO(v4): derived fields like Type, Pos, and End should have clearly // different names to prevent confusion. For example: _type, _pos, _end. typeField = reflect.StructField{ Name: "Type", - Type: reflect.TypeOf((*string)(nil)).Elem(), + Type: reflect.TypeFor[string](), Tag: `json:",omitempty"`, } posField = reflect.StructField{ @@ -217,46 +217,46 @@ func (opts DecodeOptions) Decode(r io.Reader) (syntax.Node, error) { } var nodeByName = map[string]reflect.Type{ - "File": reflect.TypeOf((*syntax.File)(nil)).Elem(), - "Word": reflect.TypeOf((*syntax.Word)(nil)).Elem(), + "File": reflect.TypeFor[syntax.File](), + "Word": reflect.TypeFor[syntax.Word](), - "Lit": reflect.TypeOf((*syntax.Lit)(nil)).Elem(), - "SglQuoted": reflect.TypeOf((*syntax.SglQuoted)(nil)).Elem(), - "DblQuoted": reflect.TypeOf((*syntax.DblQuoted)(nil)).Elem(), - "ParamExp": reflect.TypeOf((*syntax.ParamExp)(nil)).Elem(), - "CmdSubst": reflect.TypeOf((*syntax.CmdSubst)(nil)).Elem(), - "CallExpr": reflect.TypeOf((*syntax.CallExpr)(nil)).Elem(), - "ArithmExp": reflect.TypeOf((*syntax.ArithmExp)(nil)).Elem(), - "ProcSubst": reflect.TypeOf((*syntax.ProcSubst)(nil)).Elem(), - "ExtGlob": reflect.TypeOf((*syntax.ExtGlob)(nil)).Elem(), - "BraceExp": reflect.TypeOf((*syntax.BraceExp)(nil)).Elem(), + "Lit": reflect.TypeFor[syntax.Lit](), + "SglQuoted": reflect.TypeFor[syntax.SglQuoted](), + "DblQuoted": reflect.TypeFor[syntax.DblQuoted](), + "ParamExp": reflect.TypeFor[syntax.ParamExp](), + "CmdSubst": reflect.TypeFor[syntax.CmdSubst](), + "CallExpr": reflect.TypeFor[syntax.CallExpr](), + "ArithmExp": reflect.TypeFor[syntax.ArithmExp](), + "ProcSubst": reflect.TypeFor[syntax.ProcSubst](), + "ExtGlob": reflect.TypeFor[syntax.ExtGlob](), + "BraceExp": reflect.TypeFor[syntax.BraceExp](), - "ArithmCmd": reflect.TypeOf((*syntax.ArithmCmd)(nil)).Elem(), - "BinaryCmd": reflect.TypeOf((*syntax.BinaryCmd)(nil)).Elem(), - "IfClause": reflect.TypeOf((*syntax.IfClause)(nil)).Elem(), - "ForClause": reflect.TypeOf((*syntax.ForClause)(nil)).Elem(), - "WhileClause": reflect.TypeOf((*syntax.WhileClause)(nil)).Elem(), - "CaseClause": reflect.TypeOf((*syntax.CaseClause)(nil)).Elem(), - "Block": reflect.TypeOf((*syntax.Block)(nil)).Elem(), - "Subshell": reflect.TypeOf((*syntax.Subshell)(nil)).Elem(), - "FuncDecl": reflect.TypeOf((*syntax.FuncDecl)(nil)).Elem(), - "TestClause": reflect.TypeOf((*syntax.TestClause)(nil)).Elem(), - "DeclClause": reflect.TypeOf((*syntax.DeclClause)(nil)).Elem(), - "LetClause": reflect.TypeOf((*syntax.LetClause)(nil)).Elem(), - "TimeClause": reflect.TypeOf((*syntax.TimeClause)(nil)).Elem(), - "CoprocClause": reflect.TypeOf((*syntax.CoprocClause)(nil)).Elem(), - "TestDecl": reflect.TypeOf((*syntax.TestDecl)(nil)).Elem(), + "ArithmCmd": reflect.TypeFor[syntax.ArithmCmd](), + "BinaryCmd": reflect.TypeFor[syntax.BinaryCmd](), + "IfClause": reflect.TypeFor[syntax.IfClause](), + "ForClause": reflect.TypeFor[syntax.ForClause](), + "WhileClause": reflect.TypeFor[syntax.WhileClause](), + "CaseClause": reflect.TypeFor[syntax.CaseClause](), + "Block": reflect.TypeFor[syntax.Block](), + "Subshell": reflect.TypeFor[syntax.Subshell](), + "FuncDecl": reflect.TypeFor[syntax.FuncDecl](), + "TestClause": reflect.TypeFor[syntax.TestClause](), + "DeclClause": reflect.TypeFor[syntax.DeclClause](), + "LetClause": reflect.TypeFor[syntax.LetClause](), + "TimeClause": reflect.TypeFor[syntax.TimeClause](), + "CoprocClause": reflect.TypeFor[syntax.CoprocClause](), + "TestDecl": reflect.TypeFor[syntax.TestDecl](), - "UnaryArithm": reflect.TypeOf((*syntax.UnaryArithm)(nil)).Elem(), - "BinaryArithm": reflect.TypeOf((*syntax.BinaryArithm)(nil)).Elem(), - "ParenArithm": reflect.TypeOf((*syntax.ParenArithm)(nil)).Elem(), + "UnaryArithm": reflect.TypeFor[syntax.UnaryArithm](), + "BinaryArithm": reflect.TypeFor[syntax.BinaryArithm](), + "ParenArithm": reflect.TypeFor[syntax.ParenArithm](), - "UnaryTest": reflect.TypeOf((*syntax.UnaryTest)(nil)).Elem(), - "BinaryTest": reflect.TypeOf((*syntax.BinaryTest)(nil)).Elem(), - "ParenTest": reflect.TypeOf((*syntax.ParenTest)(nil)).Elem(), + "UnaryTest": reflect.TypeFor[syntax.UnaryTest](), + "BinaryTest": reflect.TypeFor[syntax.BinaryTest](), + "ParenTest": reflect.TypeFor[syntax.ParenTest](), - "WordIter": reflect.TypeOf((*syntax.WordIter)(nil)).Elem(), - "CStyleLoop": reflect.TypeOf((*syntax.CStyleLoop)(nil)).Elem(), + "WordIter": reflect.TypeFor[syntax.WordIter](), + "CStyleLoop": reflect.TypeFor[syntax.CStyleLoop](), } func decodeValue(val reflect.Value, enc any) error {