go/api
Daniel Martí 28c1ad9d35 text/template: add variable assignments
Variables can be declared and shadowing is supported, but modifying
existing variables via assignments was not available.

This meant that modifying a variable from a nested block was not
possible:

	{{ $v := "init" }}
	{{ if true }}
		{{ $v := "changed" }}
	{{ end }}
	v: {{ $v }} {{/* "init" */}}

Introduce the "=" assignment token, such that one can now do:

	{{ $v := "init" }}
	{{ if true }}
		{{ $v = "changed" }}
	{{ end }}
	v: {{ $v }} {{/* "changed" */}}

To avoid confusion, rename PipeNode.Decl to PipeNode.Vars, as the
variables may not always be declared after this change. Also change a
few other names to better reflect the added ambiguity of variables in
pipelines.

Modifying the text/template/parse package in a backwards incompatible
manner is acceptable, given that the package godoc clearly states that
it isn't intended for general use. It's the equivalent of an internal
package, back when internal packages didn't exist yet.

To make the changes to the parse package sit well with the cmd/api test,
update except.txt with the changes that we aren't worried about.

Fixes #10608.

Change-Id: I1f83a4297ee093fd45f9993cebb78fc9a9e81295
Reviewed-on: https://go-review.googlesource.com/84480
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-04-04 15:51:56 +00:00
..
except.txt text/template: add variable assignments 2018-04-04 15:51:56 +00:00
go1.1.txt go/constant: switch to floating-point representation when fractions become too large 2015-12-14 23:42:01 +00:00
go1.2.txt api: add go1.2.txt, use in tests 2013-10-18 13:36:59 +09:00
go1.3.txt api: add go1.3.txt 2014-06-02 11:45:00 +09:00
go1.4.txt [release-branch.go1.4] api: create go1.4.txt 2014-12-12 14:01:01 +11:00
go1.5.txt api: update go1.5.txt 2015-07-30 21:14:09 +00:00
go1.6.txt go/types: rename Importer2 to ImporterFrom 2016-01-13 23:40:13 +00:00
go1.7.txt unicode: upgrade to version 9.0.0 2016-06-28 15:08:11 +00:00
go1.8.txt Revert "cmd/go: note when some Go files were ignored on no-Go-files errors" 2016-12-21 05:25:57 +00:00
go1.9.txt doc, api: add syscall.SysProcAttr.AmbientCaps change to 1.9 notes, API 2017-06-29 03:29:46 +00:00
go1.10.txt text/template: revert CL 66410 "add break, continue actions in ranges" 2018-02-06 05:00:01 +00:00
go1.txt encoding/xml: add, support Marshaler interface 2013-08-14 14:58:28 -04:00
next.txt api: promote next to go1.10 2017-12-07 15:44:34 +00:00
README text/template: add variable assignments 2018-04-04 15:51:56 +00:00

Files in this directory are data for Go's API checker ("go tool api", in src/cmd/api).

Each file is a list of API features, one per line.

go1.txt (and similarly named files) are frozen once a version has been
shipped. Each file adds new lines but does not remove any.

except.txt lists features that may disappear without breaking true
compatibility.

next.txt is the only file intended to be mutated. It's a list of
features that may be added to the next version. It only affects
warning output from the go api tool.