design/29934-error-values.md: require that error be type assertable to As's target
design/29934-error-values.md: require that error be type assertable to As's target

Document As(err, target) as panicking when *target is not of interface
type and does not implement the error interface. While this prevents
some clever tricks, it permits catching (at runtime or statically
via vet) type errors equivalent to the ones that can be detected
by type assertions.

  if e := os.PathError{}; errors.As(err, &e) {  // error, os.PathError does not implement error
  if e := &os.PathError{}; errors.As(err, e) {  // error, os.PathError does not implement error
  if e := &os.PathError{}; errors.As(err, &e) { // ok

  var e interface{ Timeout() bool }
  if errors.As(&e) && e.Timeout() { // ok

Change-Id: Icfa8a1d4121601db458b1604fa57f6d1f38bc874
Reviewed-on: https://go-review.googlesource.com/c/161957
Reviewed-by: Jonathan Amsterdam <e3d3698b2ccd5955e4adf250d0785062d0f9018b@google.com>

golang/proposal,golang/proposal