mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-14 04:01:09 -04:00
* Remove `make updatedeps` from Travis build. We'll follow up with more specific plans around dependency updating in subsequent PRs. * Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to filter out `/vendor/` from `./...` where appropriate. * Temporarily remove `vet` from the `make test` target until we can figure out how to get it to not vet `vendor/`. (Initial experimentation failed to yield the proper incantation.) Everything is pinned to current master, with the exception of: * Azure/azure-sdk-for-go which is pinned before the breaking change today * aws/aws-sdk-go which is pinned to the most recent tag The documentation still needs to be updated, which we can do in a follow up PR. The goal here is to unblock release.
75 lines
1.2 KiB
Go
75 lines
1.2 KiB
Go
// +build ignore
|
|
|
|
// Generate the table of OID values
|
|
// Run with 'go run gen.go'.
|
|
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"os/exec"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
func main() {
|
|
datname := os.Getenv("PGDATABASE")
|
|
sslmode := os.Getenv("PGSSLMODE")
|
|
|
|
if datname == "" {
|
|
os.Setenv("PGDATABASE", "pqgotest")
|
|
}
|
|
|
|
if sslmode == "" {
|
|
os.Setenv("PGSSLMODE", "disable")
|
|
}
|
|
|
|
db, err := sql.Open("postgres", "")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
cmd := exec.Command("gofmt")
|
|
cmd.Stderr = os.Stderr
|
|
w, err := cmd.StdinPipe()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
f, err := os.Create("types.go")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
cmd.Stdout = f
|
|
err = cmd.Start()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Fprintln(w, "// generated by 'go run gen.go'; do not edit")
|
|
fmt.Fprintln(w, "\npackage oid")
|
|
fmt.Fprintln(w, "const (")
|
|
rows, err := db.Query(`
|
|
SELECT typname, oid
|
|
FROM pg_type WHERE oid < 10000
|
|
ORDER BY oid;
|
|
`)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
var name string
|
|
var oid int
|
|
for rows.Next() {
|
|
err = rows.Scan(&name, &oid)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Fprintf(w, "T_%s Oid = %d\n", name, oid)
|
|
}
|
|
if err = rows.Err(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Fprintln(w, ")")
|
|
w.Close()
|
|
cmd.Wait()
|
|
}
|