Go Programming World
Author

Go Programming World

Mobile version of tech blog https://jianghushinian.cn/, covering Golang, Docker, Kubernetes and beyond.

69
Articles
0
Likes
476
Views
0
Comments
Recent Articles

Latest from Go Programming World

69 recent articles
Go Programming World
Go Programming World
May 12, 2024 · Backend Development

Resolving MySQL Dependencies in Go Unit Tests with Fake and Mock Objects

This article explains how to write Go unit tests for HTTP handlers that depend on MySQL by using fake implementations and the gomock library to replace the store layer, demonstrating both fake object and mock approaches, code examples, and best practices for isolating external dependencies.

Dependency InjectionFakeGo
0 likes · 18 min read
Resolving MySQL Dependencies in Go Unit Tests with Fake and Mock Objects
Go Programming World
Go Programming World
May 11, 2024 · Backend Development

Testing HTTP Applications in Go: Isolating External Dependencies

This article explains how to write reliable unit tests for Go HTTP applications by isolating external dependencies, covering server‑side handlers, client‑side monitoring, and using tools such as net/http/httptest, testify, and gock to create test doubles and mock HTTP services.

Gogockhttp
0 likes · 21 min read
Testing HTTP Applications in Go: Isolating External Dependencies
Go Programming World
Go Programming World
May 10, 2024 · Backend Development

Comprehensive Guide to Writing Tests in Go: Unit, Benchmark, Example, and Fuzz Testing

This article provides a detailed tutorial on Go's testing framework, covering test classifications such as unit, benchmark, example, and fuzz tests, explaining naming conventions, file organization, test execution commands, parallel testing, coverage measurement, and how to integrate these practices into robust backend development workflows.

Unit Testbenchmarkexample-test
0 likes · 31 min read
Comprehensive Guide to Writing Tests in Go: Unit, Benchmark, Example, and Fuzz Testing
Go Programming World
Go Programming World
May 5, 2024 · Backend Development

Using pflag for Command-Line Argument Parsing in Go

This article introduces the Go third‑party flag package pflag, detailing its POSIX/GNU‑style features, basic and advanced usage, flag syntax, name normalization, NoOptDefVal handling, deprecation/hiding mechanisms, and how to mix it with the standard flag package.

Command Lineflag parsinggolang
0 likes · 17 min read
Using pflag for Command-Line Argument Parsing in Go
Go Programming World
Go Programming World
May 2, 2024 · Backend Development

Comprehensive Guide to Using Viper for Go Application Configuration

This article provides an in‑depth tutorial on Viper, a full‑featured Go configuration library, covering its features, usage scenarios, loading priorities, reading from files, environment variables, command‑line flags, remote stores, and best practices for managing application settings.

BackendDevOpsGo
0 likes · 22 min read
Comprehensive Guide to Using Viper for Go Application Configuration
Go Programming World
Go Programming World
Apr 30, 2024 · Backend Development

A Comprehensive Guide to Using Uber's Zap Logging Library in Go

This article introduces Uber's open‑source Zap library for Go, explains its high‑performance, structured, leveled logging features, demonstrates basic and advanced usage with code examples, compares production and development configurations, shows how to use SugaredLogger, customize loggers, apply options, and integrate the library into custom logging packages.

GoSugaredLoggerZAP
0 likes · 19 min read
A Comprehensive Guide to Using Uber's Zap Logging Library in Go
Go Programming World
Go Programming World
Feb 19, 2024 · Backend Development

Implementing Context Managers in Go: Emulating Python's with Using defer and Anonymous Functions

This article explores how to replicate Python's context manager behavior in Go by examining defer's delayed execution, demonstrating its limitations in loops, and presenting three solutions—anonymous functions, a WithClose helper, and a withLock-inspired pattern—to ensure timely resource release.

GoWithCloseanonymous function
0 likes · 10 min read
Implementing Context Managers in Go: Emulating Python's with Using defer and Anonymous Functions