this.isMin.uk


golang에서 custom error 구조체를 사용하는 경우 errors.WithStack을 사용하지 말 것

func WithStack(err error) error {
	if err == nil {
		return nil
	}
	return &withStack{
		err,
		callers(),
	}
}

type withStack struct {
	error
	*stack
}
* 해당 부분의 코드를 보면 `&withStack{error}`을 리턴하는데, 이로 인해서 withStack타입 혹은 error타입으로 인식되버림
switch err.(type) {
  case ErrCustom:
    fmt.Println("custom")
  default:
  	fmt.Println("default")
}
* 이와같은 경우, default로 통과됨
Til, Golang