go/*: fix pre-1.11 tests
packagestest.Modules is now available pre-go1.11 but doesn't add itself to packagestest.All. strings.ReplaceAll is not available in pre-go1.11 Change-Id: Ia8bf0e82bb853c6f29d31ca5c54651097342b19c Reviewed-on: https://go-review.googlesource.com/c/143419 Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
9545aa7b51
commit
26c26290c3
|
@ -53,7 +53,7 @@ func Main(analyzers ...*analysis.Analyzer) {
|
|||
|
||||
args := flag.Args()
|
||||
if len(args) == 0 {
|
||||
fmt.Fprintln(os.Stderr, strings.ReplaceAll(usage, "PROGNAME", progname))
|
||||
fmt.Fprintln(os.Stderr, strings.Replace(usage, "PROGNAME", progname, -1))
|
||||
fmt.Fprintf(os.Stderr, "Run '%[1]s help' for more detail,\n"+
|
||||
" or '%[1]s help name' for details and flags of a specific analyzer.\n",
|
||||
progname)
|
||||
|
@ -73,7 +73,7 @@ func Main(analyzers ...*analysis.Analyzer) {
|
|||
func help(progname string, analyzers []*analysis.Analyzer, args []string) {
|
||||
// No args: show summary of all analyzers.
|
||||
if len(args) == 0 {
|
||||
fmt.Println(strings.ReplaceAll(usage, "PROGNAME", progname))
|
||||
fmt.Println(strings.Replace(usage, "PROGNAME", progname, -1))
|
||||
fmt.Println("Registered analyzers:")
|
||||
fmt.Println()
|
||||
sort.Slice(analyzers, func(i, j int) bool {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.11
|
||||
|
||||
package packagestest
|
||||
|
||||
import (
|
||||
|
@ -34,10 +32,6 @@ import (
|
|||
// /sometemporarydirectory/repoa
|
||||
var Modules = modules{}
|
||||
|
||||
func init() {
|
||||
All = append(All, Modules)
|
||||
}
|
||||
|
||||
type modules struct{}
|
||||
|
||||
func (modules) Name() string {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// +build go1.11
|
||||
|
||||
package packagestest
|
||||
|
||||
func init() {
|
||||
All = append(All, Modules)
|
||||
}
|
Loading…
Reference in New Issue