Saturday, May 21, 2022

installing sqlite

s3 % cat >foo.go
package main
import (
        "database/sql"
        "fmt"
        _ "github.com/mattn/go-sqlite3"
)
func main() {
        conn, err := sql.Open("sqlite3", "./foo.db")
        fmt.Println(conn, err)
}

s3 % go mod init foo/main
go: creating new go.mod: module foo/main
go: to add module requirements and sums:
go mod tidy

s3 % go mod tidy
go: finding module for package github.com/mattn/go-sqlite3
go: downloading github.com/mattn/go-sqlite3 v1.14.13
go: found github.com/mattn/go-sqlite3 in github.com/mattn/go-sqlite3 v1.14.13

s3 % go build
s3 %