]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, cmd/link: encode cgo directives using JSON
authorMatthew Dempsky <mdempsky@google.com>
Wed, 11 Apr 2018 22:37:16 +0000 (15:37 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 11 Apr 2018 23:35:42 +0000 (23:35 +0000)
commit8f6ae3379615c6e9dcf47bafc74710a1346a932e
tree0e17f8407e66306ce46123d4dee900f187659d85
parent044d2d5af62001665cc28ce78757fc2831e78eeb
cmd/compile, cmd/link: encode cgo directives using JSON

The standard library has plenty of polished encoder/decoder
implementations. No need for another ad-hoc one.

I considered using encoding/gob instead, but these strings go into the
package data part of the object file, so it's important they don't
contain "\n$$\n". Package json escapes newlines in strings, so it's
safe to use here.

Change-Id: I998655524ccee7365c2c8e9a843e6975e95a3e62
Reviewed-on: https://go-review.googlesource.com/106463
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/fmt_test.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/lex_test.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/obj.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/util.go