aboutsummaryrefslogtreecommitdiff
path: root/src/container
AgeCommit message (Collapse)Author
2024-01-31container/heap: remove confusing claim of memory leakcodesoap
The term "memory leak" was misused here, as the memory is still referenced by the slice. Fixes #65403 Change-Id: Id102419d4c798fb2a4ec8be86be9ec9b5cdd98e6 GitHub-Last-Rev: 3febcd0ba4ab5897bef8f2d7ded594ef09932771 GitHub-Pull-Request: golang/go#65404 Reviewed-on: https://go-review.googlesource.com/c/go/+/559775 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-12container/heap: add available godoc linkcui fliter
Change-Id: I886a8869ba885286ac8219bc7e245c9237ad4c99 Reviewed-on: https://go-review.googlesource.com/c/go/+/534777 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-01all: remove trailing blank doc comment linesRuss Cox
A future change to gofmt will rewrite // Doc comment. // func f() to // Doc comment. func f() Apply that change preemptively to all doc comments. For #51082. Change-Id: I4023e16cfb0729b64a8590f071cd92f17343081d Reviewed-on: https://go-review.googlesource.com/c/go/+/384259 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-10-26container/list: remove unnecessary codeGusted
Remove a unnecessary statement in the test function, the variables aren't checked afterwards. Also remove return statements in helper functions and remove the declaration that a the helper function return a value. The return value isn't used in the current state of code Change-Id: I5bc384104c1002c4138e0894938778ae9710ce4d Reviewed-on: https://go-review.googlesource.com/c/go/+/358714 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Ian Lance Taylor <iant@golang.org>
2020-05-31container/list: fix typo in function commentsYasser Abdolmaleki
The correct word to use here is 'another' not 'an other' Change-Id: Ie4f748ae94a5945dceb52779222ffd8cf36b8845 Reviewed-on: https://go-review.googlesource.com/c/go/+/235838 Reviewed-by: Robert Griesemer <gri@golang.org>
2020-02-21container/list: remove temporary variable `n`Joe Kyo
The variable `n` for saving the pointer of the next element when insert new element into the list turns out to be unnecessary. Change-Id: I17b85fd8350738815c320a83945525b60c2f04c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/207037 Reviewed-by: Robert Griesemer <gri@golang.org>
2019-05-22all: shorten some testsRuss Cox
Shorten some of the longest tests that run during all.bash. Removes 7r 50u 21s from all.bash. After this change, all.bash is under 5 minutes again on my laptop. For #26473. Change-Id: Ie0460aa935808d65460408feaed210fbaa1d5d79 Reviewed-on: https://go-review.googlesource.com/c/go/+/177559 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-26container/heap: avoid memory leak in exampleWhisperRain
Set element in slice to nil avoiding memory leak. Change-Id: I9dbef9a0466407011e326725d3a0b681cd815389 GitHub-Last-Rev: 1bae5d375876a7f146eb04c2a5ba88d079264eb3 GitHub-Pull-Request: golang/go#30386 Reviewed-on: https://go-review.googlesource.com/c/163601 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-11-13container/heap: adjust wording in commentsRuss Cox
Followup to CL 129779 but also some other minor tweaks. Change-Id: Id71455d8a14f5e33f82c942c9e892da56c49d17c Reviewed-on: https://go-review.googlesource.com/c/149257 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-26container/list: combining insert and remove operations while moving elements ↵Raghavendra Nagaraj
within a list. Fixes #27747 Change-Id: I843e9e121d33440648b364650ee8a8a1639a0144 GitHub-Last-Rev: c614e91e23d4d3dea80bc78886a1b7e96456596b GitHub-Pull-Request: golang/go#28413 Reviewed-on: https://go-review.googlesource.com/c/144998 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20container/heap: clarify that Remove returns the removed elementQais Patankar
Change-Id: I63b59c1ca8265e9af7eb3f9210ee1d17925de891 Reviewed-on: https://go-review.googlesource.com/129779 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-11container/heap: fix comments stylebontequero
Fixes golint warning about comment on exported function. Change-Id: Ia6a910e2dca2cd31d8de64419e36add6191e804d Reviewed-on: https://go-review.googlesource.com/105495 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-08container/list: document nil values moreBrad Fitzpatrick
Fixes #23372 Change-Id: Ie99fb4d84cb49efa66c0ff480d2656c33ef11e6d Reviewed-on: https://go-review.googlesource.com/86676 Reviewed-by: Robert Griesemer <gri@golang.org>
2017-10-31container/ring: fix example_test.goJason Wangsadinata
The Len method is a linear operation. CL 73090 used Len to iterate over a ring, resulting in a quadratic time operation. Change-Id: Ib69c19190ba648311e6c345d8cb26292b50121ee Reviewed-on: https://go-review.googlesource.com/74390 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25container/ring: add examples for various Ring functionsJason Wangsadinata
Change-Id: I6b16cfcbe824f999c9b64df539deea567e327db7 Reviewed-on: https://go-review.googlesource.com/73090 Reviewed-by: Gabriel Aszalos <gabriel.aszalos@gmail.com> Reviewed-by: Jason Wangsadinata <jwangsadinata@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
2017-09-13container/heap: call t.Helper() in verify()Tyler Bui-Palsulich
I modified verify() to fail every time to test the change. Before adding t.Helper() (line 37 is in verify()): /.../go/src/container/heap/heap_test.go:37: forced failure FAIL Afer adding t.Helper() (line 67 is where verify() is called): /.../go/src/container/heap/heap_test.go:67: forced failure FAIL Fixes #21863 Change-Id: I46f0c8ec413cc664358c568fc53e48bb4a1d03d0 Reviewed-on: https://go-review.googlesource.com/63570 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-05-13container/heap: avoid up() invoke if down() success at heap.Remove()wuyunzhou
Change-Id: I6c210e0c23ca533e1f303f88ef9dcb629a294a2a Reviewed-on: https://go-review.googlesource.com/43472 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org>
2017-05-09container/heap: optimization when selecting smaller childltnwgl
In down(), if two children are equal, we can choose either one. Inspired by https://codereview.appspot.com/6613064/ Change-Id: Iaad4ca5e2f5111bf3abb87f606584e7d274c620b Reviewed-on: https://go-review.googlesource.com/38612 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2016-08-16container/list: silence vet warningsJosh Bleecher Snyder
container/list/list_test.go:274: self-assignment of e1 to e1 container/list/list_test.go:274: self-assignment of e4 to e4 container/list/list_test.go:282: self-assignment of e1 to e1 container/list/list_test.go:286: self-assignment of e1 to e1 container/list/list_test.go:286: self-assignment of e4 to e4 Updates #11041 Change-Id: Ibd90cf6a924e93497908f437b814c3fc82937f4a Reviewed-on: https://go-review.googlesource.com/27114 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16container/heap: remove one unnecessary comparison in FixSina Siadat
The heap.Fix function calls both down and up. If the element is moved down, we don't need to call up and we could save a comparison. (per suggestion by Radu Berinde) Fixes #16098. Change-Id: I83a74710e66cf0d274d8c0743338c26f89f31afe Reviewed-on: https://go-review.googlesource.com/24273 Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-24all: fixed a handful of typosRobert Griesemer
Change-Id: Ib0683f27b44e2f107cca7a8dcc01d230cbcd5700 Reviewed-on: https://go-review.googlesource.com/23404 Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-20container/heap: correct number of elements in BenchmarkDupJamil Djadala
In BenchmarkDup fuction, heap is created as h := make(myHeap, n) and then n elements are added, so first time there are 2*n elements in heap. Fixes #15380 Change-Id: I0508486a847006b3cd545fd695e8b09af339134f Reviewed-on: https://go-review.googlesource.com/22310 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-02all: single space after period.Brad Fitzpatrick
The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.