Skip to content

text/template: bad format string for range-over-int error #69708

@jba

Description

@jba

Go version

go version devel go1.24-5fe3b31cf8 Fri Sep 27 16:45:09 2024 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'                                                                                                               
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/jba/.cache/go-build'                                                                           
GOENV='/usr/local/google/home/jba/.config/go/env'
GOEXE=''
GOEXPERIMENT='fieldtrack,boringcrypto'
GOFLAGS=''
GOHOSTARCH='amd64'                                                                                                             
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/jba/go/pkg/mod'                                                                             
GONOPROXY=''
GONOSUMDB=''                                                                                                                   
GOOS='linux'                                                                                                                   
GOPATH='/usr/local/google/home/jba/go'                                                                                         
GOPRIVATE=''
GOPROXY='https://proxy.golang.org'
GOROOT='/usr/lib/google-golang'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/google-golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23-20240626-RC01 cl/646990413 +5a18e79687 X:fieldtrack,boringcrypto'                                            
GODEBUG=''
GOTELEMETRY='on'                                                                                                               
GOTELEMETRYDIR='/usr/local/google/home/jba/.config/go/telemetry'                                                               
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'                                                                                                                     
CXX='clang++'                                                                                                                  
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/jba/repos/github.com/jba/templatecheck/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2774739339=/tmp/go-build -gno-record-gcc-switches'

What did you do?

template.Must(ttmpl.New("").Parse(`{{range $x, $y := .}}{{.}}{{end}}`))

where template is text/template

What did you see happen?

template: :1:18: executing "" at <.>: can't use %!s(int=5) to iterate over more than one variable

(emphasis mine)

What did you expect to see?

maybe

template: :1:18: executing "" at <.>: can't use int=5 to iterate over more than one variable

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions