-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
Go version
go version go1.23.5 linux/amd64
Output of go env in your module/workspace:
GO111MODULE='on'
GOARCH='amd64'
GOBIN='/home/jdemeyer/.local/bin'
GOCACHE='/home/jdemeyer/.cache/go-build'
GOENV='/home/jdemeyer/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jdemeyer/go/pkg/mod'
GONOPROXY='bitbucket.org/be-mobile'
GONOSUMDB='bitbucket.org/be-mobile'
GOOS='linux'
GOPATH='/home/jdemeyer/go'
GOPRIVATE='bitbucket.org/be-mobile'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/snap/go/10818'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/snap/go/10818/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.5'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/jdemeyer/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1587861785=/tmp/go-build -gno-record-gcc-switches'What did you do?
Actually, this problem came via using helm to template a Helm chart, but this is the essence of the problem in pure Go:
package main
import (
"io"
"text/template"
)
func main() {
const tmpl = "{{ gt .a .b }}"
var t = template.Must(template.New("test").Parse(tmpl))
args := map[string]any{
"a": 1.0, // Intentionally incomparable types
"b": 2,
}
err := t.Execute(io.Discard, args)
if err != nil {
panic(err)
}
}
What did you see happen?
panic: template: test:1:3: executing "test" at <gt .a .b>: error calling gt: incompatible types for comparison
What did you expect to see?
panic: template: test:1:3: executing "test" at <gt .a .b>: error calling gt: incompatible types for comparison: float64, int
It would be helpful to add in the error message which types are causing the incompatibility. When using text/template in Helm, there are many layers in between, so the error message incompatible types for comparison might not be easy to debug.
Metadata
Metadata
Assignees
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.