-
Notifications
You must be signed in to change notification settings - Fork 23
feat(exercises): switch catalog.yaml to directory-based catalog loader #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LeeFred3042U
wants to merge
7
commits into
zhravan:main
Choose a base branch
from
LeeFred3042U:feature/catalog-directory-loader
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
73e9450
feat(exercises): switch catalog.yaml to directory-based catalog loader
LeeFred3042U 75e9f3f
gofmt internal/exercises/exercises_test.go
LeeFred3042U 01a387d
test: add safe catalog override helper and remove sync.Once copying
LeeFred3042U 77d4b4d
fix: run go fmt on internal/exercises/exercises.go and internal/exerc…
LeeFred3042U 49e0d9b
fix: Inconsistent metadata fields
LeeFred3042U a7539fa
fix: YAML syntax error in hint string.
LeeFred3042U ee00e3e
feat: migrate catalog to directory structure and fix CI
LeeFred3042U File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 01_hello | ||
| title: Hello, Go! | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement Hello() to return 'Hello, Go!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 02_values | ||
| title: Values | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use fmt.Sprintf to format values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 03_variables | ||
| title: Variables | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use short declarations (:=) and return multiple values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 04_constants | ||
| title: Constants | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use math.Pi and constant expressions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 05_for | ||
| title: For | ||
| test_regex: ".*" | ||
| hints: | ||
| - Accumulate a sum with a for loop. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 06_if_else | ||
| title: If/Else | ||
| test_regex: ".*" | ||
| hints: | ||
| - Handle negative, zero, and positive cases. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 07_switch | ||
| title: Switch | ||
| test_regex: ".*" | ||
| hints: | ||
| - Match multiple cases for weekend days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 08_arrays | ||
| title: Arrays | ||
| test_regex: ".*" | ||
| hints: | ||
| - Iterate with range over a fixed-size array. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 09_slices | ||
| title: Slices | ||
| test_regex: ".*" | ||
| hints: | ||
| - Append values then compute a sum. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 10_maps | ||
| title: Maps | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use strings.Fields and map[string]int for word counts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 11_functions | ||
| title: Functions | ||
| test_regex: ".*" | ||
| hints: | ||
| - Pass a function and call it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 12_multi_return | ||
| title: Multiple Return Values | ||
| test_regex: ".*" | ||
| hints: | ||
| - Return quotient, remainder, and an error for divide-by-zero. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 13_variadic | ||
| title: Variadic Functions | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use '...' to accept any number of ints and sum them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 14_closures | ||
| title: Closures | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement a function that returns a closure, capturing an outer variable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 15_recursion | ||
| title: Recursion | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement a recursive factorial function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 16_range_built_in | ||
| title: Range over Built-in Types | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use range to iterate over a slice and a map. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 17_pointers | ||
| title: Pointers | ||
| test_regex: ".*" | ||
| hints: | ||
| - Write a function that takes a pointer, modifies the value, and returns the pointer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 18_strings_runes | ||
| title: Strings and Runes | ||
| test_regex: ".*" | ||
| hints: | ||
| - Iterate over a string with range to count runes, and demonstrate string manipulation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 19_structs | ||
| title: Structs | ||
| test_regex: ".*" | ||
| hints: | ||
| - Define a struct with fields for name and age, then create an instance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 20_methods | ||
| title: Methods | ||
| test_regex: ".*" | ||
| hints: | ||
| - Add a method to a struct that calculates something based on its fields. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 21_interfaces | ||
| title: Interfaces | ||
| test_regex: ".*" | ||
| hints: | ||
| - Define an interface and implement it for a struct. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 22_enums | ||
| title: Enums | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use iota to create a set of related constants as an enumeration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 23_struct_embedding | ||
| title: Struct Embedding | ||
| test_regex: ".*" | ||
| hints: | ||
| - Embed one struct within another and access the inner struct's fields directly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 24_generics | ||
| title: Generics | ||
| test_regex: ".*" | ||
| hints: | ||
| - Write a generic function that works with different types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 25_range_iterators | ||
| title: Range over Iterators | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement a custom iterator and use range over it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 26_errors | ||
| title: Errors | ||
| test_regex: ".*" | ||
| hints: | ||
| - Write a function that returns an error and handle it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 27_custom_errors | ||
| title: Custom Errors | ||
| test_regex: ".*" | ||
| hints: | ||
| - Define a custom error type and return it from a function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 28_defer | ||
| title: Defer | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `f.Close()` with `defer` keyword. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 29_go_routines | ||
| title: Go Routines | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `go` keyword to execute functions concurrently using go routines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 30_channels | ||
| title: Channels | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `make(chan T)` to create a channel and `<-` to send and receive on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 31_mutexes | ||
| title: Mutexes | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `sync.Mutex` to synchronize access to a shared resource. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 32_sorting | ||
| title: Sorting | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `slice.Sort` for sorting slices. |
5 changes: 5 additions & 0 deletions
5
internal/exercises/Catalog/Concepts/33_string_formatting.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 33_string_formatting | ||
| title: String Formatting | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `fmt.Sprintf` and `%s`, `%d`, `%f` formatting directives to format strings, integers, and floats. |
5 changes: 5 additions & 0 deletions
5
internal/exercises/Catalog/Concepts/34_channel_buffering.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 34_channel_buffering | ||
| title: Channel Buffering | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `make(chan T, N)` to create a buffered channel and `<-` to send and receive on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 35_channel_sync | ||
| title: Channel Synchronization | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use a buffered boolean channel and wait till go routine completes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| - slug: 36_json | ||
| title: JSON | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use the encoding/json package to work with JSON data. | ||
| - Implement MarshalPerson to convert a struct into JSON using json.Marshal. | ||
| - Implement UnmarshalPerson to convert a JSON string into a struct using json.Unmarshal. | ||
| - Handle and return errors properly in both functions. | ||
|
|
10 changes: 10 additions & 0 deletions
10
internal/exercises/Catalog/Concepts/37_sorting_by_functions.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| - slug: 37_sorting_by_functions | ||
| title: "Sorting by Functions" | ||
| difficulty: beginner | ||
| topics: ["slices", "sorting", "functions"] | ||
| hints: | ||
| - "Implement sort.Interface with Len(), Less(), and Swap() methods" | ||
| - "Create custom slice types like ByName and ByAge (e.g., type ByName []Person)" | ||
| - "Use sort.Sort() to sort slices with your custom comparison logic" | ||
| - "Remember to make copies of slices to avoid modifying the original" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| - slug: 37_xml | ||
| title: XML Encoding and Decoding | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use encoding/xml package for marshaling and unmarshaling XML data. | ||
| - Add XML struct tags using `xml:"fieldname"` to map struct fields to XML elements. | ||
| - Use xml.Marshal to convert structs to XML bytes. | ||
| - Use xml.Unmarshal to parse XML bytes into structs. |
10 changes: 10 additions & 0 deletions
10
internal/exercises/Catalog/Concepts/38_time_formatting.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| - slug: 38_time_formatting | ||
| title: "Time Formatting" | ||
| difficulty: beginner | ||
| topics: ["time", "formatting", "parsing"] | ||
| hints: | ||
| - "Use time.Now().Format() to format current time with a specific layout" | ||
| - "Use time.Parse() to parse time strings with known layouts" | ||
| - "Use time.LoadLocation() to work with different timezones" | ||
| - "Extract time components using .Date() and .Clock() methods" | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
9 changes: 9 additions & 0 deletions
9
internal/exercises/Catalog/Concepts/39_channel_directions.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| - slug: 39_channel_directions | ||
| title: Channel Directions | ||
| test_regex: ".*" | ||
| hints: | ||
| - Create two channels, one for sending jobs and one for receiving results. | ||
| - Start 5 workers using go routines. | ||
| - Send 50 jobs to the worker pool. | ||
| - Receive results from the worker pool and store them in a `rs` slice. | ||
| - Enforce type safety by specifying the channel directions in worker function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| - slug: 39_panic | ||
| title: Panic and Recover | ||
| test_regex: ".*" | ||
| hints: | ||
| - "Use `panic()` to simulate runtime errors when appropriate." | ||
| - "Use `defer` with `recover()` to catch and handle panics." | ||
| - "Recovering from panics allows graceful handling of unexpected situations." | ||
| - "Remember: `recover()` only works inside a deferred function." | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| - slug: 40_channel_select | ||
| title: Channel Select | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `select` to handle multiple channel operations concurrently. | ||
| - Use `time.After` to simulate a 5 microsecond timeout. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| - slug: 41_time_delay | ||
| title: "Delays and Timers in Go" | ||
| difficulty: beginner | ||
| topics: ["time", "sleep", "channels", "timer"] | ||
| test_regex: ".*" | ||
| hints: | ||
| - "Use time.Sleep() to pause execution for a duration." | ||
| - "Convert milliseconds to time.Duration using time.Millisecond." | ||
| - "Use a buffered channel to send a signal after waiting." | ||
| - "Use time.After or time.Sleep to trigger events after delays." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| - slug: 42_wait_group | ||
| title: WaitGroups | ||
| test_regex: ".*" | ||
| difficulty: beginner | ||
| topics: ["concurrency", "sync", "goroutines"] | ||
| hints: | ||
| - "Use sync.WaitGroup to wait for all launched goroutines." | ||
| - "Call wg.Add(1) before starting a goroutine and wg.Done() when it finishes." | ||
| - "Close result channels after wg.Wait() so collectors can range over them." | ||
| - "Capture loop variables correctly inside goroutines (e.g., `n := n`)." | ||
| - "Return results as a slice — order does not need to match input order" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| - slug: 43_worker_pools | ||
| title: Worker Pools | ||
| test_regex: ".*" | ||
| hints: | ||
| - Create separate channels for jobs (send work) and results (receive processed data). | ||
| - Launch multiple worker goroutines that read from jobs channel and write to results channel. | ||
| - Use channel directions (<-chan for receive-only, chan<- for send-only) in worker function signature. | ||
| - Close the jobs channel after sending all work to signal workers to finish. | ||
| - Use strings.TrimSpace() to clean message strings by removing leading/trailing whitespace. | ||
| - Collect exactly len(logs) results to ensure all work is processed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| - slug: 44_atomic_counters | ||
| title: Atomic Counters | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `sync/atomic` package to create and increment atomic counter. | ||
| - Launch 10,000 anonymous go routines that simultaneously increment the counter. | ||
| - Use WaitGroups to wait for all go routines to finish. |
5 changes: 5 additions & 0 deletions
5
internal/exercises/Catalog/Concepts/45_range_over_channels.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 45_range_over_channels | ||
| title: Range over channels | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `for i := range ch {...}` syntax to range over a channels. |
7 changes: 7 additions & 0 deletions
7
internal/exercises/Catalog/Concepts/46_non_blocking_channel_operations.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| - slug: 46_non_blocking_channel_operations | ||
| title: Non-blocking channel operations | ||
| test_regex: ".*" | ||
| hints: | ||
| - Use `default` case in select to handle non-blocking channel operations. | ||
| - Safely increment `dropped` using mutex `Lock()` and `Unlock()`. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| - slug: 64_timers | ||
| title: "Timers" | ||
| difficulty: medium | ||
| topics: ["time", "goroutines", "concurrency", "synchronization"] | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| test_regex: ".*" | ||
| hints: | ||
| - "Use a map[string]*time.Timer to track active timers by key." | ||
| - "Use a mutex to safely access the timers map concurrently." | ||
| - "Start a timer with time.AfterFunc(d, fn) to run a callback after duration d." | ||
| - "If Start is called again for an existing key, stop and replace the old timer." | ||
| - "Stop should remove the timer from the map and prevent the callback from firing." | ||
| - "Reset can call timer.Reset(d) to reschedule the same callback." | ||
| - "Remember to remove timers from the map after they fire to avoid memory leaks." | ||
| - "Write tests to verify Start, Stop, and Reset behavior, including concurrency scenarios." | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| - slug: 68_rate_limiting | ||
| title: Rate Limiting | ||
| test_regex: ".*" | ||
| difficulty: medium | ||
| topics: ["time", "concurrency", "maps"] | ||
| hints: | ||
| - "Implement a RateLimiter struct that tracks request timestamps per key using a map[string][]time.Time." | ||
| - "Use a mutex to safely handle concurrent access to the map." | ||
| - "In the Allow method, remove timestamps older than the interval and check if the number of recent requests exceeds the limit." | ||
| - "Reset should clear the request history for a key; if the key does not exist, do nothing." | ||
| - "Consider edge cases: multiple keys, concurrent access, and requests exactly at the interval boundary." | ||
| - "In tests, use time.Sleep with a small buffer above the interval to avoid flakiness." | ||
| - "Initialize the timestamps map in NewRateLimiter to prevent nil pointer errors." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 01_text_analyzer | ||
| title: Text Analyzer (Easy) | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement functions to count characters, words, and unique words in a given text. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 02_shape_calculator | ||
| title: Shape Area Calculator (Medium) | ||
| test_regex: ".*" | ||
| hints: | ||
| - Define structs for different shapes, implement methods to calculate their areas, and use an interface for common shape behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 03_task_scheduler | ||
| title: Task Scheduler (Hard) | ||
| test_regex: ".*" | ||
| hints: | ||
| - Create a task scheduler with features like adding/removing tasks, a custom iterator, closures for task execution, and custom error handling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 04_http_server | ||
| title: HTTP Server (Easy) | ||
| test_regex: ".*" | ||
| hints: | ||
| - Implement a basic HTTP server that responds to GET requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - slug: 05_cli_todo_list | ||
| title: CLI Todo List (Medium) | ||
| test_regex: ".*" | ||
| hints: | ||
| - Build a command-line tool to manage a todo list, including adding, listing, and completing tasks. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.