diff --git a/README.md b/README.md index ec638bb..4dd67e4 100644 --- a/README.md +++ b/README.md @@ -1 +1,32 @@ -# Go tool belt +# Gobelt + +Gobelt is a collection of Go tools. + +### Thread pool + +```go +import "github.com/localhots/gobelt/threadpool" +``` + +```go +ctx := context.Background() +pool := threadpool.New(5) +pool.Enqueue(ctx, func() { + fmt.Println("Hello") +}) +pool.Close() +``` + +### File cache + +```go +import "github.com/localhots/gobelt/filecache" +``` + +```go +var val int +filecache.Load(&val, "path/to/cachefile", func() interface{} { + // Expensive calls here + return 100 +}) +``` diff --git a/filecache/filecache_test.go b/filecache/filecache_test.go index 29eaeeb..5d47b82 100644 --- a/filecache/filecache_test.go +++ b/filecache/filecache_test.go @@ -19,7 +19,6 @@ func TestFileCache(t *testing.T) { if err != nil { t.Fatalf("Error occurred while loading cache: %v", err) } - if res != exp { t.Errorf("Expected %d, got %d", exp, res) }