Don't use fmt.Sprintf for constant strings (#29799)

Этот коммит содержится в:
Ben Schumacher
2025-01-10 10:47:20 +01:00
коммит произвёл GitHub
родитель 95b22f47a0
Коммит ca439e73f3

Просмотреть файл

@@ -196,7 +196,7 @@ func (c *Client4) userCategoryRoute(userID, teamID string) string {
}
func (c *Client4) userAccessTokensRoute() string {
return fmt.Sprintf(c.usersRoute() + "/tokens")
return c.usersRoute() + "/tokens"
}
func (c *Client4) userAccessTokenRoute(tokenId string) string {
@@ -240,15 +240,15 @@ func (c *Client4) teamMemberRoute(teamId, userId string) string {
}
func (c *Client4) teamMembersRoute(teamId string) string {
return fmt.Sprintf(c.teamRoute(teamId) + "/members")
return c.teamRoute(teamId) + "/members"
}
func (c *Client4) teamStatsRoute(teamId string) string {
return fmt.Sprintf(c.teamRoute(teamId) + "/stats")
return c.teamRoute(teamId) + "/stats"
}
func (c *Client4) teamImportRoute(teamId string) string {
return fmt.Sprintf(c.teamRoute(teamId) + "/import")
return c.teamRoute(teamId) + "/import"
}
func (c *Client4) channelsRoute() string {
@@ -256,7 +256,7 @@ func (c *Client4) channelsRoute() string {
}
func (c *Client4) channelsForTeamRoute(teamId string) string {
return fmt.Sprintf(c.teamRoute(teamId) + "/channels")
return c.teamRoute(teamId) + "/channels"
}
func (c *Client4) channelRoute(channelId string) string {
@@ -268,7 +268,7 @@ func (c *Client4) channelByNameRoute(channelName, teamId string) string {
}
func (c *Client4) channelsForTeamForUserRoute(teamId, userId string, includeDeleted bool) string {
route := fmt.Sprintf(c.userRoute(userId) + c.teamRoute(teamId) + "/channels")
route := c.userRoute(userId) + c.teamRoute(teamId) + "/channels"
if includeDeleted {
query := fmt.Sprintf("?include_deleted=%v", includeDeleted)
return route + query
@@ -281,7 +281,7 @@ func (c *Client4) channelByNameForTeamNameRoute(channelName, teamName string) st
}
func (c *Client4) channelMembersRoute(channelId string) string {
return fmt.Sprintf(c.channelRoute(channelId) + "/members")
return c.channelRoute(channelId) + "/members"
}
func (c *Client4) channelMemberRoute(channelId, userId string) string {
@@ -401,15 +401,15 @@ func (c *Client4) outgoingWebhookRoute(hookID string) string {
}
func (c *Client4) preferencesRoute(userId string) string {
return fmt.Sprintf(c.userRoute(userId) + "/preferences")
return c.userRoute(userId) + "/preferences"
}
func (c *Client4) userStatusRoute(userId string) string {
return fmt.Sprintf(c.userRoute(userId) + "/status")
return c.userRoute(userId) + "/status"
}
func (c *Client4) userStatusesRoute() string {
return fmt.Sprintf(c.usersRoute() + "/status")
return c.usersRoute() + "/status"
}
func (c *Client4) samlRoute() string {
@@ -509,7 +509,7 @@ func (c *Client4) analyticsRoute() string {
}
func (c *Client4) timezonesRoute() string {
return fmt.Sprintf(c.systemRoute() + "/timezones")
return c.systemRoute() + "/timezones"
}
func (c *Client4) channelSchemeRoute(channelId string) string {
@@ -521,7 +521,7 @@ func (c *Client4) teamSchemeRoute(teamId string) string {
}
func (c *Client4) totalUsersStatsRoute() string {
return fmt.Sprintf(c.usersRoute() + "/stats")
return c.usersRoute() + "/stats"
}
func (c *Client4) redirectLocationRoute() string {
@@ -3377,7 +3377,7 @@ func (c *Client4) GetChannelsForTeamForUser(ctx context.Context, teamId, userId
// GetChannelsForTeamAndUserWithLastDeleteAt returns a list channels of a team for a user, additionally filtered with lastDeleteAt. This does not have any effect if includeDeleted is set to false.
func (c *Client4) GetChannelsForTeamAndUserWithLastDeleteAt(ctx context.Context, teamId, userId string, includeDeleted bool, lastDeleteAt int, etag string) ([]*Channel, *Response, error) {
route := fmt.Sprintf(c.userRoute(userId) + c.teamRoute(teamId) + "/channels")
route := c.userRoute(userId) + c.teamRoute(teamId) + "/channels"
route += fmt.Sprintf("?include_deleted=%v&last_delete_at=%d", includeDeleted, lastDeleteAt)
r, err := c.DoAPIGet(ctx, route, etag)
if err != nil {
@@ -3395,7 +3395,7 @@ func (c *Client4) GetChannelsForTeamAndUserWithLastDeleteAt(ctx context.Context,
// GetChannelsForUserWithLastDeleteAt returns a list channels for a user, additionally filtered with lastDeleteAt.
func (c *Client4) GetChannelsForUserWithLastDeleteAt(ctx context.Context, userID string, lastDeleteAt int) ([]*Channel, *Response, error) {
route := fmt.Sprintf(c.userRoute(userID) + "/channels")
route := c.userRoute(userID) + "/channels"
route += fmt.Sprintf("?last_delete_at=%d", lastDeleteAt)
r, err := c.DoAPIGet(ctx, route, "")
if err != nil {