Skip to content

Commit 8f45533

Browse files
dmitshurgopherbot
authored andcommitted
cmd/modinfo/internal/pkgsitedb: fix build on plan9
Package pkgsitedb doesn't work on plan9 because a dependency doesn't support it. It was meant to return a runtime error in the db_plan9.go implementation, but it looks like there was a mixup with a similar pkgsitedb package at golang.org/x/pkgsite-metrics/internal/pkgsitedb. After these changes, it and all of its tests compile on GOOS=plan9: $ GOOS=plan9 GOARCH=amd64 go test -c -o=/dev/null ./... [...] $ echo $? 0 Also run 'go mod tidy' to drop the x/pkgsite-metric requirement. For golang/go#61698. Change-Id: Ia016b5705894029380840ce8499047e264054e9f Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/518095 Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 21b1797 commit 8f45533

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

cmd/modinfo/internal/pkgsitedb/db_plan9.go

+22-5
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,34 @@ import (
1010
"context"
1111
"database/sql"
1212
"errors"
13-
14-
"golang.org/x/pkgsite-metrics/internal/config"
15-
"golang.org/x/pkgsite-metrics/internal/scan"
1613
)
1714

1815
var errDoesNotCompile = errors.New("github.com/lib/pq does not compile on plan9")
1916

20-
func Open(ctx context.Context, cfg *config.Config) (_ *sql.DB, err error) {
17+
type Config struct {
18+
User string
19+
PasswordSecret string
20+
Password string
21+
Host string
22+
Port string
23+
DBName string
24+
}
25+
26+
func Open(ctx context.Context, cfg Config) (_ *sql.DB, err error) {
2127
return nil, errDoesNotCompile
2228
}
2329

24-
func ModuleSpecs(ctx context.Context, db *sql.DB, minImportedByCount int) (specs []scan.ModuleSpec, err error) {
30+
type Module struct {
31+
Path string
32+
Packages []*Package
33+
}
34+
35+
type Package struct {
36+
Path string
37+
Version string
38+
NumImporters int
39+
}
40+
41+
func QueryModule(ctx context.Context, db *sql.DB, modulePath string) (*Module, error) {
2542
return nil, errDoesNotCompile
2643
}

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ require (
2727
golang.org/x/exp/event v0.0.0-20220218215828-6cf2b201936e
2828
golang.org/x/mod v0.10.0
2929
golang.org/x/oauth2 v0.8.0
30-
golang.org/x/pkgsite-metrics v0.0.0-20230724182206-f4d26a684cbf
3130
golang.org/x/sync v0.2.0
3231
golang.org/x/time v0.1.0
3332
golang.org/x/tools v0.9.3

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ
473473
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
474474
golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8=
475475
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
476-
golang.org/x/pkgsite-metrics v0.0.0-20230724182206-f4d26a684cbf h1:EZsyqK8LLPSx01Tr2yXk66Vcp/1yDCw3x58dbi1xTqA=
477-
golang.org/x/pkgsite-metrics v0.0.0-20230724182206-f4d26a684cbf/go.mod h1:0Jrcyk3p5rHS8+NbicrlGT3w+0hmXv2mBLXqkv6ySXs=
478476
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
479477
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
480478
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

0 commit comments

Comments
 (0)