gofmt fixes. (#21742)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
860989e2ca
Коммит
98a14c8c55
@@ -43,7 +43,6 @@ func (ts *TeamService) GetTeams(teamIDs []string) ([]*model.Team, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
|
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
|
||||||
//
|
|
||||||
func (ts *TeamService) createDefaultChannels(teamID string) ([]*model.Channel, error) {
|
func (ts *TeamService) createDefaultChannels(teamID string) ([]*model.Channel, error) {
|
||||||
displayNames := map[string]string{
|
displayNames := map[string]string{
|
||||||
"town-square": i18n.T("api.channel.create_default_channels.town_square"),
|
"town-square": i18n.T("api.channel.create_default_channels.town_square"),
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// By default the list will be (not necessarily in this order):
|
// By default the list will be (not necessarily in this order):
|
||||||
|
//
|
||||||
// ['town-square', 'off-topic']
|
// ['town-square', 'off-topic']
|
||||||
|
//
|
||||||
// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
|
// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
|
||||||
// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
|
// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
|
||||||
// ['town-square', 'game-of-thrones', 'wow']
|
|
||||||
//
|
//
|
||||||
|
// ['town-square', 'game-of-thrones', 'wow']
|
||||||
func (ts *TeamService) DefaultChannelNames() []string {
|
func (ts *TeamService) DefaultChannelNames() []string {
|
||||||
names := []string{"town-square"}
|
names := []string{"town-square"}
|
||||||
|
|
||||||
|
|||||||
6
services/cache/lru_striped.go
поставляемый
6
services/cache/lru_striped.go
поставляемый
@@ -29,9 +29,9 @@ import (
|
|||||||
// cache where a simple LRU wouldn't have. Example:
|
// cache where a simple LRU wouldn't have. Example:
|
||||||
//
|
//
|
||||||
// Two buckets B1 and B2, of max size 2 each, meaning, theoretically, a max size of 4:
|
// Two buckets B1 and B2, of max size 2 each, meaning, theoretically, a max size of 4:
|
||||||
// * Say you have a set of 3 keys, they could fill an entire LRU cache.
|
// - Say you have a set of 3 keys, they could fill an entire LRU cache.
|
||||||
// * But if all those keys are assigned to a single bucket B1, the first key will be evicted from B1
|
// - But if all those keys are assigned to a single bucket B1, the first key will be evicted from B1
|
||||||
// * B2 will remain empty, even though there was enough memory allocated
|
// - B2 will remain empty, even though there was enough memory allocated
|
||||||
//
|
//
|
||||||
// With 4 buckets and random UUIDs as keys, the amount of false evictions is around 5%.
|
// With 4 buckets and random UUIDs as keys, the amount of false evictions is around 5%.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ func (s *SearchUserStore) autocompleteUsersInChannelByEngine(engine searchengine
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getListOfAllowedChannels return the list of allowed channels to search user based on the
|
// getListOfAllowedChannels return the list of allowed channels to search user based on the
|
||||||
|
//
|
||||||
// next scenarios:
|
// next scenarios:
|
||||||
// - If there isn't view restrictions (team or channel) and no team id to filter them, then all
|
// - If there isn't view restrictions (team or channel) and no team id to filter them, then all
|
||||||
// channels are allowed (nil return)
|
// channels are allowed (nil return)
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ func testMessageExportGroupMessageChannel(t *testing.T, ss store.Store) {
|
|||||||
assert.Equal(t, user1.Username, *messageExportMap[post.Id].Username)
|
assert.Equal(t, user1.Username, *messageExportMap[post.Id].Username)
|
||||||
}
|
}
|
||||||
|
|
||||||
//post,edit,export
|
// post,edit,export
|
||||||
func testEditExportMessage(t *testing.T, ss store.Store) {
|
func testEditExportMessage(t *testing.T, ss store.Store) {
|
||||||
defer cleanupStoreState(t, ss)
|
defer cleanupStoreState(t, ss)
|
||||||
// get the starting number of message export entries
|
// get the starting number of message export entries
|
||||||
@@ -874,7 +874,7 @@ func testEditExportMessage(t *testing.T, ss store.Store) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//post, export, edit, export
|
// post, export, edit, export
|
||||||
func testEditAfterExportMessage(t *testing.T, ss store.Store) {
|
func testEditAfterExportMessage(t *testing.T, ss store.Store) {
|
||||||
defer cleanupStoreState(t, ss)
|
defer cleanupStoreState(t, ss)
|
||||||
// get the starting number of message export entries
|
// get the starting number of message export entries
|
||||||
@@ -985,7 +985,7 @@ func testEditAfterExportMessage(t *testing.T, ss store.Store) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//post, delete, export
|
// post, delete, export
|
||||||
func testDeleteExportMessage(t *testing.T, ss store.Store) {
|
func testDeleteExportMessage(t *testing.T, ss store.Store) {
|
||||||
defer cleanupStoreState(t, ss)
|
defer cleanupStoreState(t, ss)
|
||||||
// get the starting number of message export entries
|
// get the starting number of message export entries
|
||||||
@@ -1070,7 +1070,7 @@ func testDeleteExportMessage(t *testing.T, ss store.Store) {
|
|||||||
assert.Equal(t, user1.Username, *v.Username)
|
assert.Equal(t, user1.Username, *v.Username)
|
||||||
}
|
}
|
||||||
|
|
||||||
//post,export,delete,export
|
// post,export,delete,export
|
||||||
func testDeleteAfterExportMessage(t *testing.T, ss store.Store) {
|
func testDeleteAfterExportMessage(t *testing.T, ss store.Store) {
|
||||||
defer cleanupStoreState(t, ss)
|
defer cleanupStoreState(t, ss)
|
||||||
// get the starting number of message export entries
|
// get the starting number of message export entries
|
||||||
|
|||||||
@@ -26,15 +26,16 @@ type MergeConfig struct {
|
|||||||
// - maps and slices are treated as pointers, and merged as a single value
|
// - maps and slices are treated as pointers, and merged as a single value
|
||||||
//
|
//
|
||||||
// Note that callers need to cast the returned interface back into the original type:
|
// Note that callers need to cast the returned interface back into the original type:
|
||||||
// func mergeTestStruct(base, patch *testStruct) (*testStruct, error) {
|
|
||||||
// ret, err := merge(base, patch)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// retTS := ret.(testStruct)
|
// func mergeTestStruct(base, patch *testStruct) (*testStruct, error) {
|
||||||
// return &retTS, nil
|
// ret, err := merge(base, patch)
|
||||||
// }
|
// if err != nil {
|
||||||
|
// return nil, err
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// retTS := ret.(testStruct)
|
||||||
|
// return &retTS, nil
|
||||||
|
// }
|
||||||
func Merge(base any, patch any, mergeConfig *MergeConfig) (any, error) {
|
func Merge(base any, patch any, mergeConfig *MergeConfig) (any, error) {
|
||||||
if reflect.TypeOf(base) != reflect.TypeOf(patch) {
|
if reflect.TypeOf(base) != reflect.TypeOf(patch) {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user