go-demos

module
v0.0.0-...-c5c9948 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: Apache-2.0

README

go-demos

Improving the development efficiency of Go code

This project contains quick start of using the standard library, third-party open source libraries, and some personally written utility code snippets (such as calculating the edit distance between two strings, read files and so on).

Some code needs to be run to see the effect, and the specific test methods will be written in the main.go file in each subpath.

Code Structure

personal : Some utility code snippets written by myself
  • read_file: Traverse all files under a certain path
  • ldflags: Cooperate with the makefile file to assign variables in the makefile to the Go internals
  • sort_map: Sort map by value
  • errgroup: Implement sub-coroutine error propagation based on WaitGroup, and use context to control the coroutine's lifecycle at the same time
  • format: Compare Sprintf and math.Round
  • use_regexp: Whether the string meets the regular expression, if not, customize the error message
  • use_url: Parse addresses/parameters in URLs
  • md5
  • use_string/base64: Encoding and decoding
  • use_string/index: The difference between string and []rune indexing
  • use_rollingwriter: Write log files locally, configurable for single log file name, file size, rolling strategy, split rule, maximum retention, etc.
  • use_redis/redislock: go-redis lib
  • use_zerolog: Logging library
  • use_uuid: Generate pure numeric IDs by intercepting UUIDs
  • use_yaml: Read and parse YAML configuration files
  • use_gin: Gin implements a simple ping pong server
  • fuzzysearch: String fuzzy matching

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL