MCPcopy
hub / github.com/loong/go-concurrency-exercises

github.com/loong/go-concurrency-exercises @main sqlite

repository ↗ · DeepWiki ↗
53 symbols 115 edges 16 files 33 documented · 62%
README

Go Concurrency Exercises Build Status Go Report Card

Exercises for Golang's concurrency patterns.

Why

The Go community has plenty resources to read about go's concurrency model and how to use it effectively. But who actually wants to read all this!? This repo tries to teach concurrency patterns by following the 'learning by doing' approach.

Image of excited gopher

How to take this challenge

  1. Only edit main.go to solve the problem. Do not touch any of the other files.
  2. If you find a *_test.go file, you can test the correctness of your solution with go test
  3. If you get stuck, join us on Discord or Slack! Surely there are people who are happy to give you some code reviews (if not, find me via @loong ;) )

Overview

# Name of the Challenge + URL
0 Limit your Crawler
1 Producer-Consumer
2 Race Condition in Caching Cache
3 Limit Service Time for Free-tier Users
4 Graceful SIGINT Killing
5 Clean Inactive Sessions to Prevent Memory Overflow

License

 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                    Version 2, December 2004 

 Copyleft from 2017 Long Hoang

 Everyone is permitted to copy and distribute verbatim or modified 
 copies of this license document, and changing it is allowed as long 
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

  0. You just DO WHAT THE FUCK YOU WANT TO.

Extension points exported contracts — how you extend this code

KeyStoreCacheLoader (Interface)
KeyStoreCacheLoader is an interface for the KeyStoreCache [1 implementers]
2-race-in-cache/main.go

Core symbols most depended-on inside this repo

GetSessionData
called by 6
5-session-cleaner/main.go
createMockRequest
called by 5
3-limit-service-time/mockserver.go
NewSessionManager
called by 4
5-session-cleaner/main.go
CreateSession
called by 4
5-session-cleaner/main.go
Get
called by 4
2-race-in-cache/mockdb.go
UpdateSessionData
called by 3
5-session-cleaner/main.go
fetchSignalInstance
called by 2
0-limit-crawler/mockfetcher.go
GetMockDB
called by 2
2-race-in-cache/mockdb.go

Shape

Function 28
Method 12
Struct 11
Interface 1
TypeAlias 1

Languages

Go100%

Modules by API surface

2-race-in-cache/main.go10 symbols
5-session-cleaner/main.go7 symbols
1-producer-consumer/mockstream.go5 symbols
3-limit-service-time/mockserver.go4 symbols
0-limit-crawler/mockfetcher.go4 symbols
5-session-cleaner/check_test.go3 symbols
4-graceful-sigint/mockprocess.go3 symbols
3-limit-service-time/main.go3 symbols
2-race-in-cache/mockdb.go3 symbols
1-producer-consumer/main.go3 symbols
2-race-in-cache/check_test.go2 symbols
0-limit-crawler/main.go2 symbols

For agents

$ claude mcp add go-concurrency-exercises \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact