[v2] docs(menu): add imports and complete the example (#4727)

* [v2] docs(menu): add imports and complete the example

- the example was missing imports, which [confused a user](https://stackoverflow.com/q/79827619/3431180), particularly due to the `rt` import alias
  - plus there are a good number of imports too, which this makes explicit
- it also didn't mention that it built on top of the `NewApp` / `app.go` scaffold, so mention and link to that as well
  - it wasn't clear where `NewApp` came from without that
  - give this file the title `menu.go` for clarity / explicitness
- also handle the error at the end similar to [existing examples](4c464b3092/website/docs/guides/application-development.mdx (L54))

* add changelog entry per PR template

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Anton Gilgur 2025-11-30 14:22:52 -05:00 committed by GitHub
commit cb3305a2fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -8,7 +8,7 @@ It is possible to add an application menu to Wails projects. This is achieved by
setting it in the [`Menu`](../reference/options.mdx#menu) application config, or by calling the runtime method setting it in the [`Menu`](../reference/options.mdx#menu) application config, or by calling the runtime method
[MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu). [MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu).
An example of how to create a menu: An example of how to create a menu, using [the `NewApp` scaffold](../guides/application-development.mdx):
```go ```go
app := NewApp() app := NewApp()

View file

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Updated menu reference docs with complete imports by @agilgur5 in [#4727](https://github.com/wailsapp/wails/pull/4727)
- Fixed menu reference syntax by @agilgur5 in [#4726](https://github.com/wailsapp/wails/pull/4726) - Fixed menu reference syntax by @agilgur5 in [#4726](https://github.com/wailsapp/wails/pull/4726)
- Fixed indentation in Application Development guide by @agilgur5 in [#4730](https://github.com/wailsapp/wails/pull/4730) - Fixed indentation in Application Development guide by @agilgur5 in [#4730](https://github.com/wailsapp/wails/pull/4730)
- Updated Application Development guide to show imports in the `app.go` snippets by @agilgur5 in [#4731](https://github.com/wailsapp/wails/pull/4731) - Updated Application Development guide to show imports in the `app.go` snippets by @agilgur5 in [#4731](https://github.com/wailsapp/wails/pull/4731)