Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed Jun 13, 2024
1 parent a33264f commit ec12eb5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/gatherlogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (m *manager) gatherFailureLogs(ctx context.Context) {
continue
}

m.log.Printf("%s: %s", steps.ShortFriendlyName(f), string(b))
m.log.Printf("%s: %s", steps.FriendlyName(f), string(b))
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/steps/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s actionStep) run(ctx context.Context, log *logrus.Entry) error {
}

func (s actionStep) String() string {
return fmt.Sprintf("[Action %s]", ShortFriendlyName(s.f))
return fmt.Sprintf("[Action %s]", FriendlyName(s.f))
}

func (s actionStep) metricsName() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/steps/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func enrichConditionTimeoutError(f conditionFunction, originalErr error) error {
}

func (c conditionStep) String() string {
return fmt.Sprintf("[Condition %s, timeout %s]", ShortFriendlyName(c.f), c.timeout)
return fmt.Sprintf("[Condition %s, timeout %s]", FriendlyName(c.f), c.timeout)
}

func (c conditionStep) metricsName() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/steps/refreshing.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *authorizationRefreshingActionStep) run(ctx context.Context, log *logrus
}

func (s *authorizationRefreshingActionStep) String() string {
return fmt.Sprintf("[AuthorizationRetryingAction %s]", ShortFriendlyName(s.f))
return fmt.Sprintf("[AuthorizationRetryingAction %s]", FriendlyName(s.f))
}

func (s *authorizationRefreshingActionStep) metricsName() string {
Expand Down
7 changes: 1 addition & 6 deletions pkg/util/steps/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import (

// FriendlyName returns a "friendly" stringified name of the given func.
func FriendlyName(f interface{}) string {
return strings.TrimSuffix(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), "-fm")
}

// FriendlyName returns a "friendly" stringified name of the given func.
func ShortFriendlyName(f interface{}) string {
return strings.TrimPrefix(FriendlyName(f), "github.com/Azure/ARO-RP/")
return strings.TrimPrefix(strings.TrimSuffix(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), "-fm"), "github.com/Azure/ARO-RP/")
}

func shortName(fullName string) string {
Expand Down

0 comments on commit ec12eb5

Please sign in to comment.