go-cloud: all: update non-local examples to compile but not run instead of expecting failure

The examples should ideally be fairly realistic and easy to copy and paste into real apps without too much modification. The output should show things working, not failures due to not being able to assume the example can access the network.

That’s not the current situation though. For example, in blob/gcsblob/example_test.go the expected output is

ReadAll failed due to invalid credentials.

One possible solution would be to put a line like this at the top of the example_test.go files:

// +build !no_network

and then pass -tag=no_network to go test within Travis. A downside would be that these examples would not be built or run from Travis, though presumably we would find out quickly if they are broken since people would try them and report any issues they find.

This solution isn’t perfect, but I think it beats the current situation where our examples don’t really make sense.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

Please wait, I have an opinion 😃.

Remove // Output?