Naming, layout and comments: descriptive full-word names, one item per line in wrapped calls and literals, and doc comments on exported names

Short and single-letter names in application code become full words (tests
keep theirs). Wrapped calls, signatures and composite literals put one item
per line, and one-line function bodies are expanded. Exported names and
groups of constants get doc comments, and comments refer to the renamed
identifiers.
This commit is contained in:
bwilliams committed 2026-10-15 16:12:56 +01:00
1 parent 043e307663
commit 465358609a
78 files changed
+2374 -1402

No files matched your search

+7 -7
View File
@@ -21,8 +21,8 @@ func StoreValue(
// storeValue is StoreValue for any section, so key types that
// JobSearchConfig doesn't have yet can be tested.
func storeValue(s Section, key string, value string) (any, reflect.Kind, error) {
confType, err := s.TypeOf(key)
func storeValue(section Section, key string, value string) (any, reflect.Kind, error) {
confType, err := section.TypeOf(key)
if err != nil {
return nil, confType, err
}
@@ -38,10 +38,10 @@ func storeValue(s Section, key string, value string) (any, reflect.Kind, error)
// SetValue parses the string into the field's own type (e.g. int8,
// float32 or time.Duration) and rejects values the configuration itself
// would not accept, e.g. an unknown log level or an unparseable duration.
if err := s.SetValue(key, value); err != nil {
if err := section.SetValue(key, value); err != nil {
return nil, confType, err
}
confValue, err := s.ValueOf(key)
confValue, err := section.ValueOf(key)
if err != nil {
return nil, confType, err
}
@@ -93,9 +93,9 @@ func PurgeValue(conf *JobSearchConfig, key string) error {
}
out := viper.New()
out.SetConfigFile(file.ConfigFileUsed())
for _, k := range file.AllKeys() {
if k != key {
out.Set(k, file.Get(k))
for _, fileKey := range file.AllKeys() {
if fileKey != key {
out.Set(fileKey, file.Get(fileKey))
}
}
return out.WriteConfig()