DevClad-Inc / devclad

Exit inside non-main function RVV-A0003
Anti-pattern
Major
2 years ago2 years old
calls to log.Fatal only in main() or init() functions
 64		),
 65	)
 66	if err != nil {
 67		log.Fatal(err) 68	}
 69
 70	client := s3.NewFromConfig(cfg)
calls to log.Fatal only in main() or init() functions
103	var s3Response S3Response
104	jsonString, err := json.Marshal(result)
105	if err != nil {
106		log.Fatal(err)107	}
108	json.Unmarshal(jsonString, &s3Response)
109
calls to log.Fatal only in main() or init() functions
 95
 96	result, err := client.ListObjectsV2(context.TODO(), input)
 97	if err != nil {
 98		log.Fatal(err) 99	}
100
101	// RESPONSE HANDLING
calls to log.Fatal only in main() or init() functions
89	res, err := io.Copy(w, resp.Body)
90
91	if err != nil {
92		log.Fatal(err)93	}
94	return res
95
calls to log.Fatal only in main() or init() functions
80	// download the image
81	resp, err := http.Get(url)
82	if err != nil {
83		log.Fatal(err)84	}
85
86	// stream the image