1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-16 02:47:03 +02:00

fix endpoint panic (#1291)

This commit is contained in:
zwhyb 2021-08-02 18:51:07 +08:00 committed by GitHub
parent 05e14e2a18
commit 5710bf0e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
app.go
View File

@ -69,7 +69,12 @@ func (a *App) Version() string { return a.opts.version }
func (a *App) Metadata() map[string]string { return a.opts.metadata }
// Endpoint returns endpoints.
func (a *App) Endpoint() []string { return a.instance.Endpoints }
func (a *App) Endpoint() []string {
if a.instance == nil {
return []string{}
}
return a.instance.Endpoints
}
// Run executes all OnStart hooks registered with the application's Lifecycle.
func (a *App) Run() error {