-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestModel.go
More file actions
53 lines (41 loc) · 902 Bytes
/
Copy pathtestModel.go
File metadata and controls
53 lines (41 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"context"
"fmt"
//"github.com/lubit/berg/models"
)
func TestModel() {
//application := models.NewJob()
////application.AppChannels.AddChannel()
//
//application.AppSource.Execute(application.AppChannels)
var tmpslice []int
tmpslice = append(tmpslice, 1)
tmpslice = append(tmpslice, 2)
fmt.Println(tmpslice[0], tmpslice[1])
//fmt.Printf("New Application Initiated:%v",application)
a()
inchan := make(chan int, 1)
inchan <- 1
ctx, cancel := context.WithCancel(context.Background())
//go func(){
// defer cancel()
// <- inchan
// fmt.Println("inside")
//}()
fmt.Println(ctx, cancel)
//fearless-ry added for name test
//context
}
func a() {
var i int
defer func() {
i++
fmt.Println("defer2:", i) // 打印结果为 defer: 2
}()
defer func() {
i++
fmt.Println("defer1:", i) // 打印结果为 defer: 1
}()
fmt.Println("value i:", i)
}