go-fucking-exercise icon indicating copy to clipboard operation
go-fucking-exercise copied to clipboard

go basic learning exercises for starting trip as a new beginner or reviewing courses

说明 instruction

if you want to find go-awesome-patterns you can check : Go Patterns(go-awesome-patterns)

如果你是冲着 go的各种实践模式(包含常用设计模式),看这里:Go模式(go-awesome-patterns)

repo can be used as a basic starter or reviewing of golang features

本仓库是Go语言基础,用来温习Go的常用套路或者作为入门学习.

all case was written by testing ,more story more cases

都以Test方式来写,方便直接测试,内容更加丰富,Test Case更加完善.

dowload 下载:

go get github.com/crazybber/go-fucking-exercise

Test 测试:

cd go-fucking-exercise
go test ./...

Ways 姿势

逐个跑一遍或者敲一遍(可以直接COPY),但是要确保理解了,就可以丢一边了。

current dir structure 当前目录结构

  • basic 基础类型
    • Hello World
    • Values
    • Variables
    • Constants
    • For
    • If/Else
    • Switch
    • Arrays
    • Slices
    • Maps
    • Range
    • Functions
    • Multiple Return Values
    • Variadic Functions
    • Closures
    • Recursion
    • Pointers
  • pattern go 的基本组合继承模式
    • Structs
    • Methods
    • Interfaces
    • Errors
  • go routine 和Channels
    • Goroutines
    • Channels
    • Channel Buffering
    • Channel Synchronization
    • Channel Directions
    • Select
    • Timeouts
    • Non-Blocking Channel Operations
    • Closing Channels
    • Range over Channels
  • skill 常用套路
    • Timers
    • Tickers
    • Stateful Goroutines
    • Sorting
    • Sorting by Functions
    • Panic
    • Defer
    • Collection Functions
    • String Functions
    • String Formatting
    • Regular Expressions
    • JSON
    • XML
    • Time
    • Epoch
    • Time Formatting / Parsing
    • Random Numbers
    • Number Parsing
  • sync 同步相关
    • Worker Pools
    • WaitGroups
    • Rate Limiting
    • Atomic Counters
    • Mutexes
  • iostream 流相关,如文件流
    • URL Parsing
    • SHA1 Hashes
    • Base64 Encoding
    • Reading Files
    • Writing Files
    • Line Filters
    • File Paths
    • Directories
    • Temporary Files and Directories
    • Testing
  • Command Lines
    • Command-Line Arguments
    • Command-Line Flags
    • Command-Line Subcommands
  • process 进程相关
    • Environment Variables
    • Context
    • Spawning Processes
    • Executing Processes
    • Signals
    • Exit
  • Network 网络相关
    • HTTP Clients
    • HTTP Servers
  • attentions(一些坑)
    • for range
    • for select break
    • deep copy
    • slice append
  • misc 有用的杂项
    • Go文章

More 更多

learn go patterns by real example ?

想通过例子,学习一下go的常用的模式?看这里:

Go模式(go-awesome-patterns)