]> Cypherpunks repositories - gostls13.git/commit
os: treat "${}" in Expand like in Go 1.10
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 29 Jun 2018 15:59:04 +0000 (16:59 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 29 Jun 2018 21:07:28 +0000 (21:07 +0000)
commita94a390e5cf802e54c95afb973c2f51be76f669e
treea76851a3ebb780f0d058031db783abdd836572b9
parenta5f8128e39d081c972e7bf3182122bac79bb6f8c
os: treat "${}" in Expand like in Go 1.10

CL 103055 made it so that invalid parameter expansions, like "$|", did
not make the dollar sign silently disappear.

A few edge cases were not taken into account, such as "${}" and "${",
which were now printing just "$". For consistency and to not break
existing programs, go back to eating up the characters when invalid
syntax is encountered.

For completeness, add a "$" test case too, even though its behavior is
unchanged by this CL.

Fixes #26135.

Change-Id: I5d25db9a8356dc6047a8502e318355113a99b247
Reviewed-on: https://go-review.googlesource.com/121636
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/env.go
src/os/env_test.go