internal/pkgsitedb: do not build on plan9
Building fails with
github.com/lib/pq@v1.10.7/ssl_permissions.go:77:36: undefined: syscall.Stat_t
Change-Id: I55ca6ab46bfb5d8e3b56bbde6e98860d528fb069
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/466415
Reviewed-by: Julie Qiu <julieqiu@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/pkgsitedb/db.go b/internal/pkgsitedb/db.go
index 103a10d..1ef7c86 100644
--- a/internal/pkgsitedb/db.go
+++ b/internal/pkgsitedb/db.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
+
// Package pkgsitedb provides functionality for connecting to the pkgsite
// database.
package pkgsitedb
diff --git a/internal/pkgsitedb/db_plan9.go b/internal/pkgsitedb/db_plan9.go
new file mode 100644
index 0000000..b0a1dc7
--- /dev/null
+++ b/internal/pkgsitedb/db_plan9.go
@@ -0,0 +1,26 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build plan9
+
+package pkgsitedb
+
+import (
+ "context"
+ "database/sql"
+ "errors"
+
+ "golang.org/x/pkgsite-metrics/internal/config"
+ "golang.org/x/pkgsite-metrics/internal/scan"
+)
+
+var errDoesNotCompile = errors.New("github.com/lib/pq does not compile on plan9")
+
+func Open(ctx context.Context, cfg *config.Config) (_ *sql.DB, err error) {
+ return nil, errDoesNotCompile
+}
+
+func ModuleSpecs(ctx context.Context, db *sql.DB, minImportedByCount int) (specs []scan.ModuleSpec, err error) {
+ return nil, errDoesNotCompile
+}
diff --git a/internal/pkgsitedb/db_test.go b/internal/pkgsitedb/db_test.go
index 9f7581a..3c063a9 100644
--- a/internal/pkgsitedb/db_test.go
+++ b/internal/pkgsitedb/db_test.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
+
package pkgsitedb
import (
diff --git a/internal/worker/pkgsitedb.go b/internal/worker/pkgsitedb.go
index 33cec31..dfd7fd7 100644
--- a/internal/worker/pkgsitedb.go
+++ b/internal/worker/pkgsitedb.go
@@ -8,7 +8,6 @@
"fmt"
"net/http"
- _ "github.com/lib/pq"
"golang.org/x/pkgsite-metrics/internal/pkgsitedb"
)