1
0
mirror of https://github.com/golang/go synced 2024-07-03 00:40:45 +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 // that are expected to be inlined
package main package main
import "a" import "./a"
func main() { func main() {
if !a.G()()() { if !a.G()()() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package main 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 { func Fold[A, B any](zero B, a A, f func(B, A) B) B {
return f(zero, a) return f(zero, a)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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