]> Cypherpunks repositories - gostls13.git/commit
go/parser: fix example to run on the playground
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 3 Apr 2017 14:18:30 +0000 (15:18 +0100)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 3 Apr 2017 16:07:09 +0000 (16:07 +0000)
commitd6b999436a5ad7f303c20c018867e1e118572fa0
tree118ab60513b2522df47928ddf48b08e9b4197910
parent26308fb4813377def1391ad4ea383f9178c2d16a
go/parser: fix example to run on the playground

The example shouldn't rely on the existance of example_test.go. That
breaks in the playground, which is what the "run" button in
https://golang.org/pkg/go/parser/#example_ParseFile does.

Make the example self-sufficient by using a small piece of source via a
string literal instead.

Fixes #19823.

Change-Id: Ie8a3c6c5d00724e38ff727862b62e6a3621adc88
Reviewed-on: https://go-review.googlesource.com/39236
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/parser/example_test.go