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

x/exp/slices: slices.Delete will change the source slice #57733

Closed
jojotong opened this issue Jan 11, 2023 · 1 comment
Closed

x/exp/slices: slices.Delete will change the source slice #57733

jojotong opened this issue Jan 11, 2023 · 1 comment

Comments

@jojotong
Copy link

What did you do?

package main

import (
	"fmt"

	"golang.org/x/exp/slices"
)

func main() {
	a := []int{0, 1, 2}
	b := slices.Delete(a, 1, 2)
	fmt.Printf("a: %v\nb: %v", a, b)
}

What did you expect to see?

a: [0 1 2]
b: [0 2]

What did you see instead?

a: [0 2 2]
b: [0 2]
@gopherbot gopherbot added this to the Unreleased milestone Jan 11, 2023
@jojotong jojotong changed the title x/pkgsite: slices.Delete will change the source slice x/exp/slices: slices.Delete will change the source slice Jan 11, 2023
@seankhliao
Copy link
Member

from the documentation, this is working as expected.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
@golang golang locked and limited conversation to collaborators Jan 11, 2024
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

3 participants