Debian Codegraph @

gopls/internal/test/marker/testdata/codeaction/inline_issue67336.txt

raw
1 This is the test case from golang/go#67335, where the inlining resulted in bad
2 formatting.
3
4 The __unused__ import results in removal after a subsequent "organize imports" step.
5
6 -- go.mod --
7 module example.com
8
9 go 1.20
10
11 -- define/my/typ/foo.go --
12 package typ
13 type T int
14
15 -- some/other/pkg/foo.go --
16 package pkg
17 import "context"
18 import "example.com/define/my/typ"
19 func Foo(typ.T) context.Context{ return nil }
20
21 -- one/more/pkg/foo.go --
22 package pkg
23 func Bar() {}
24
25 -- to/be/inlined/foo.go --
26 package inlined
27
28 import "context"
29 import "example.com/some/other/pkg"
30 import "example.com/define/my/typ"
31
32 func Baz(ctx context.Context) context.Context {
33 return pkg.Foo(typ.T(5))
34 }
35
36 -- b/c/foo.go --
37 package c
38 import (
39 "context"
40 "example.com/to/be/inlined"
41 "example.com/one/more/pkg"
42 )
43
44 const (
45 // This is a constant
46 SomeConst = 5
47 )
48
49 func _() {
50 inlined.Baz(context.TODO()) //@ codeaction("Baz", "refactor.inline.call", result=inline)
51 pkg.Bar()
52 }
53
54 -- @inline/b/c/foo.go --
55 package c
56 import (
57 "context"
58
59 "example.com/one/more/pkg"
60 pkg0 "example.com/some/other/pkg"
61 "example.com/define/my/typ"
62 )
63
64 const (
65 // This is a constant
66 SomeConst = 5
67 )
68
69 func _() {
70 var _ context.Context = context.TODO()
71 pkg0.Foo(typ.T(5)) //@ codeaction("Baz", "refactor.inline.call", result=inline)
72 pkg.Bar()
73 }
74