go/src
Daniel Martí 23e9dc7994 html/template: always write untyped nil as JS null
text/template recently added support for passing untyped nil as function
call arguments, as those would be mixed up with "missing argument"
values before. See CL 95215.

html/template now needs a small change to adapt to that new possibility.
In particular, when printing values as JS bytes, its code was written
under the assumption that the values would never be untyped nil - that
is, the reflect.Value would always be valid.

Short-circuit indirectToJSONMarshaler on an untyped nil, to avoid the
panic and fall back to the existing " null " output. Before this change
and on 1.10, printing a typed nil and an untyped nil resulted in:

	null ""

After this change, one will get:

	null null

Fixes #24717.

Change-Id: I03cd10ef64b96e837bacc9ccf4cf25624d80de1c
Reviewed-on: https://go-review.googlesource.com/109215
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-09 04:09:29 +00:00
..
archive archive/zip: avoid data descriptor when writing directories 2018-05-02 23:34:50 +00:00
bufio bufio: document ReadFrom/WriteTo calls to underlying methods 2018-03-28 22:21:52 +00:00
builtin builtin: improve docs for make slice 2017-11-18 01:48:52 +00:00
bytes bytes, strings: improve EqualFold fast version for ASCII 2018-05-01 18:52:19 +00:00
cmd cmd/compile: optimize map-clearing range idiom 2018-05-08 21:15:16 +00:00
compress compress/flate: do not rename math/bits import 2018-05-07 15:42:46 +00:00
container container/heap: fix comments style 2018-04-11 20:11:09 +00:00
context context: avoid defer in the cancelCtx.Err method 2018-04-15 21:35:53 +00:00
crypto cmd/compile,test: combine byte loads and stores on ppc64le 2018-05-08 13:15:39 +00:00
database/sql database/sql: make error prefixes consistent 2018-05-05 16:27:20 +00:00
debug debug/elf: add machine and OSABI constants 2018-05-08 14:49:42 +00:00
encoding encoding/binary: returns length of bool slice in intDataSize 2018-05-08 14:48:50 +00:00
errors
expvar all: use strings.Builder instead of bytes.Buffer where appropriate 2018-03-26 23:05:53 +00:00
flag flag: correct zero values when printing defaults 2018-04-01 20:17:22 +00:00
fmt fmt: make %v doc for compound objects consistent 2018-04-17 23:47:44 +00:00
go vendor, net/http: update x/net for httplex to httpguts merge 2018-05-07 20:20:49 +00:00
hash crypto: remove hand encoded amd64 instructions 2018-03-01 19:20:53 +00:00
html html/template: always write untyped nil as JS null 2018-05-09 04:09:29 +00:00
image all: fix non-standard "DO NOT EDIT" comments for generated files 2018-03-10 17:50:11 +00:00
index/suffixarray
internal internal/bytealg: add wasm architecture 2018-05-08 13:28:18 +00:00
io io: calculate buffer size only when needed 2018-05-06 15:52:31 +00:00
log all: skip unsupported tests for js/wasm 2018-04-30 19:39:18 +00:00
math math/big: implement Lehmer's extended GCD algorithm 2018-05-08 17:24:36 +00:00
mime mime: add wasm architecture 2018-04-13 20:20:12 +00:00
net net: make IPString benchmarks more representative. 2018-05-07 22:15:20 +00:00
os os: remove superfluous comments 2018-05-02 14:41:57 +00:00
path path/filepath: fix Win32 tests missing 'chcp' 2018-04-26 18:25:15 +00:00
plugin plugin: make stub lookup signature match dlopen version 2018-05-08 17:09:05 +00:00
reflect runtime: add js/wasm architecture 2018-05-08 00:17:34 +00:00
regexp regexp: use sync.Pool to cache regexp.machine objects 2018-04-03 16:03:19 +00:00
runtime runtime/trace: delete functions replaced by cl/108296 2018-05-09 00:05:52 +00:00
sort sort: fix typo in comment 2018-04-22 22:32:11 +00:00
strconv strconv: update Unquote example to be more concise 2018-05-07 20:39:37 +00:00
strings strings: fix encoding of \u0080 in map 2018-05-04 05:37:45 +00:00
sync sync/atomic: redirect many functions to runtime/internal/atomic 2018-05-03 21:35:01 +00:00
syscall syscall: eliminate aliasing of syscall error strings in Plan 9 2018-05-08 14:57:01 +00:00
testing testing: fix racey access to t.failed 2018-05-02 17:51:26 +00:00
text text/scanner: return RawString token rather than String for raw string literals 2018-05-08 04:59:41 +00:00
time cmd/vet: better align print warnings with fmt 2018-05-04 02:57:37 +00:00
unicode cmd/compile: optimize len([]rune(string)) 2018-05-06 05:31:01 +00:00
unsafe unsafe: fix reference to string header 2018-02-26 18:35:46 +00:00
vendor/golang_org/x vendor, net/http: update x/net for httplex to httpguts merge 2018-05-07 20:20:49 +00:00
all.bash Revert "build: fail nicely if somebody runs all.bash from a binary tarball package" 2017-04-28 21:19:32 +00:00
all.bat
all.rc
androidtest.bash androidtest.bash: don't require GOARCH set 2018-03-07 14:01:43 +00:00
bootstrap.bash bootstrap.bash: only fetch git revision if we need it 2018-01-30 15:11:56 +00:00
buildall.bash src/*.bash: use tabs consistently 2017-03-09 21:30:31 +00:00
clean.bash
clean.bat
clean.rc
cmp.bash all: make copyright headers consistent with one space after period 2016-11-04 20:46:25 +00:00
iostest.bash iostest.bash: don't build std library twice 2018-03-06 16:08:20 +00:00
make.bash src/*.bash: remove some trailing whitespace 2018-05-04 14:47:49 +00:00
make.bat build: small cleanup in error message in make.bat 2018-02-26 10:27:14 +00:00
Make.dist
make.rc build: quiet make.bash, make.bat, make.rc 2017-10-31 13:48:53 +00:00
naclmake.bash nacl*.bash: pass flags to make.bash 2018-02-14 17:09:31 +00:00
nacltest.bash nacl*.bash: pass flags to make.bash 2018-02-14 17:09:31 +00:00
race.bash src/*.bash: remove some trailing whitespace 2018-05-04 14:47:49 +00:00
race.bat
run.bash src/run.bash: remove some trailing whitespace 2018-04-01 16:12:47 +00:00
run.bat
run.rc