The example is being run in the (Go Playground)[https://play.golang.org/]
which is run with various restrictions, including (filesystem restrictions)[https://blog.golang.org/playground#TOC_3.2.]. I dont think this example is supposed to run in the playground.
Does the example work when you copy it to a new package and include a valid 'example_test.go' file?
I think that's a bit overkill. If the purpose of the example was precisely to use a file via filename and not a string/bytes/reader via src, then we can just make the example write the sample source to disk first.