Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ Use ```-help``` to see additional options
## Usage as a library

```go
package main

import (
"github.com/murfffi/getaduck"
"fmt"
"fmt"

"github.com/murfffi/getaduck/download"
)

func main() {
// Download the latest DuckDB release for your platform
duckdbPath, err := getaduck.Download(getaduck.Options{})
if err != nil {
panic(err)
}
fmt.Println("Downloaded DuckDB to:", duckdbPath)
// Download the latest DuckDB release for your platform
res, err := download.Do(download.DefaultSpec())
if err != nil {
panic(err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better error handling in this example, consider using log.Fatal(err) instead of panic(err). log.Fatal is generally preferred for exiting a program from main on an unrecoverable error, as it provides a clean exit without a stack trace. This would also make the example consistent with the error handling in the project's main.go file.

To apply this change, you will also need to add "log" to the import block.

Suggested change
panic(err)
log.Fatal(err)

}
fmt.Println("Downloaded DuckDB to:", res.OutputFile)
}
```

Expand Down
Loading