Skip to content

Seongwonp/Go_Practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Practice

Go를 기초부터 차근히 학습하고, 최종적으로는 백엔드 실무에 바로 적용할 수 있는 수준까지 올리는 것을 목표로 한다.


학습 방향

  • 문법만 보는 방식이 아니라, 왜 이렇게 설계하는지까지 같이 정리한다.
  • 동시성, 테스트, 운영 관점까지 포함해서 실무 기준으로 학습한다.
  • 각 파트는 개념 정리 + 짧은 예제 + 미니 과제로 진행한다.

실행 방법

# 일반 파일 실행
go run part01/01_variables_control_struct.go

# 테스트 실행
go test ./part06/...

# 벤치마크 실행
go test -bench=. ./part06/...

학습 로드맵

Part 주제 파일
Part 01 기본 문법, 타입 기초 01_variables_control_struct.go 02_array_slice_map.go 03_functions_methods.go 04_constants_iota.go 05_closures_variadic.go
Part 02 자료구조, 메모리 01_pointer.go 02_slice_internals.go 03_string_byte_rune.go 04_error_basics.go 05_nil_zero_values.go 06_map_advanced.go
Part 03 인터페이스, 설계 01_interface.go 02_type_assertion_switch.go 03_embedding.go 04_interface_composition.go 05_stringer_error_interface.go
Part 04 동시성 01_goroutine.go 02_channel.go 03_select_context.go 04_mutex_atomic.go 05_worker_pool.go
Part 05 에러 처리 심화 01_errors_is_as_wrap.go 02_custom_error.go 03_panic_recover.go 04_sentinel_errors.go 05_error_handling_patterns.go
Part 06 테스트 01_table_driven_test.go 02_benchmark_test.go 03_http_handler_test.go 04_testhelper.go mock_demo/
Part 07 HTTP 서버 01_http_server.go 02_middleware.go 03_graceful_shutdown.go 04_request_validation.go 05_routing_patterns.go
Part 08 DB, 트랜잭션 01_database_sql.go 02_transaction.go 03_query_builder.go 04_repository_pattern.go 05_migration_pattern.go
Part 09 아키텍처 01_layered_architecture.go 02_dto.go 03_dependency_injection.go 04_middleware_chain.go 05_event_driven.go
Part 10 운영 관점 01_config.go 02_structured_logging.go 03_timeout_retry.go 04_graceful_config.go 05_health_check.go
Part 11 성능 최적화 01_memory_optimization.go 02_sync_pool.go 03_profiling.go 04_escape_analysis.go
Part 12 실전 프로젝트 01_auth_api_server.go 02_rate_limiter.go 03_graceful_server.go

파트별 핵심 내용

Part 01 — 기본 문법, 타입 기초

변수/상수 선언, 제어문(if/for/switch), 함수, struct, 패키지, 상수/iota, 클로저/가변인자

Part 02 — 자료구조, 메모리

포인터와 값 전달, 슬라이스 내부 동작(len/cap/재할당), 문자열/byte/rune 차이, 에러 처리 기초, nil/zero value, map 심화

Part 03 — 인터페이스, 설계

interface 묵시적 구현, type assertion/switch, 구조체 임베딩과 메서드 승격, 인터페이스 조합, Stringer/error 인터페이스

Part 04 — 동시성

goroutine + WaitGroup, channel 파이프라인/팬아웃, select + context 타임아웃, mutex/atomic 동기화, worker pool 패턴

Part 05 — 에러 처리 심화

errors.Is/As/Join, 에러 래핑(%w), 커스텀 에러 타입, panic/recover 기준, sentinel error, 에러 처리 전략 패턴

Part 06 — 테스트

table-driven test, t.Run/t.Parallel, benchmark(-benchmem), httptest 핸들러 테스트, 테스트 헬퍼, Mock/Fake/Spy 패턴

Part 07 — HTTP 서버

net/http 기본 서버, 미들웨어 체인(RequestID/Logging/Auth), graceful shutdown, 요청 검증, 라우팅 패턴

Part 08 — DB, 트랜잭션

database/sql 패턴, withTransaction 헬퍼, 쿼리 빌더, Repository 인터페이스 패턴, 마이그레이션 패턴

Part 09 — 아키텍처

Handler/Service/Repository 레이어드 구조, DTO 분리 및 검증, 의존성 주입(DI), 미들웨어 체인 설계, 이벤트 드리븐 패턴

Part 10 — 운영 관점

환경변수 기반 config 관리, log/slog 구조화 로깅, timeout/지수 백오프/Circuit Breaker, graceful config 로딩, 헬스체크 엔드포인트

Part 11 — 성능 최적화

구조체 패딩 최적화, sync.Pool 객체 재사용, pprof 프로파일링, escape analysis

Part 12 — 실전 프로젝트

HMAC-SHA256 JWT 인증 API 서버, 토큰 버킷 기반 rate limiter, graceful 서버 통합 (표준 라이브러리만 사용)


최종 목표

Spring 기반 백엔드 경험을 바탕으로, Go에서도 설계/구현/테스트/운영을 한 사이클로 수행할 수 있는 개발 역량을 만든다.


학습 방식

  • 각 파트는 개념 요약 1개, 코드 예제 3~5개, 미니 과제 1개를 기준으로 진행한다.
  • 파트 종료 후에는 배운 점, 막힌 점, 개선점을 짧게 기록한다.
  • 4주 단위로 작은 서비스 하나를 완성해 본다.

About

From Go basics to production-ready backend: concurrency, testing, architecture, and real-world practices

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages