Golang Viewer Test

code_thinker_go/test_files/say_hello.go
1package main
2
3import (
4    subselImp "code_thinker_go/test_files/sel/subsel"
5    "fmt"
6    "go/build"
7)
8
9type CompisiteScopeType int
10
11const (
12    CompisiteScopeTop          CompisiteScopeType = 0
13    CompisiteScopeNon          CompisiteScopeType = 1
14    CompisiteScopeFuncDecl     CompisiteScopeType = 2
15    CompisiteScopeTypeDecl     CompisiteScopeType = 3
16    CompisiteScopeTypeRecv     CompisiteScopeType = 4
17    CompisiteScopeStructAssign CompisiteScopeType = 5
18    CompisiteScopeRangeStmt    CompisiteScopeType = 6
19
20    ScopePathSep     = ":"
21    ScopeDefineSep   = "."
22    ScopePackageName = "pkg"
23
24    ScopeBlockStmt = "BlockStmt"
25    ScopeRangeStmt = "RangeStmt"
26    ScopeElts      = "Elts"
27)
28
29var test string = "test"
30
31var ignoreVendor build.ImportMode
32
33type TestStructSubMethod struct {
34    methodTest  string
35    Build       *build.Context
36    FindPackage func(ctxt *build.ContextimportPathfromDir stringmode build.ImportMode) (*build.Packageerror)
37}
38
39func (ts TestStructSubMethodtestSelCopy() string {
40    stt := ts.methodTest
41    return stt
42}
43
44func (ts TestStructSubMethodbuild() *build.Context {
45    return &build.Default
46}
47
48type TestStructKey struct {
49    A       string
50    B       int
51    C       TestStructSub
52    TestASN string
53}
54
55type TestStructSub struct {
56    TestStructSubMethodMap    map[string]*TestStructSubMethod                                     // ast file map
57    TestStructSubMethodMapMap map[subselImp.TestStruct]map[string]map[string]*TestStructSubMethod // ast file map
58    TestStructSubMethodKeyMap map[*subselImp.TestStruct]*TestStructSubMethod                      // ast file map
59
60    EEEEEEEEEEE string
61    F           int
62
63    Sub      *TestStructSubSub
64    SubArray []TestStructSubSub
65}
66
67func (ts *TestStructSubSayGood(sts *subselImp.TestStructOther) (b *TestStructSubd *subselImp.TestStructOthere TestStructSubSub) {
68
69    var testStructSubMethodMapC []*subselImp.TestStructOther
70    for indexitem := range testStructSubMethodMapC {
71        fmt.Printf("%d, %s"indexitem.A)
72    }
73
74    var testStructSubMethodArray []*TestStructSubMethod
75    for indexitem := range testStructSubMethodArray {
76        fmt.Printf("%d, %s"indexitem.methodTest)
77    }
78
79    fmt.Printf("%d %s", (int)(CompisiteScopeTop), ScopeRangeStmt)
80    ts.Sub.SayGood("")
81    for _item := range ts.TestStructSubMethodMapMap {
82        fmt.Printf("%d"len(item))
83        for index1item1 := range item {
84            fmt.Printf("%s, %d"index1len(item1))
85
86            for index2item2 := range item1 {
87                fmt.Printf("%s, %s"index2item2.methodTest)
88            }
89        }
90    }
91    for indexitem := range ts.TestStructSubMethodMap {
92        fmt.Printf("%d, %s"indexitem.methodTest)
93    }
94    var testStructSubMethodMap map[string]*TestStructSubMethod
95    for indexitem := range testStructSubMethodMap {
96        fmt.Printf("%d, %s"indexitem.methodTest)
97    }
98    //testStructSubMethodMapB := &testStructSubMethodMap //make(map[subselImp.TestStructOther]*subselImp.TestStructOther)
99    //testStructSubMethodMapC := make(map[subselImp.TestStructOther]*subselImp.TestStructOther)
100    for indexitem := range testStructSubMethodMapC {
101        fmt.Printf("%d, %s"indexitem.A)
102    }
103
104    rtnSubsetOther := &subselImp.TestStructOther{}
105    rtnSubsetOtherStar := subselImp.TestStructOther{}
106    rtnSubsetOtherB := *rtnSubsetOther
107    rtnSubsetOtherG := &rtnSubsetOtherStar
108    rtnSubsetOtherH := rtnSubsetOther
109    rtnSubsetOtherH.SayGood2("")
110    rtnSubsetOtherB.SayGood("")
111    rtnSubsetOtherG.SayGood2("")
112    rtnSubsetOtherC := ""
113    rtnSubsetOtherD := 100
114    rtnSubsetOtherE := TestStructSub{}
115    rtnSubsetOtherF := &TestStructSub{}
116    fmt.Printf("%s %d"rtnSubsetOtherCrtnSubsetOtherD)
117    rtnSubsetOtherE.SayGood2("")
118    rtnSubsetOtherF.SayGood2("")
119
120    sts.SayGoodXXBB("")
121    d.SayGoodXXBB("")
122    b.TestStructSubBB("")
123
124    tst := ts.TestStructSub("")
125
126    fmt.Printf("hello good %s"ts.EEEEEEEEEEE[0:len(tst.EEEEEEEEEEE)-1])
127    subselImp := subselImp.SayGoodTestWhile("")
128    {
129        subselImp := subselImp.SayGoodTestStruct("")
130        subselImp.SayGood("")
131        fmt.Println(subselImp)
132        {
133            subselImp := subselImp.A
134            fmt.Printf("%s %s"subselImprtnSubsetOther.A)
135        }
136    }
137
138    return nilrtnSubsetOtherTestStructSubSub{}
139}
140
141func SayGood(sts *subselImp.TestStructOther) (b *TestStructSubd *subselImp.TestStructOthere TestStructSubSub) {
142    return &TestStructSub{}, &subselImp.TestStructOther{}, TestStructSubSub{}
143}
144
145func (ts *TestStructSubSayGood2(word string) *subselImp.TestStruct {
146    fmt.Printf("hello good %s %d"wordts.F)
147    return nil
148}
149
150func (ts *TestStructSubTestStructSub(word stringTestStructSub {
151    return TestStructSub{}
152}
153
154func (ts *TestStructSubTestStructSubBB(word stringTestStructSub {
155    return TestStructSub{}
156}
157
158func (ts *TestStructSubTestStructOther(word stringsubselImp.TestStructOther {
159    return subselImp.TestStructOther{}
160}
161
162func (ts *TestStructSubTestStructSubMethod(word stringTestStructSubMethod {
163    return TestStructSubMethod{}
164}
165
166func main() {
167    TestPackageSayGood("")
168    GetTestStructSubMethod().SayGood("")
169
170    var abc TestStructSub
171    test = abc.SubArray[0].SubSub.SubSubSub.SayGoodSubSubSub("").SubSubSubEEEE
172    testSubtestSubBtestSubC := SayGood(nil)
173    testSub.EEEEEEEEEEE = "tttt"
174    testSubB.B = 1
175    testSubC.SubEEEE = "ss"
176
177    testresult := abc.SayGood2("").SayGoodTest("").Sub.SayGood("")
178    fmt.Printf("test%s"testresult)
179
180    abc.Sub.SubSub.SubSubSub.SubSubSubEEEE = "SUBEEEEEE"
181
182    //TestASN := ""
183    ts := subselImp.TestStruct{
184        TestASN"",
185        B:       100,
186    }
187    ts.A = "bbbbb"
188    ts.SayGoodTest("hello")
189    /*
190        var abcd, aa TestStructSub
191        abcd.SayGood(test)
192        abcd.EEEEEEEEEEE = "tttt"
193        aa.Sub.SubF = 1
194
195        abc, efg := TestStructSub{}, TestStructSubSub{}
196        //var abc TestStructSub
197        abc.SayGood(test)
198        abc.F = 1
199
200        efg.SubEEEE = ""
201        efg.SayGood("")
202
203
204    */
205
206    //hello := "Hello" //test comment
207    //world := "World" // test comment
208    //words := []string{""} //[]string{hello /*testcomment*/, world /**test comment*/}
209
210    TestPackageSelector("input")
211    if test == "" {
212        test = ""
213        test2 = ""
214    }
215
216    //var abcIn TestStructSubSub
217
218    //abcIn.SubEEEE = "feeeeeee"
219
220    //SayHello(words)
221    //test = ""
222    //fmt.Print(test)
223}
224
225func TestPackageSelector(str string) {
226    //SayHello([]string{""})
227    test = "aaaa"
228
229    a := 0
230    a = 1
231    {
232        a := 2
233        if a == 2 {
234            a = 3
235        }
236    }
237    if a == 3 {
238        a = 1
239    }
240    test = str
241
242    ts := subselImp.TestStruct{
243        A"aaaa",
244        B100,
245    }
246
247    ts.B = 1000
248    ts.C.E = "ttt"
249    ts.SayGood("sel hello")
250
251    /*
252        {
253            ts := subsel.TestStruct{
254                A: str,
255                B: 100,
256            }
257            ts.B = 1001
258
259            {
260                ts := subsel.TestStruct{
261                    A: str,
262                    B: 100,
263                }
264                ts.B = 1001
265
266                {
267                    ts := subsel.TestStruct{
268                        A: str,
269                        B: 100,
270                    }
271                    ts.B = 1001
272                }
273            }
274        }
275    */
276}
277
278/*
279// SayHello says Hello
280func SayHello(words []string) {
281    fmt.Println(joinStrings(words))
282}
283
284// joinStrings joins strings
285func joinStrings(words []string) string {
286    return strings.Join(words, ", ")
287}
288*/
289
290type TestStructSubSubSubSub struct {
291    SubSubSubEEEE string
292    SubSubSubF    int
293}
294
295func (ts TestStructSubSubSubSubSayGoodSubSubSub(word string) *TestStructSubSubSubSub {
296    fmt.Printf("hello good %s %d"wordts.SubSubSubF)
297    return nil
298}
299
300type TestStructSubSubSub struct {
301    SubSubEEEE string
302    SubSubF    int
303
304    SubSubSub TestStructSubSubSubSub
305}
306
307type TestStructSubSub struct {
308    SubEEEE string
309    SubF    int
310
311    SubSub TestStructSubSubSub
312}
313
314func (ts TestStructSubSubSayGood(word string) *TestStructSubSub {
315    fmt.Printf("hello good %s %d"wordts.SubF)
316    return nil
317}
318
TestStructSub.TestStructSubMethod
TestPackageSelector.str
TestStructSubSubSubSub.SayGoodSubSubSub.word
TestStructSubMethod.build.ts
TestStructSub.EEEEEEEEEEE
TestStructSub.SayGood.rtnSubsetOtherE
TestStructSubSubSubSub
TestStructSub.SayGood.RangeStmt_1841.item
TestStructSub.SayGood.RangeStmt_2440.item
SayGood.d
TestStructSub.SayGood.RangeStmt_1988.index
SayGood
TestStructSubSubSub.SubSubF
TestStructSub.SayGood.b
TestStructSub.SayGood.e
TestStructSubSubSubSub.SubSubSubEEEE
TestStructSub.TestStructSubMethodKeyMap
TestStructSub.TestStructSub.word
TestStructSub.TestStructSubMethod.word
TestStructSubSub.SayGood.ts
TestStructSubSub.SayGood.word
TestStructSub.TestStructSubMethodMap
TestStructSub.SayGood.testStructSubMethodMap
SayGood.e
TestStructSub.SayGood.RangeStmt_2175.item
TestStructSub.SayGood2.word
main.testresult
TestStructSubSub.SubEEEE
TestStructSub.F
TestStructSub.TestStructOther.word
main.ts
subselImp
TestPackageSelector.ts
TestStructSub.TestStructSubBB.word
TestStructSubSubSub.SubSubSub
TestStructKey.B
main.abc
TestStructSubSubSubSub.SayGoodSubSubSub
TestStructSub.SayGood.tst
SayGood.b
TestStructSubSubSub
CompisiteScopeFuncDecl
ScopeElts
TestStructSub.SayGood.rtnSubsetOther
CompisiteScopeRangeStmt
TestStructSubSubSub.SubSubEEEE
TestStructSub.SayGood.BlockStmt.subselImp
TestStructSub.SayGood2.ts
TestStructSubMethod.testSelCopy.stt
TestStructSub
TestStructSub.SayGood.RangeStmt_2175.BlockStmt.RangeStmt_2259.item1
TestStructSub.TestStructOther
main.testSubB
TestPackageSelector.BlockStmt.a
ScopePackageName
TestStructKey.A
TestStructKey.C
TestStructSub.SayGood
TestStructSub.SayGood.rtnSubsetOtherG
TestStructSub.TestStructOther.ts
TestStructSub.TestStructSubMethod.ts
CompisiteScopeStructAssign
ScopeRangeStmt
TestStructSubMethod.methodTest
TestStructSubSubSubSub.SubSubSubF
TestStructSubSub
CompisiteScopeTypeDecl
TestStructSubMethod.testSelCopy.ts
TestStructSub.SayGood.RangeStmt_1841.index
TestStructSub.TestStructSubBB.ts
TestStructSubSubSubSub.SayGoodSubSubSub.ts
SayGood.sts
CompisiteScopeNon
test
TestStructKey
TestStructSubMethod.build
TestStructSub.SayGood.RangeStmt_2604.item
TestStructSub.SayGood.rtnSubsetOtherC
ignoreVendor
main
main.testSubC
TestStructSub.SayGood.RangeStmt_2917.item
TestStructSub.TestStructSub
TestStructSubSub.SayGood
TestStructSubMethod.testSelCopy
TestStructSub.Sub
TestStructSub.SubArray
TestStructSub.SayGood.sts
TestStructSub.SayGood.d
TestStructSub.SayGood.RangeStmt_2917.index
TestStructSub.SayGood.rtnSubsetOtherStar
TestStructSub.TestStructSubBB
build
ScopeDefineSep
TestStructSubMethod.FindPackage
TestStructSub.SayGood.RangeStmt_2440.index
TestStructSub.SayGood.RangeStmt_2604.index
TestStructSub.SayGood.rtnSubsetOtherD
TestStructSub.TestStructSub.ts
CompisiteScopeTypeRecv
TestStructSub.SayGood.ts
TestStructSub.SayGood.testStructSubMethodMapC
TestPackageSelector
TestStructSub.SayGood.RangeStmt_1988.item
TestStructSub.SayGood.RangeStmt_2175.BlockStmt.RangeStmt_2259.BlockStmt.RangeStmt_2341.item2
TestStructSub.SayGood.rtnSubsetOtherF
TestStructSub.SayGood.subselImp
CompisiteScopeType
TestStructSubMethod
TestStructKey.TestASN
TestStructSubMethod.Build
TestStructSub.SayGood.RangeStmt_2175.BlockStmt.RangeStmt_2259.BlockStmt.RangeStmt_2341.index2
TestStructSub.SayGood2
fmt
ScopePathSep
ScopeBlockStmt
TestStructSub.SayGood.rtnSubsetOtherH
main.testSub
TestPackageSelector.a
TestStructSubSub.SubSub
CompisiteScopeTop
TestStructSub.TestStructSubMethodMapMap
TestStructSub.SayGood.testStructSubMethodArray
TestStructSub.SayGood.RangeStmt_2175.BlockStmt.RangeStmt_2259.index1
TestStructSub.SayGood.rtnSubsetOtherB
TestStructSubSub.SubF
TestStructSub.SayGood.BlockStmt.BlockStmt.subselImp