전체 글
-
2024년에 Remix 앱을 위한 최적의 호스팅 옵션 가이드Javascript 2024. 6. 6. 09:08
2024년에 Remix 앱을 위한 최적의 호스팅 옵션 가이드추천사항서버리스 함수(Serverless Functions)Long-lived serversVercelFastlyNetlifyCloudflareSSTFly.ioRenderRailwayDigitalOcean App PlatformGitHub Pages기타 호스트Remix는 많은 다른 호스팅 옵션을 지원합니다. 이 가이드는 당신의 앱에 적합한 호스팅을 선택하는 데 도움이 될 것입니다.추천사항이 가이드는 당신을 특정 제공 업체로 유도하려는 것이 아니라, 정보에 입각한 결정을 내릴 수 있도록 필요한 정보를 제공하는 것을 목적으로 합니다. 그럼에도 불구하고, 대부분의 사람들에게 가장 좋은 아키텍처는 관리되는 컨테이너에서 Remix를 운영하면서 앱 내에서 ..
-
Go에 삼항 연산자가 도입되지 않는 이유Go 2024. 6. 2. 21:25
Go에 삼항 연산자가 도입되지 않는 이유FAQGo에 ?: 연산자가 없는 이유는 무엇인가요?중첩을 허용하다Python의 경우코드 커버리지에 대해대체 방법if-else를 그대로 사용하기함수를 선언하기switch 구문룩업 테이블빌드 태그에 의한 전환요약부연Go 언어에 대해 종종 "왜 삼항 연산자가 없나요?"라는 질문을 볼 수 있습니다. 언어 개발 측의 의견과 제 생각을 정리해 보겠습니다.FAQ그 답변은 Go의 FAQ에 명확히 나와 있습니다.Go에 ?: 연산자가 없는 이유는 무엇인가요?Go에는 삼항 테스트 연산자가 없습니다. 같은 결과를 얻기 위해서는 다음을 사용할 수 있습니다.if expr { n = trueVal} else { n = falseVal} Go에 ?: 연산자가 없는 이유는 언어 설계자..
-
Go 언어는 매력적이다Go 2024. 6. 1. 17:32
Go 언어는 매력적이다익명 필드를 사용한 상속의 문제점해결 방법리시버를 사용할 때 주의할 점배열 길이 생략 표현해결 방법슬라이스에러 핸들링번외: Go 언어에서 try...catch에 가까운 구현for range세미콜론 자동 삽입에 의한 문법 제약이름 공간과 패키지 이름interface{}가 nil이 되지 않는 문제교훈프리미티브 타입(chan)에서 변수 자동 초기화를 기대할 수 없음해결 방법Go Modules 사용 시 고유 URL 필요Go의 툴체인에 --verbose에 해당하는 기능이 없음GoTo가 사용 가능결론익명 필드를 사용한 상속의 문제점Go 언어는 객체 지향 언어는 아니지만, 구조체와 리시버를 사용하여 객체의 멤버를 "호출"할 수 있습니다. 먼저, Animal "클래스"를 만들어보고, 자기소개를 위..
-
Golang에서 로그를 출력하는 팁Go 2024. 6. 1. 17:21
Golang에서 로그를 출력하는 팁TL;DR라이브러리(패키지)를 작성할 때…애플리케이션을 작성할 때…라이브러리의 로깅라이브러리에서 *log.Logger를 사용하는 경우라이브러리에서 자체 Logger 인터페이스를 정의하는 경우기존의 로깅 라이브러리는 절대 No Good애플리케이션의 로깅글을 마치며 Golang으로 프로그램을 작성할 때 로그는 어떻게 출력하시나요? 이번 글에서는 로그를 출력할 때의 팁과 주의할 점, 그리고 그 이유에 대해 설명해 드리겠습니다. 로그 출력 방법은 라이브러리에서 로그를 출력하는 경우와 애플리케이션에서 로그를 출력하는 경우에 따라 상당히 다릅니다.TL;DR라이브러리(패키지)를 작성할 때…먼저 로그를 출력하지 않는 것을 고려해 보세요. error로 반환하여 라이브러리 사용자가 로그를..
-
Next.js 버전 15의 핵심 변경 사항 - 기본적으로 비활성화된 라우팅 및 데이터 캐싱Javascript 2024. 5. 25. 14:02
Next.js 버전 15의 핵심 변경 사항 - 기본적으로 비활성화된 라우팅 및 데이터 캐싱v15의 파괴적 변경 사항 개요캐시 설정의 파괴적 변경Data Cache의 비활성화Router Cache의 비활성화왜 이 시점에서 변경되었을까?v15 이후 Next.js의 설계 사상요약Next.js의 App Router는 종종 어렵다는 평가를 받습니다. 이는 React의 새로운 기능인 Server Components와 같은 Server First 패러다임 전환을 요구하고, 기본 캐시 동작이 초보자들에게 혼란을 줄 수 있기 때문입니다. Server Components나 Server Actions와 같은 React의 새로운 기능은 초보자를 위한 에러 힌트 및 수정을 돕는 설계가 되어 있으며, 많은 문서와 기사가 공개되어..
-
Go의 문자열 결합 성능 비교Go 2024. 5. 19. 15:08
Go의 문자열 결합 성능 비교테스트 케이스구현+= 연산자 루프strings.Join 함수한 번의 대입문으로 + 연산자로 모든 요소를 결합[]byte 사용용량을 지정한 []bytebytes.Buffer 사용용량을 지정한 bytes.Buffer용량을 지정한 bytes.Buffer + WriteString결과 정리결론안녕하세요! 이번 글에서는 Go 언어에서 문자열을 결합하는 여러 가지 방법을 비교해보려고 합니다. 다양한 방법을 벤치마크 테스트를 통해 성능을 비교하고, 가장 효율적인 방법을 찾아봅시다.테스트 케이스아래와 같은 9글자 * 10개의 요소로 이루어진 문자열 배열을 ","로 결합하고, 마지막에 ","를 추가하는 코드를 구현했습니다. 원하는 출력은 string이기 때문에, []byte나 bytes.Buf..
-
Go 언어로 문자열 결합 최적화하기: strings.Builder 완벽 가이드 및 벤치마크Go 2024. 5. 19. 15:01
Go 언어로 문자열 결합 최적화하기: strings.Builder 완벽 가이드 및 벤치마크strings.Builder 내부 살펴보기용량이 있는 []byte에 append하는 것이 더 빠르다!strings.Builder의 편리한 메서드결론strings.Builder를 사용한 문자열 결합은 단순히 +=를 사용하는 것보다 훨씬 빠르다! 특히, strings.Builder.Grow()를 사용해 미리 용량을 확보해두는 방법이 가장 빠르고 사용하기도 좋다.strings.Builder 내부 살펴보기strings.Builder는 Write 메서드를 사용해 문자열 등을 효율적으로 구축하기 위해 사용된다. strings.Builder 자체는 외부로 공개된 필드가 없는 구조체이다.type Builder struct { ..
-
Go 언어 슬라이스 완벽 이해 - 구현과 활용Go 2024. 5. 19. 14:51
Go 언어 슬라이스 완벽 이해 - 구현과 활용슬라이스의 실체요소에 접근하기요소 추가하기용량이 충분한 경우용량이 부족한 경우마무리마무리슬라이스의 실체Go의 런타임 코드를 보면, Go의 슬라이스는 다음과 같이 정의되어 있습니다.type slice struct { array unsafe.Pointer len int cap int} reflect 패키지의 SliceHeader를 봐도 다음과 같이 정의되어 있습니다.type SliceHeader struct { Data uintptr Len int Cap int} 즉, Go의 슬라이스는 다음 그림처럼 배열에 대한 포인터와 길이, 그리고 용량을 가진 값으로 표현됩니다.런타임과 reflect 패키지에서 포인터를 unsafe...