| --- |
| title: ImpossibleAssert |
| layout: article |
| --- |
| <!-- Copyright 2023 The Go Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style |
| license that can be found in the LICENSE file. --> |
| |
| <!-- Code generated by generrordocs.go; DO NOT EDIT. --> |
| |
| ``` |
| ImpossibleAssert occurs for a type assertion x.(T) when the value x of |
| interface cannot have dynamic type T, due to a missing or mismatching |
| method on T. |
| |
| Example: |
| type T int |
| |
| func (t *T) m() int { return int(*t) } |
| |
| type I interface { m() int } |
| |
| var x I |
| var _ = x.(T) |
| ``` |
| |