Skip to content

Commit 921054a

Browse files
committed
docs: 修复代码注释问题并完善测试说明
修复内容: - 修复 internal/services/dynamic_weight.go 中 SubGroupWeightInput 结构体的注释 原注释错误地重复了 GetSubGroupDynamicWeights 函数的说明 现已改为正确描述该结构体的用途:持有子组ID和基础权重用于动态权重计算 - 完善 internal/sitemanagement/i18n/i18n_test.go 中的测试说明 为 TestNoEmptyTranslations 测试添加注释说明其与 TestTranslationValuesNotEmpty 的关系 明确指出这是防御性深度验证测试,遵循项目中其他 i18n 测试文件的模式 测试验证: - 所有单元测试通过(并行度24) - go vet 检查无警告 - 代码诊断无错误
1 parent c546b56 commit 921054a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

internal/services/dynamic_weight.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func GetEffectiveWeightForSelection(effectiveWeight float64) int {
459459
return weight
460460
}
461461

462-
// GetSubGroupDynamicWeights returns dynamic weight info for all sub-groups of an aggregate group.
462+
// SubGroupWeightInput holds the sub-group ID and its base weight for dynamic weight calculation.
463463
type SubGroupWeightInput struct {
464464
SubGroupID uint
465465
Weight int

internal/sitemanagement/i18n/i18n_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ func TestKeyCategories(t *testing.T) {
197197
}
198198

199199
// TestNoEmptyTranslations verifies no translation is an empty string
200+
// Note: This test is intentionally similar to TestTranslationValuesNotEmpty
201+
// for defense-in-depth validation, following the pattern in other i18n test files.
200202
func TestNoEmptyTranslations(t *testing.T) {
201203
allMaps := map[string]map[string]string{
202204
"English": MessagesEnUS,

0 commit comments

Comments
 (0)