File tree Expand file tree Collapse file tree 4 files changed +63
-17
lines changed Expand file tree Collapse file tree 4 files changed +63
-17
lines changed Original file line number Diff line number Diff line change 44 build :
55 strategy :
66 matrix :
7- go-version : [1.19 .x, 1.20 .x]
7+ go-version : [1.20 .x, 1.21 .x]
88 platform : [windows-latest]
99 runs-on : ${{ matrix.platform }}
1010 steps :
2424 test :
2525 strategy :
2626 matrix :
27- go-version : [1.19 .x, 1.20 .x]
27+ go-version : [1.20 .x, 1.21 .x]
2828 platform : [ubuntu-latest, macos-latest]
2929 runs-on : ${{ matrix.platform }}
3030 steps :
5656 - name : Install Go
5757 uses : actions/setup-go@v3
5858 with :
59- go-version : 1.20 .x
59+ go-version : 1.21 .x
6060 - name : Add GOBIN to PATH
6161 run : echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
6262 - name : Install dependencies
Original file line number Diff line number Diff line change @@ -213,17 +213,3 @@ func (s Set[T]) Clone() Set[T] {
213213func (s Set [T ]) SymmetricDifference (s2 Set [T ]) Set [T ] {
214214 return s .Difference (s2 ).Union (s2 .Difference (s ))
215215}
216-
217- // Clear empties the set.
218- // It is preferable to replace the set with a newly constructed set,
219- // but not all callers can do that (when there are other references to the map).
220- // In some cases the set *won't* be fully cleared, e.g. a Set[float32] containing NaN
221- // can't be cleared because NaN can't be removed.
222- // For sets containing items of a type that is reflexive for ==,
223- // this is optimized to a single call to runtime.mapclear().
224- func (s Set [T ]) Clear () Set [T ] {
225- for key := range s {
226- delete (s , key )
227- }
228- return s
229- }
Original file line number Diff line number Diff line change 1+ //go:build !go1.21
2+
3+ /*
4+ Copyright 2023 The Kubernetes Authors.
5+
6+ Licensed under the Apache License, Version 2.0 (the "License");
7+ you may not use this file except in compliance with the License.
8+ You may obtain a copy of the License at
9+
10+ http://www.apache.org/licenses/LICENSE-2.0
11+
12+ Unless required by applicable law or agreed to in writing, software
13+ distributed under the License is distributed on an "AS IS" BASIS,
14+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ See the License for the specific language governing permissions and
16+ limitations under the License.
17+ */
18+
19+ package set
20+
21+ // Clear empties the set.
22+ // It is preferable to replace the set with a newly constructed set,
23+ // but not all callers can do that (when there are other references to the map).
24+ // In some cases the set *won't* be fully cleared, e.g. a Set[float32] containing NaN
25+ // can't be cleared because NaN can't be removed.
26+ // For sets containing items of a type that is reflexive for ==,
27+ // this is optimized to a single call to runtime.mapclear().
28+ func (s Set [T ]) Clear () Set [T ] {
29+ for key := range s {
30+ delete (s , key )
31+ }
32+ return s
33+ }
Original file line number Diff line number Diff line change 1+ //go:build go1.21
2+
3+ /*
4+ Copyright 2023 The Kubernetes Authors.
5+
6+ Licensed under the Apache License, Version 2.0 (the "License");
7+ you may not use this file except in compliance with the License.
8+ You may obtain a copy of the License at
9+
10+ http://www.apache.org/licenses/LICENSE-2.0
11+
12+ Unless required by applicable law or agreed to in writing, software
13+ distributed under the License is distributed on an "AS IS" BASIS,
14+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ See the License for the specific language governing permissions and
16+ limitations under the License.
17+ */
18+
19+ package set
20+
21+ // Clear empties the set.
22+ // It is preferable to replace the set with a newly constructed set,
23+ // but not all callers can do that (when there are other references to the map).
24+ func (s Set [T ]) Clear () Set [T ] {
25+ clear (s )
26+ return s
27+ }
You can’t perform that action at this time.
0 commit comments