Skip to content

Commit

Permalink
Require Go 1.21; remove golang.org/x/exp dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed Aug 9, 2023
1 parent f76ecf0 commit 71b4121
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
cache: true
- name: Get dependencies
run: go mod download
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/carlmjohnson/flowmatic

go 1.20
go 1.21

require github.com/carlmjohnson/deque v0.22.0

require golang.org/x/exp v0.0.0-20230116083435-1de6713980de
require github.com/carlmjohnson/deque v0.23.1
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
github.com/carlmjohnson/deque v0.22.0 h1:yIaXxHcj6/jUK834fMTZUgYavW/0IdA3whrzVvfqvv4=
github.com/carlmjohnson/deque v0.22.0/go.mod h1:6171GeeDBqexi4z2OoIsqfJfD2BK+MdlhfwOxurcniA=
golang.org/x/exp v0.0.0-20230116083435-1de6713980de h1:DBWn//IJw30uYCgERoxCg84hWtA97F4wMiKOIh00Uf0=
golang.org/x/exp v0.0.0-20230116083435-1de6713980de/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
github.com/carlmjohnson/deque v0.23.1 h1:X2HOJM9xcglY03deMZ0oZ1V2xtbqYV7dJDnZiSZN4Ak=
github.com/carlmjohnson/deque v0.23.1/go.mod h1:LF5NJjICBrEOPx84pxPL4nCimy5n9NQjxKi5cXkh+8U=
4 changes: 2 additions & 2 deletions manage_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ManageTasks[Input, Output any](numWorkers int, task Task[Input, Output], ma
select {
case inch <- item:
inflight++
queue.PopHead()
queue.RemoveFront()
case r := <-out:
inflight--
if r.Panic != nil {
Expand All @@ -46,7 +46,7 @@ func ManageTasks[Input, Output any](numWorkers int, task Task[Input, Output], ma
if !ok {
return
}
queue.Append(items...)
queue.PushBackSlice(items)
}
}
}
8 changes: 5 additions & 3 deletions manage_tasks_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"io"
"net/http"
"net/http/httptest"
"slices"
"strings"
"testing/fstest"

"github.com/carlmjohnson/flowmatic"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)

func ExampleManageTasks() {
Expand Down Expand Up @@ -76,7 +75,10 @@ func ExampleManageTasks() {
// Process the tasks with as many workers as GOMAXPROCS
flowmatic.ManageTasks(flowmatic.MaxProcs, task, manager, "/")

keys := maps.Keys(results)
keys := make([]string, 0, len(results))
for key := range results {
keys = append(keys, key)
}
slices.Sort(keys)
for _, key := range keys {
fmt.Println(key, "links to:")
Expand Down

0 comments on commit 71b4121

Please sign in to comment.