File tree Expand file tree Collapse file tree 10 files changed +164
-16
lines changed Expand file tree Collapse file tree 10 files changed +164
-16
lines changed Original file line number Diff line number Diff line change 1- # サンプルリスト
1+ # サンプルリスト
22
33このディレクトリには以下のサンプルがあります。
44
5- | file | example name | note |
6- | -------------------------- | -------------------| ----------------------------|
7- | nomutex/nomutex.go | mutex \_ nomutex | Mutexを利用しない場合のサンプルです. |
8- | usemutex/usemutex.go | mutex \_ usemutex | Mutexを利用した場合のサンプルです. |
9- | usechannel/usechannel.go | mutex \_ usechannel | Mutexの代わりにチャネルを利用したサンプルです. |
5+ | file | example name | note |
6+ | ------------------------ | -- -------------- | ---------------------------------------------- |
7+ | nomutex/nomutex.go | mutex_nomutex | Mutexを利用しない場合のサンプルです. |
8+ | usemutex/usemutex.go | mutex_usemutex | Mutexを利用した場合のサンプルです. |
9+ | usechannel/usechannel.go | mutex_usechannel | Mutexの代わりにチャネルを利用したサンプルです. |
Original file line number Diff line number Diff line change @@ -54,4 +54,20 @@ func NoMutex() error {
5454 output .Stdoutl ("[balance]" , balance )
5555
5656 return nil
57+
58+ /*
59+ $ task
60+ task: Task "build" is up to date
61+ task: [run] ./try-golang -onetime
62+
63+ ENTER EXAMPLE NAME: mutex_nomutex
64+
65+ [Name] "mutex_nomutex"
66+ [execCount] 20000
67+ [balance] 1310
68+
69+
70+ [Elapsed] 10.71242ms
71+ */
72+
5773}
Original file line number Diff line number Diff line change @@ -58,4 +58,20 @@ func UseChannel() error {
5858 output .Stdoutl ("[balance]" , <- balance )
5959
6060 return nil
61+
62+ /*
63+ $ task
64+ task: [build] go build .
65+ task: [run] ./try-golang -onetime
66+
67+ ENTER EXAMPLE NAME: mutex_usechannel
68+
69+ [Name] "mutex_usechannel"
70+ [execCount] 20000
71+ [balance] 1000
72+
73+
74+ [Elapsed] 26.932628ms
75+ */
76+
6177}
Original file line number Diff line number Diff line change @@ -61,4 +61,20 @@ func UseMutex() error {
6161 output .Stdoutl ("[balance]" , balance )
6262
6363 return nil
64+
65+ /*
66+ $ task
67+ task: [build] go build .
68+ task: [run] ./try-golang -onetime
69+
70+ ENTER EXAMPLE NAME: mutex_usemutex
71+
72+ [Name] "mutex_usemutex"
73+ [execCount] 20000
74+ [balance] 1000
75+
76+
77+ [Elapsed] 11.125079ms
78+ */
79+
6480}
Original file line number Diff line number Diff line change 22
33このディレクトリには以下のサンプルがあります。
44
5- | file | example name | note |
6- | -----------------------------------| -----------------------------------------| ---------------------------------------------------------------|
7- | ipaddress \_ parse .go | network \_ ipaddress \_ parse | net.ParseIP() の サンプルです. |
8- | ssh \_ no \_ privkey \_ passphrase .go | network \_ ssh \_ no \_ privkey \_ passphrase | 秘密鍵のパスフレーズ無しのSSH接続サンプルです. |
9- | ssh \_ with \_ privkey \_ passphrase .go | network \_ ssh \_ with \_ privkey \_ passphrase | 秘密鍵のパスフレーズありのSSH接続サンプルです. |
10- | ssh \_ close \_ after \_ run .go | network \_ ssh \_ close \_ after \_ run | ssh.Run() を呼んだ後に ssh.Close() を呼ぶと io.EOF が返却されることを確認するサンプルです. |
11- | http \_ get .go | network \_ http \_ get | http.Get() の サンプルです. |
12- | join \_ host \_ port .go | network \_ join \_ host \_ port | JoinHostPort は、net.JoinHostPort のサンプルです |
13- | split \_ host \_ port .go | network \_ split \_ host \_ port | SplitJoinPort は、net.SplitHostPort のサンプルです |
14- | lookup \_ port .go | network \_ lookup \_ port | LookupPort は、 net.LookupPort() のサンプルです |
5+ | file | example name | note |
6+ | ------------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------ |
7+ | ipaddress_parse .go | network_ipaddress_parse | net.ParseIP() の サンプルです. |
8+ | ssh_no_privkey_passphrase .go | network_ssh_no_privkey_passphrase | 秘密鍵のパスフレーズ無しのSSH接続サンプルです. |
9+ | ssh_with_privkey_passphrase .go | network_ssh_with_privkey_passphrase | 秘密鍵のパスフレーズありのSSH接続サンプルです. |
10+ | ssh_close_after_run .go | network_ssh_close_after_run | ssh.Run() を呼んだ後に ssh.Close() を呼ぶと io.EOF が返却されることを確認するサンプルです. |
11+ | http_get .go | network_http_get | http.Get() の サンプルです. |
12+ | join_host_port .go | network_join_host_port | JoinHostPort は、net.JoinHostPort のサンプルです |
13+ | split_host_port .go | network_split_host_port | SplitJoinPort は、net.SplitHostPort のサンプルです |
14+ | lookup_port .go | network_lookup_port | LookupPort は、 net.LookupPort() のサンプルです |
Original file line number Diff line number Diff line change @@ -79,4 +79,20 @@ func HttpGet() error {
7979 }
8080
8181 return nil
82+
83+ /*
84+ $ task
85+ task: Task "build" is up to date
86+ task: [run] ./try-golang -onetime
87+
88+ ENTER EXAMPLE NAME: network_http_get
89+
90+ [Name] "network_http_get"
91+ recv bytes 173143
92+ http.get GitHub - devlights/try-golang: This is my TUTORIAL project for golang.
93+
94+
95+ [Elapsed] 448.931025ms
96+ */
97+
8298}
Original file line number Diff line number Diff line change @@ -22,4 +22,21 @@ func IpAddressParse() error {
2222 }
2323
2424 return nil
25+
26+ /*
27+ $ task
28+ task: [build] go build .
29+ task: [run] ./try-golang -onetime
30+
31+ ENTER EXAMPLE NAME: network_ipaddress_parse
32+
33+ [Name] "network_ipaddress_parse"
34+ [OK] 127.0.0.1
35+ [NG] 127.0.01
36+ [NG] invalid
37+
38+
39+ [Elapsed] 47.1µs
40+ */
41+
2542}
Original file line number Diff line number Diff line change @@ -35,4 +35,22 @@ func JoinHostPort() error {
3535 }
3636
3737 return nil
38+
39+ /*
40+ $ task
41+ task: [build] go build .
42+ task: [run] ./try-golang -onetime
43+
44+ ENTER EXAMPLE NAME: network_join_host_port
45+
46+ [Name] "network_join_host_port"
47+ [JoinHostPort] :9999
48+ [JoinHostPort] 127.0.0.1:9999
49+ [JoinHostPort] localhost:9999
50+ [JoinHostPort] [::1]:9999
51+
52+
53+ [Elapsed] 18.86µs
54+ */
55+
3856}
Original file line number Diff line number Diff line change @@ -50,4 +50,29 @@ func LookupPort() error {
5050 }
5151
5252 return nil
53+
54+ /*
55+ $ task
56+ task: [build] go build .
57+ task: [run] ./try-golang -onetime
58+
59+ ENTER EXAMPLE NAME: network_lookup_port
60+
61+ [Name] "network_lookup_port"
62+ [LookupPort] serivce=ftp port=21
63+ [LookupPort] serivce=ssh port=22
64+ [LookupPort] serivce=telnet port=23
65+ [LookupPort] serivce=http port=80
66+ [LookupPort] serivce=pop3 port=110
67+ [LookupPort] serivce=imap port=143
68+ [LookupPort] serivce=https port=443
69+ [LookupPort] serivce=8888 port=8888
70+ [Err] service=-1 Err=address -1: invalid port
71+ [Err] service=65536 Err=address 65536: invalid port
72+ [Err] service=xdmcp Err=lookup tcp/xdmcp: Servname not supported for ai_socktype
73+
74+
75+ [Elapsed] 4.762829ms
76+ */
77+
5378}
Original file line number Diff line number Diff line change @@ -42,4 +42,28 @@ func SplitHostPort() error {
4242 }
4343
4444 return nil
45+
46+ /*
47+ $ task
48+ task: [build] go build .
49+ task: [run] ./try-golang -onetime
50+
51+ ENTER EXAMPLE NAME: network_split_host_port
52+
53+ [Name] "network_split_host_port"
54+ [Original ] :9999
55+ [SplitHostPort] host= port=9999
56+ [Original ] 127.0.0.1:9999
57+ [SplitHostPort] host=127.0.0.1 port=9999
58+ [Original ] localhost:9999
59+ [SplitHostPort] host=localhost port=9999
60+ [Original ] [::1]:9999
61+ [SplitHostPort] host=::1 port=9999
62+ [Original ] [fe80::a%eth0]:9999
63+ [SplitHostPort] host=fe80::a%eth0 port=9999
64+
65+
66+ [Elapsed] 100.64µs
67+ */
68+
4569}
You can’t perform that action at this time.
0 commit comments