You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 20, 2025. It is now read-only.
Currently, important interfaces such as Display and Window are defined in the display package.
However, the display package must define an important function called display.NewDisplay(). You will then refer to the concrete implementation (e.g. win32.NewDisplay()).
Therefore, if an interface is defined within the display package, the display package cannot be referenced from environment-dependent packages (e.g. win32). This is because cross-package references occur.
To prevent this problem, separate display.NewDisplay() and interface definition packages. Simply add the gamen package and define the interface there.
@rajveermalviya Hi,
As recommended by the Go language, if a struct with methods satisfies an interface, you should indicate that in your code.
So the code is like this.
Currently, important interfaces such as Display and Window are defined in the display package.
However, the display package must define an important function called display.NewDisplay(). You will then refer to the concrete implementation (e.g. win32.NewDisplay()).
Therefore, if an interface is defined within the display package, the display package cannot be referenced from environment-dependent packages (e.g. win32). This is because cross-package references occur.
To prevent this problem, separate display.NewDisplay() and interface definition packages. Simply add the gamen package and define the interface there.