diff --git a/README.md b/README.md index 59cc87b..37fae87 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ row before the line. - [에러 형(Error Types)](#%ec%97%90%eb%9f%ac-%ed%98%95error-types) - [오류 래핑(Error Wrapping)](#%ec%98%a4%eb%a5%98-%eb%9e%98%ed%95%91error-wrapping) - [타입의 어설션 실패 다루기 (Handle Type Assertion Failures)](#%ed%83%80%ec%9e%85%ec%9d%98-%ec%96%b4%ec%84%a4%ec%85%98-%ec%8b%a4%ed%8c%a8-%eb%8b%a4%eb%a3%a8%ea%b8%b0-handle-type-assertion-failures) - - [Don't Panic](#dont-panic) + - [패닉을 피할 것 (Don't Panic)](#%ed%8c%a8%eb%8b%89%ec%9d%84-%ed%94%bc%ed%95%a0-%ea%b2%83-dont-panic) - [Use go.uber.org/atomic](#use-gouberorgatomic) - [Performance](#performance) - [Prefer strconv over fmt](#prefer-strconv-over-fmt) @@ -770,11 +770,9 @@ if !ok { -### Don't Panic +### 패닉을 피할 것 (Don't Panic) -Code running in production must avoid panics. Panics are a major source of -[cascading failures]. If an error occurs, the function must return an error and -allow the caller to decide how to handle it. +프로덕션 환경에서 실행되는 코드는 패닉을 반드시 피해야 한다. 패닉은 [cascading failures]의 주요 원인이다. 만약 에러가 발생할 경우, 함수는 에러를 리턴하고 호출자(caller)가 오류 처리 방법을 결정할 수 있도록 해야 한다. [cascading failures]: https://en.wikipedia.org/wiki/Cascading_failure @@ -825,17 +823,13 @@ func main() { -Panic/recover is not an error handling strategy. A program must panic only when -something irrecoverable happens such as a nil dereference. An exception to this is -program initialization: bad things at program startup that should abort the -program may cause panic. +Panic/recover는 오류 처리 전략(error handling strategy)이 이니다. nil dereference와 같이 복구 할 수 없는 일이 발생하는 경우에만 프로그램이 패닉 상태여야 한다. 프로그램 초기화는 여기에서 예외다: 프로그램을 시작 할 때, 프로그램을 중단해야 할 정도의 좋지 못한 일(bad things)이 발생할 경우 패닉을 일으킬 수 있다. ```go var _statusTemplate = template.Must(template.New("name").Parse("_statusHTML")) ``` -Even in tests, prefer `t.Fatal` or `t.FailNow` over panics to ensure that the -test is marked as failed. +테스트에서 조차도, 테스트가 실패한 것으로 표기되는 것을 보장하기 위해 `panic`보다는 `t.Fatal` 혹은 `t.FailNow`가 선호된다.
BadGood