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

container/list: list.Remove set the e.list = nil, if the Element isn't in the List #4103

Closed
gopherbot opened this issue Sep 19, 2012 · 3 comments
Milestone

Comments

@gopherbot
Copy link

by karlcpp:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Create 2 Lists, l1 and l2, and insert 2 elements in each list
2. Remove the element e that is belong to l1 from l2
3. Then, l1.InsertBefore(8, e), it can not work, because of e.list is nil when Remove it
from l2
4. My Test code at: http://play.golang.org/p/MwAFxq-4x4

What is the expected output?


What do you see instead?
Insert follow code in Remove method:
    if e.list != l {
        return
    }

Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?
Windows 7

Which version are you using?  (run 'go version')
1.0.2

Please provide any additional information below.

Attachments:

  1. test_list_remove.go (295 bytes)
@rsc
Copy link
Contributor

rsc commented Sep 20, 2012

Comment 1:

In http://play.golang.org/p/MwAFxq-4x4 it seems to me that these routines might as well
just panic if called with the wrong list.

Labels changed: added priority-later, go1.1, removed priority-triage.

Owner changed to @griesemer.

Status changed to Accepted.

@fsouza
Copy link
Contributor

fsouza commented Sep 20, 2012

Comment 2:

Panicking may break other programs that rely on it just doing nothing.

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision 0e9daef.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants