Closed
Description
Here is how I start.
- go get github.com/kyleconroy/sqlc
- cd to sqlc/cmd/sqlc
- go build .
- copy compiled sqlc to $GOPATH/bin
And then, I'm trying to run the sample.
- Mkdir ~/Desktop/sqlctest
- Run sqlc init and edit the sqlc.json in project folder.
{
"version": "1",
"packages": [
{
"name": "db",
"emit_json_tags": true,
"emit_prepared_queries": false,
"path": "internal/db",
"queries": "./sql/query/",
"schema": "./sql/schema/"
}
]
}
CREATE TABLE authors (
id BIGSERIAL PRIMARY KEY,
name text NOT NULL,
bio text
);
-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = $1 LIMIT 1;
-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;
- Run sqlc generate ./sql/query/author.sql
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x42b6669]
goroutine 1 [running]:
github.com/kyleconroy/sqlc/internal/dinosql.ParseQueries(0xc00017c090, 0x480c471, 0x1, 0xc00011e300, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0, ...)
/Users/allendang/Documents/Gocode/src/github.com/kyleconroy/sqlc/internal/dinosql/parser.go:226 +0x689
github.com/kyleconroy/sqlc/internal/cmd.glob..func4(0x4820620, 0xc000148a60, 0x1, 0x1)
/Users/allendang/Documents/Gocode/src/github.com/kyleconroy/sqlc/internal/cmd/cmd.go:156 +0x9aa
github.com/spf13/cobra.(*Command).execute(0x4820620, 0xc000148a30, 0x1, 0x1, 0x4820620, 0xc000148a30)
/Users/allendang/Documents/Gocode/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000160500, 0xc0000bdee8, 0x1, 0x1)
/Users/allendang/Documents/Gocode/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/Users/allendang/Documents/Gocode/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/kyleconroy/sqlc/internal/cmd.Do(0xc0000200d0, 0x2, 0x2, 0x4530900, 0xc000010010, 0x4530920, 0xc000010018, 0x4530920, 0xc000010020, 0xc0000320b8)
/Users/allendang/Documents/Gocode/src/github.com/kyleconroy/sqlc/internal/cmd/cmd.go:34 +0x24a
main.main()
/Users/allendang/Documents/Gocode/src/github.com/kyleconroy/sqlc/cmd/sqlc/main.go:10 +0xad
What went wrong???
And BTW, I think a proper step-by-step getting start guide is really needed.
Metadata
Metadata
Assignees
Labels
No labels