• Russ Cox's avatar
    cmd/link: fix -X importpath.name=value when import path needs escaping · 1773cdd0
    Russ Cox authored
    After the final slash, dots are %-escaped when constructing a symbol name,
    so that in the actual symbol table, the import path githost.com/my.git
    becomes githost.com/my%2egit. In this case, -X githost.com/my.git.Value=foo
    needs to set githost.com/my%2egit.Value. This is a detail of the object format
    and not something users should know or depend on, so apply the escaping
    as needed.
    
    People who have run across this already and figured out and started using
    the escaped forms with -X will find those forms not working anymore.
    That is, -X githost.com/my%2egit.Value=foo is the Go 1.7 workaround but
    will stop working in Go 1.8 once this proper fix is in place.
    People who need to keep scripts working with older and newer versions of Go
    can safely pass both forms, and one will be ignored:
    
        -X githost.com/my%2egit.Value=foo -X githost.com/my.git.Value=foo
    
    Fixes #16710.
    
    Change-Id: I0e994ccdd412a4eb8349fefce9aeb3bfc9a83cd8
    Reviewed-on: https://go-review.googlesource.com/31970
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    1773cdd0
data.go 61.5 KB