Skip to content

Commit a7fa875

Browse files
committed
add go1.14 examples
1 parent a84dadc commit a7fa875

File tree

5 files changed

+104
-1
lines changed

5 files changed

+104
-1
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ module github.com/bigwhite/experiments
22

33
go 1.12
44

5-
require github.com/bigwhite/gocmpp v0.0.0-20190917110902-55b5d3d9ff3b
5+
require (
6+
github.com/bigwhite/gocmpp v0.0.0-20190917110902-55b5d3d9ff3b
7+
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
8+
)

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/
1616
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
1717
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
1818
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
19+
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
20+
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
21+
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4quafGxDT9LDasjGdlGkzLbfmmrlng3kA=
22+
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
1923
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
2024
github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
2125
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -166,6 +170,7 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w
166170
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
167171
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
168172
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
173+
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
169174
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
170175
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
171176
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package foo
2+
3+
type I interface {
4+
f()
5+
String() string
6+
}
7+
type J interface {
8+
g()
9+
String() string
10+
}
11+
12+
type IJ interface {
13+
I
14+
J
15+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package main
2+
3+
type I interface {
4+
f()
5+
String() string
6+
}
7+
8+
type implOfI struct{}
9+
10+
func (implOfI) f() {}
11+
func (implOfI) String() string {
12+
return "implOfI"
13+
}
14+
15+
type J interface {
16+
g()
17+
String() string
18+
}
19+
20+
type implOfJ struct{}
21+
22+
func (implOfJ) g() {}
23+
func (implOfJ) String() string {
24+
return "implOfJ"
25+
}
26+
27+
type Foo struct {
28+
I
29+
J
30+
}
31+
32+
func main() {
33+
f := Foo{
34+
I: implOfI{},
35+
J: implOfJ{},
36+
}
37+
println(f.String())
38+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package main
2+
3+
type I interface {
4+
f()
5+
String() string
6+
}
7+
8+
type implOfI struct{}
9+
10+
func (implOfI) f() {}
11+
func (implOfI) String() string {
12+
return "implOfI"
13+
}
14+
15+
type J interface {
16+
g()
17+
String() string
18+
}
19+
20+
type implOfJ struct{}
21+
22+
func (implOfJ) g() {}
23+
func (implOfJ) String() string {
24+
return "implOfJ"
25+
}
26+
27+
type Foo struct {
28+
I
29+
J
30+
}
31+
32+
func (Foo) String() string {
33+
return "Foo"
34+
}
35+
36+
func main() {
37+
f := Foo{
38+
I: implOfI{},
39+
J: implOfJ{},
40+
}
41+
println(f.String())
42+
}

0 commit comments

Comments
 (0)