• Daniel Martí's avatar
    os: treat "${}" in Expand like in Go 1.10 · a94a390e
    Daniel Martí authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    a94a390e
env_test.go 3.87 KB