1
0
mirror of https://github.com/golang/go synced 2024-07-01 07:56:09 +00:00

test: use dot-relative imports where appropriate

Currently, run.go's *dir tests allow "x.go" to be imported
interchangeably as either "x" or "./x". This is generally fine, but
can cause problems when "x" is the name of a standard library
package (e.g., "fixedbugs/bug345.dir/io.go").

This CL is an automated rewrite to change all `import "x"` directives
to use `import "./x"` instead. It has no effect today, but will allow
subsequent CLs to update test/run.go to resolve "./x" to "test/x" to
avoid stdlib collisions.

Change-Id: Ic76cd7140e83b47e764f8a499e59936be2b3c876
Reviewed-on: https://go-review.googlesource.com/c/go/+/395116
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Matthew Dempsky 2022-03-23 15:09:31 -07:00
parent 849e42f028
commit 999589e148
95 changed files with 114 additions and 114 deletions

View File

@ -6,7 +6,7 @@
// that are expected to be inlined
package main
import "a"
import "./a"
func main() {
if !a.G()()() {

View File

@ -3,4 +3,5 @@
// license that can be found in the LICENSE file
package Bar
import _ "chanbug"
import _ "./chanbug"

View File

@ -5,8 +5,7 @@
package main
// Check that the export information is correct in p.6.
import _ "p"
import _ "./p"
// Check that it's still correct in pp.a (which contains p.6).
import _ "pp"

View File

@ -5,8 +5,8 @@
package main
import (
"./p"
"fmt"
"p"
)
type I interface {

View File

@ -4,6 +4,6 @@
package b
import "a"
import "./a"
var V = func() { a.F() }

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func G(x int) int {
return a.F(x, 1, false, a.Large{})

View File

@ -5,8 +5,8 @@
package c
import (
"a"
"b"
"./a"
"./b"
)
type HandlerFunc func(*string)

View File

@ -4,7 +4,7 @@
package main
import "c"
import "./c"
func main() {
c.RouterInit()

View File

@ -9,11 +9,11 @@ package main
// 1.13. For 1.14, we will move to a variant of lexicographic ordering
// which will require a change to the test output of this test.
import (
_ "c"
_ "./c"
_ "b"
_ "./b"
_ "a"
_ "./a"
)
func main() {

View File

@ -12,7 +12,7 @@ package main
import (
"fmt"
"a"
"./a"
)
func main() {

View File

@ -5,8 +5,8 @@
package main
import (
"a"
"b"
"./a"
"./b"
)
func main() {

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type Service uint64
type ServiceDesc struct {

View File

@ -5,8 +5,8 @@
package c
import (
"a"
"b"
"./a"
"./b"
)
type BI interface {

View File

@ -5,8 +5,8 @@
package d
import (
"b"
"c"
"./b"
"./c"
)
var GA b.Service

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
var N n

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func B() string {
return a.M()

View File

@ -5,8 +5,8 @@
package c
import (
"a"
"b"
"./a"
"./b"
)
type BI interface {

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
a.F()()

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func Bfunc() {
a.Hook(101)

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type B struct {
s string

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func F(addr string) (uint64, string) {
return a.D(addr, 32)

View File

@ -1,6 +1,6 @@
package main
import "a"
import "./a"
var w a.W
var X interface{} = &w

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func F() {
s := a.S{}

View File

@ -5,8 +5,8 @@
package main
import (
"a"
"b"
"./a"
"./b"
)
func main() {

View File

@ -5,8 +5,8 @@
package main
import (
"a"
"b"
"./a"
"./b"
)
func main() {

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func F() {
a.F()

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
f := new(a.Future)

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func f() {
println(a.A)

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
var X = a.A

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
type R[T any] struct {
F T

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"context"
"fmt"
"runtime"

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func B() {
var x int64

View File

@ -4,7 +4,7 @@
package c
import "a"
import "./a"
func C() {
var x int64

View File

@ -5,8 +5,8 @@
package main
import (
"b"
"c"
"./b"
"./c"
)
func main() {

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
a.V.Print()

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
// Testing inlining of functions that refer to instantiated exported and non-exported
// generic types.

View File

@ -1,6 +1,6 @@
package main
import "a"
import "./a"
func Do[T any](doer a.Doer[T]) {
doer.Do()

View File

@ -4,7 +4,7 @@
package main
import "b"
import "./b"
func main() {
b.New[int]()

View File

@ -4,15 +4,15 @@
package main
import "a"
import "./a"
type Model[T any] struct {
index a.Index[T]
index a.Index[T]
}
func NewModel[T any](index a.Index[T]) Model[T] {
return Model[T]{
index: index,
index: index,
}
}

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
type S[Idx any] struct {
A string

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
if a.F[int64]() != 8 {

View File

@ -4,7 +4,7 @@
package main
import "p"
import "./p"
func main() {
_ = p.MarshalFuncV1[int](func(int) ([]byte, error) { return nil, nil })

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
_ = a.S{}

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
type S struct{}

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
obj := a.NewWrapperWithLock("this file does import sync")

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
a.NewMetaContainer()

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type Session struct {
privateField a.Val[string]

View File

@ -4,7 +4,7 @@
package main
import "b"
import "./b"
func main() {
var _ b.Session

View File

@ -8,7 +8,7 @@ import (
"fmt"
"reflect"
"a"
"./a"
)
func main() {

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
)
// Creates copy of set

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type (
lA[P any] [10]P

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -4,14 +4,14 @@
package b
import "a"
import "./a"
//go:noinline
func F() interface {} {
func F() interface{} {
return a.T[int]{}
}
//go:noinline
func G() interface{} {
return struct{X,Y a.U}{}
return struct{ X, Y a.U }{}
}

View File

@ -4,14 +4,14 @@
package c
import "a"
import "./a"
//go:noinline
func F() interface {} {
func F() interface{} {
return a.T[int]{}
}
//go:noinline
func G() interface{} {
return struct{X,Y a.U}{}
return struct{ X, Y a.U }{}
}

View File

@ -5,8 +5,8 @@
package main
import (
"b"
"c"
"./b"
"./c"
)
func main() {

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
a.F[string]()

View File

@ -4,7 +4,7 @@ package main
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import "a"
import "./a"
func main() {
a.F[int]()

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type B[T any] struct {
v a.A[T]

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type B[T any] struct {
_ a.A[T]

View File

@ -4,7 +4,7 @@
package main
import "b"
import "./b"
func main() {
var _ b.B[int]

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
type Ap1[A, B any] struct {
opt a.Option[A]

View File

@ -5,7 +5,7 @@
package main
import (
"b"
"./b"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
)
//go:noinline

View File

@ -5,7 +5,7 @@
package b
import (
"a"
"./a"
)
var IntBuilder = a.Builder[int]{}

View File

@ -5,7 +5,7 @@
package c
import (
"b"
"./b"
)
func BuildInt() int {

View File

@ -5,7 +5,7 @@
package d
import (
"c"
"./c"
)
func BuildInt() int {

View File

@ -1,7 +1,7 @@
package main
import (
"d"
"./d"
"fmt"
)

View File

@ -8,7 +8,7 @@
package main
import (
"b"
"./b"
"fmt"
)

View File

@ -8,7 +8,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -1,7 +1,7 @@
package main
import (
"a"
"./a"
)
func main() {

View File

@ -1,6 +1,6 @@
package main
import fp "goerror_fp"
import fp "./goerror_fp"
func Fold[A, B any](zero B, a A, f func(B, A) B) B {
return f(zero, a)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"diameter"
"./diameter"
)
func main() {

View File

@ -4,7 +4,7 @@
package a1
import "a0"
import "./a0"
func New() int {
return a0.IntBuilder{}.New()

View File

@ -4,7 +4,7 @@
package a2
import "a0"
import "./a0"
func New() int {
return a0.Builder[int]{}.New1()

View File

@ -7,8 +7,8 @@ package main
import (
"fmt"
"a1"
"a2"
"./a1"
"./a2"
)
func New() int {

View File

@ -4,7 +4,7 @@
package b
import "a"
import "./a"
func F() {
a.Marshal[int]()

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
)
func main() {

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"strconv"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"reflect"
"strconv"

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"math"
"sort"

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"bytes"
"fmt"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"unsafe"
)

View File

@ -4,7 +4,7 @@
package main
import "a"
import "./a"
func main() {
a.F(5.3)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"sort"
)

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"math"
"strings"

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
"reflect"
"strconv"

View File

@ -5,7 +5,7 @@
package main
import (
"a"
"./a"
"fmt"
)