Copied from https://github.com/cloudfoundry/go-diodes to avoid test dependencies.