Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: add examples #5757

Closed
adg opened this issue Jun 23, 2013 · 17 comments

Comments

Projects
None yet
10 participants
@adg
Copy link
Contributor

commented Jun 23, 2013

The net package is somewhat overwhelming. Good examples would help.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2013

Comment 1:

Labels changed: added go1.2.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2013

Comment 2:

Labels changed: added documentation.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2013

Comment 3:

Labels changed: added go1.2maybe, removed go1.2.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 2, 2013

Comment 4:

Labels changed: added go1.3, removed go1.2maybe.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 2, 2013

Comment 5 by imjasonh:

What kinds of samples are you looking for? I'd be happy to contribute some simple ones
if there are requests for anything in particular.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 6:

Labels changed: added release-go1.3.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 7:

Labels changed: removed go1.3.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

Comment 9:

Labels changed: removed release-go1.3.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

Comment 10:

Labels changed: added release-none.

@marcellanz

This comment has been minimized.

Copy link

commented Jul 22, 2015

what is the intention and scope of examples in the documentation? is it defined how examples complement the documentation?

@parkr

This comment has been minimized.

Copy link

commented Nov 24, 2015

The net package is somewhat overwhelming. Good examples would help.

@adg Have a moment to answer @marcellanz's question? Thank you!

@bradfitz

This comment has been minimized.

Copy link
Member

commented Feb 20, 2016

@marcellanz, examples are documentation. Some people prefer to learn by reading code instead of reading words.

@kavirajk

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2016

net package have just one example https://golang.org/pkg/net/#example_Listener And even that fails with following error.

`
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [semacquire]:
sync.runtime_notifyListWait(0x1054e080, 0x0)
/usr/local/go/src/runtime/sema.go:267 +0x1e0
sync.(_Cond).Wait(0x1054e078, 0x1054e070)
/usr/local/go/src/sync/cond.go:57 +0xe0
syscall.(_queue).waitRead(0x1054e070, 0x1, 0x0, 0x0, 0x105000f0, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/net_nacl.go:263 +0x180
syscall.(_msgq).read(0x1054e070, 0x1050e090, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/net_nacl.go:377 +0xc0
syscall.(_netFile).accept(0x10534100, 0x1c8da0, 0x10534100, 0x0, 0x0, 0x0, 0x0, 0x1050e0f8)
/usr/local/go/src/syscall/net_nacl.go:539 +0x60
syscall.Accept(0x3, 0x77d5, 0x10534140, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/net_nacl.go:759 +0xa0
net.accept(0x3, 0x170144, 0x10534140, 0x0, 0x0, 0x0, 0x0, 0x77d5)
/usr/local/go/src/net/sys_cloexec.go:45 +0x60
net.(_netFD).accept(0x10534140, 0x1, 0x0, 0x0, 0x0, 0x2)
/usr/local/go/src/net/fd_unix.go:411 +0x220
net.(_TCPListener).accept(0x1050a188, 0x1c02a0, 0x10529f28, 0x0, 0x0, 0x10529f28)
/usr/local/go/src/net/tcpsock_posix.go:132 +0x40
net.(*TCPListener).Accept(0x1050a188, 0x1c053c, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/tcpsock.go:222 +0xc0
main.main()
/tmp/sandbox839529466/main.go:18 +0x1a0
`

I'm thinking covering some examples for net package. Can we use any ports in the examples? just wondering how it will work
//cc @adg

@gopherbot

This comment has been minimized.

Copy link

commented May 8, 2017

CL https://golang.org/cl/42912 mentions this issue.

robphoenix added a commit to robphoenix/go that referenced this issue May 8, 2017

net: add examples for IPv4(), ParseCIDR() & IPv4Mask()
Further examples to support the net package.

See issue golang#5757

Change-Id: I839fd97a468c8d9195e8f4a0ee886ba50ca3f382

gopherbot pushed a commit that referenced this issue May 9, 2017

net: add examples for IPv4, ParseCIDR & IPv4Mask
Further examples to support the net package.

See issue #5757

Change-Id: I839fd97a468c8d9195e8f4a0ee886ba50ca3f382
Reviewed-on: https://go-review.googlesource.com/42912
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented May 19, 2017

CL https://golang.org/cl/43711 mentions this issue.

gopherbot pushed a commit that referenced this issue May 22, 2017

net: add examples for ParseIP, IP.DefaultMask & IP.Mask
Further examples to support the net package.

Updates #5757

Change-Id: I9b65521d211f6c404b9103c1eaf22b0772eb242e
Reviewed-on: https://go-review.googlesource.com/43711
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
@kennygrant

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2017

The package now has 8 examples, so perhaps this could be closed as fixed?

https://tip.golang.org/pkg/net/#pkg-examples

@cybrcodr cybrcodr closed this Jul 15, 2017

@golang golang locked and limited conversation to collaborators Jul 15, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.