Code RoomConfig error hides root cause
MediumPrep Room Coding #1730

Config error hides root cause

Code reviewCode quality & reviewMid–Senior~20 min

Review this Go config loader.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1func LoadConfig(path string) (*Config, error) {
2 data, err := os.ReadFile(path)
3 if err != nil {
4 return nil, errors.New("could not load config")
5 }
6 var c Config
7 if err := json.Unmarshal(data, &c); err != nil {
8 return nil, errors.New("could not load config")
9 }
10 return &c, nil
11}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.