zed
zed copied to clipboard
Go library examples in docs don't work
Repro is with Zed commit 7ba4ecc.
I'm not much of a Go developer, but I was hacking a bit and tried working off the user-facing docs. However, what's shown there doesn't currently work. Starting with what's shown for just the top ZSON Reader example:
$ mkdir example
$ cd example
$ go mod init example
go: creating new go.mod: module example
$ cat > main.go
# [pasted the example from the docs]
$ go mod tidy
go: finding module for package github.com/brimdata/zed/zson
go: finding module for package github.com/brimdata/zed
go: finding module for package github.com/brimdata/zed/zio/zsonio
go: found github.com/brimdata/zed in github.com/brimdata/zed v1.8.1
go: found github.com/brimdata/zed/zio/zsonio in github.com/brimdata/zed v1.8.1
go: found github.com/brimdata/zed/zson in github.com/brimdata/zed v1.8.1
$ echo '{s:"hello"}{x:123}{s:"world"}' | go run .
# example
./main.go:15:32: cannot use os.Stdin (variable of type *os.File) as *"github.com/brimdata/zed".Context value in argument to zsonio.NewReader
./main.go:15:42: cannot use zctx (variable of type *"github.com/brimdata/zed".Context) as io.Reader value in argument to zsonio.NewReader: *"github.com/brimdata/zed".Context does not implement io.Reader (missing method Read)
Perhaps when we get them working again we could show the examples with the tag of the last GA Zed release (e.g., v1.8.0 at the moment) rather than assuming the tip of main is always going to work.