diff options
| author | Julie Qiu <julie@golang.org> | 2021-02-17 21:08:36 -0500 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2021-02-19 17:13:59 +0000 |
| commit | 05df48e41c419261d068cedc9cea76573117b8a6 (patch) | |
| tree | 20779948cd6d6fc7d0bb42579ecf0ffabc13c134 /cmd/internal | |
| parent | cd92bb295c140bbc3356bffdd469ad6909a4053f (diff) | |
| download | go-x-pkgsite-05df48e41c419261d068cedc9cea76573117b8a6.tar.xz | |
cmd,internal/symbol: add stdlib API comparison script
A script is added at cmd/internal/testing/stdlibsymbol/main.go, which
compares the stdlib API data in
https://go.googlesource.com/go/+/refs/heads/master/api with that of the
symbol_history table.
This script is used to check that data on pkgsite is accurate during
development.
Change-Id: Ib453dc8d63ee45cc3c8eb40365f9baf5636adec3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293429
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'cmd/internal')
| -rw-r--r-- | cmd/internal/testing/stdlibsymbol/main.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cmd/internal/testing/stdlibsymbol/main.go b/cmd/internal/testing/stdlibsymbol/main.go new file mode 100644 index 00000000..1555158d --- /dev/null +++ b/cmd/internal/testing/stdlibsymbol/main.go @@ -0,0 +1,41 @@ +// Copyright 2020 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. + +// stdlibsymbol compares data from the symbol_history table with +// the stdlib API data at +// https://go.googlesource.com/go/+/refs/heads/master/api. +package main + +import ( + "context" + "fmt" + + "golang.org/x/pkgsite/cmd/internal/cmdconfig" + "golang.org/x/pkgsite/internal/config" + "golang.org/x/pkgsite/internal/log" +) + +func main() { + ctx := context.Background() + cfg, err := config.Init(ctx) + log.SetLevel("error") + if err != nil { + log.Fatal(ctx, err) + } + db, err := cmdconfig.OpenDB(ctx, cfg, false) + if err != nil { + log.Fatal(ctx, err) + } + + pkgToErrors, err := db.CompareStdLib(ctx) + if err != nil { + log.Fatal(ctx, err) + } + for path, errs := range pkgToErrors { + fmt.Printf("----- %s -----\n", path) + for _, e := range errs { + fmt.Print(e) + } + } +} |
