()
| 664 | } |
| 665 | |
| 666 | func (ps *UserProfileStore) persist() { |
| 667 | data, err := json.MarshalIndent(ps.profile, "", " ") |
| 668 | if err != nil { |
| 669 | ps.logger.Warn("failed to marshal user profile", zap.Error(err)) |
| 670 | return |
| 671 | } |
| 672 | if err := atomicWriteFile(ps.path, data, 0o600); err != nil { |
| 673 | ps.logger.Warn("failed to write user profile", zap.Error(err)) |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | func normalizeExpertise(level string) string { |
| 678 | switch strings.ToLower(strings.TrimSpace(level)) { |