aboutsummaryrefslogtreecommitdiff
path: root/src/container
AgeCommit message (Collapse)Author
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.