forked from zhravan/golearn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog.yaml
More file actions
287 lines (284 loc) · 8.87 KB
/
Copy pathcatalog.yaml
File metadata and controls
287 lines (284 loc) · 8.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
concepts:
- slug: 01_hello
title: Hello, Go!
test_regex: ".*"
hints:
- Implement Hello() to return 'Hello, Go!'
- slug: 02_values
title: Values
test_regex: ".*"
hints:
- Use fmt.Sprintf to format values.
- slug: 03_variables
title: Variables
test_regex: ".*"
hints:
- Use short declarations (:=) and return multiple values.
- slug: 04_constants
title: Constants
test_regex: ".*"
hints:
- Use math.Pi and constant expressions.
- slug: 05_for
title: For
test_regex: ".*"
hints:
- Accumulate a sum with a for loop.
- slug: 06_if_else
title: If/Else
test_regex: ".*"
hints:
- Handle negative, zero, and positive cases.
- slug: 07_switch
title: Switch
test_regex: ".*"
hints:
- Match multiple cases for weekend days.
- slug: 08_arrays
title: Arrays
test_regex: ".*"
hints:
- Iterate with range over a fixed-size array.
- slug: 09_slices
title: Slices
test_regex: ".*"
hints:
- Append values then compute a sum.
- slug: 10_maps
title: Maps
test_regex: ".*"
hints:
- Use strings.Fields and map[string]int for word counts.
- slug: 11_functions
title: Functions
test_regex: ".*"
hints:
- Pass a function and call it.
- slug: 12_multi_return
title: Multiple Return Values
test_regex: ".*"
hints:
- Return quotient, remainder, and an error for divide-by-zero.
- slug: 13_variadic
title: Variadic Functions
test_regex: ".*"
hints:
- Use '...' to accept any number of ints and sum them.
- slug: 14_closures
title: Closures
test_regex: ".*"
hints:
- Implement a function that returns a closure, capturing an outer variable.
- slug: 15_recursion
title: Recursion
test_regex: ".*"
hints:
- Implement a recursive factorial function.
- slug: 16_range_built_in
title: Range over Built-in Types
test_regex: ".*"
hints:
- Use range to iterate over a slice and a map.
- slug: 17_pointers
title: Pointers
test_regex: ".*"
hints:
- Write a function that takes a pointer, modifies the value, and returns the pointer.
- slug: 18_strings_runes
title: Strings and Runes
test_regex: ".*"
hints:
- Iterate over a string with range to count runes, and demonstrate string manipulation.
- slug: 19_structs
title: Structs
test_regex: ".*"
hints:
- Define a struct with fields for name and age, then create an instance.
- slug: 20_methods
title: Methods
test_regex: ".*"
hints:
- Add a method to a struct that calculates something based on its fields.
- slug: 21_interfaces
title: Interfaces
test_regex: ".*"
hints:
- Define an interface and implement it for a struct.
- slug: 22_enums
title: Enums
test_regex: ".*"
hints:
- Use iota to create a set of related constants as an enumeration.
- slug: 23_struct_embedding
title: Struct Embedding
test_regex: ".*"
hints:
- Embed one struct within another and access the inner struct's fields directly.
- slug: 24_generics
title: Generics
test_regex: ".*"
hints:
- Write a generic function that works with different types.
- slug: 25_range_iterators
title: Range over Iterators
test_regex: ".*"
hints:
- Implement a custom iterator and use range over it.
- slug: 26_errors
title: Errors
test_regex: ".*"
hints:
- Write a function that returns an error and handle it.
- slug: 27_custom_errors
title: Custom Errors
test_regex: ".*"
hints:
- Define a custom error type and return it from a function.
- slug: 28_defer
title: Defer
test_regex: ".*"
hints:
- Use `f.Close()` with `defer` keyword.
- slug: 29_go_routines
title: Go Routines
test_regex: ".*"
hints:
- Use `go` keyword to execute functions concurrently using go routines.
- slug: 30_channels
title: Channels
test_regex: ".*"
hints:
- Use `make(chan T)` to create a channel and `<-` to send and receive on it.
- slug: 31_mutexes
title: Mutexes
test_regex: ".*"
hints:
- Use `sync.Mutex` to synchronize access to a shared resource.
- slug: 32_sorting
title: Sorting
test_regex: ".*"
hints:
- Use `slice.Sort` for sorting slices.
- 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.
- 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.
- 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.
- slug: 35_channel_sync
title: Channel Synchronization
test_regex: ".*"
hints:
- Use a buffered boolean channel and wait till go routine completes.
- 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.
- 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.
- 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."
projects:
- slug: 101_text_analyzer
title: Text Analyzer (Easy)
test_regex: ".*"
hints:
- Implement functions to count characters, words, and unique words in a given text.
- slug: 102_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.
- slug: 103_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.
- slug: 104_http_server
title: HTTP Server (Easy)
test_regex: ".*"
hints:
- Implement a basic HTTP server that responds to GET requests.
- slug: 105_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.
- slug: 106_simple_chat_app
title: Simple Chat Application (Medium)
test_regex: ".*"
hints:
- Create a basic client-server chat application.
- slug: 107_image_processing_utility
title: Image Processing Utility (Hard)
test_regex: ".*"
hints:
- Develop a command-line utility for basic image transformations like resizing or converting to grayscale.
- slug: 108_basic_key_value_store
title: Basic Key-Value Store (Hard)
test_regex: ".*"
hints:
- Implement an in-memory key-value store with basic CRUD operations and optional persistence.
- 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.
- slug: 109_epoch
title: "Epoch Conversion"
difficulty: beginner
topics: ["time", "epoch", "unix"]
hints:
- "Use Go's `time.Unix()` to convert an epoch to time."
- "Use `t.Unix()` to convert time back to epoch."
- "Remember Go’s `time.Parse` can help parse date strings."
- 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"
- 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"