Skip to content

Commit ac12867

Browse files
authored
Fixed incorrect package name in panic exercise which caused go vet error in CI (#169)
2 parents 8febaad + c515131 commit ac12867

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

internal/exercises/templates/39_panic/panic_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package exercises
1+
package panicex
22

33
import (
44
"strings"

internal/exercises/templates/41_time_delay/time_delay.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@ package timedelay
55
import "time"
66

77
// WaitFor pauses execution until roughly ms milliseconds have passed.
8-
func WaitForTemplate(ms int) {
8+
func WaitFor(ms int) {
99
// TODO: compute a target time using time.Now().Add and wait until reached
1010
}
1111

1212
// NotifyAfter waits for roughly ms milliseconds then sends true on a channel.
13-
func NotifyAfterTemplate(ms int) chan bool {
13+
func NotifyAfter(ms int) chan bool {
1414
// TODO: start a goroutine that checks time.Now against a target and sends on the channel
1515
return nil
1616
}
1717

1818
// WaitUntil blocks until the provided target time is reached (or returns if in the past).
19-
func WaitUntilTemplate(target time.Time) {
19+
func WaitUntil(target time.Time) {
2020
// TODO: loop until time.Now() is not before target
2121
}
2222

2323
// NotifyAt sends true on a channel when the provided target time is reached.
24-
func NotifyAtTemplate(target time.Time) chan bool {
24+
func NotifyAt(target time.Time) chan bool {
2525
// TODO: return a channel that will receive true when the target time arrives
2626
return nil
2727
}
2828

2929
// ElapsedMillis returns how many milliseconds have passed since t.
30-
func ElapsedMillisTemplate(t time.Time) int64 {
30+
func ElapsedMillis(t time.Time) int64 {
3131
// TODO: use time.Since to compute milliseconds
3232
return 0
3333
}
3434

3535
// WaitForOrTimeout waits for ms milliseconds but returns an error if waiting exceeds timeoutMs.
36-
func WaitForOrTimeoutTemplate(ms int, timeoutMs int) error {
36+
func WaitForOrTimeout(ms int, timeoutMs int) error {
3737
// TODO: compute target and deadline with time.Now().Add and return error on timeout
3838
return nil
3939
}
4040

4141
// ScheduleAfter runs fn after roughly ms milliseconds and returns a channel closed when fn finishes.
42-
func ScheduleAfterTemplate(ms int, fn func()) chan struct{} {
42+
func ScheduleAfter(ms int, fn func()) chan struct{} {
4343
// TODO: start a goroutine that waits until target, runs fn, then closes the done channel
4444
return nil
4545
}

internal/exercises/templates/42_wait_group/wait_group.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package waitgroup
22

3-
import "sync"
4-
53
// Squares takes a slice of numbers and should return a slice
64
// containing the square of each number.
75

@@ -17,7 +15,6 @@ import "sync"
1715
// 5. Collect all values from the channel into a slice and return it.
1816

1917
func Squares(nums []int) []int {
20-
var wg sync.WaitGroup
2118

2219
// TODO: implement the logic here
2320

internal/exercises/templates/43_worker_pools/worker_pools_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ func TestLogProcessor(t *testing.T) {
7878
t.Fatalf("Expected 20 processed logs, got %d", len(results))
7979
}
8080

81-
// With 5 workers processing 20 logs at ~5 microseconds each:
82-
// Sequential would take ~100 microseconds
83-
// Concurrent should take ~20-30 microseconds (4 batches of 5)
84-
if elapsed.Microseconds() > 50 {
81+
// the time taken is flaky, but it should be less than 1.4 seconds
82+
// according observed max value
83+
if elapsed.Microseconds() > 1400 {
8584
t.Errorf("Processing took too long (%v), worker pool may not be working correctly", elapsed)
8685
}
8786
})

0 commit comments

Comments
 (0)