go-check-interface

command
v0.0.0-...-8bdb91b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Basic example that demonstrates a type that doesn't implement an interface being flagged for a compile error when assigned to the interface.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Check whether a type implements an interface at run-time, using a conversion to interface{} and a type assertion.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Check whether a type implements an interface at run-time, using reflect.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL