Skip to content

Commit 7fdb72b

Browse files
committed
some small adjustments of extractBuildInfo
1 parent a9b0e68 commit 7fdb72b

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

pkg/catalog/configurer.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ package catalog
22

33
import (
44
"context"
5+
"strings"
56

67
"google.golang.org/grpc/codes"
78
"google.golang.org/grpc/status"
89

910
configv1 "github.com/openkcm/plugin-sdk/proto/service/common/config/v1"
1011
)
1112

13+
const (
14+
defaultEmptyBuildInfo = "{}"
15+
)
16+
1217
type Configurers []*configurer
1318

1419
type configurer struct {
@@ -42,14 +47,17 @@ func (c *configurer) Configure(ctx context.Context) error {
4247
}
4348

4449
func extractBuildInfo(resp *configv1.ConfigureResponse) string {
45-
value := "{}"
4650
defer func() {
47-
if err := recover(); err != nil {
48-
value = "{}"
49-
}
51+
_ = recover()
5052
}()
5153

52-
value = resp.GetBuildInfo()
54+
if resp == nil {
55+
return defaultEmptyBuildInfo
56+
}
5357

58+
value := strings.TrimSpace(resp.GetBuildInfo())
59+
if value == "" {
60+
return defaultEmptyBuildInfo
61+
}
5462
return value
5563
}

0 commit comments

Comments
 (0)