Skip to content

Commit 86ec52a

Browse files
abhinavdangetirsnedalan-strohmstep-security-botdependabot[bot]
authored
Merge golang/geo's master into blevesearch/geo (#26)
Brings in all commits as of May 05, 2025: ``` * 4cab8bf dependabot[bot] | build(deps): bump golangci/golangci-lint-action from 7.0.0 to 8.0.0 and golangci-lint from v2.0 to v2.1 (golang#173) * c498f45 Robert Snedegar | builder_snapper: Update constants and comments (golang#172) * 18783dd Robert Snedegar | Update README.md and add CONTRIBUTING.md (golang#171) * 9edba9f dependabot[bot] | build(deps): bump github/codeql-action from 3.28.16 to 3.28.17 (golang#170) * 686492e Jesse Rosenstock | Test with 1.21 instead of 1.21.0 (golang#169) * 29adb2f Panmari | Run tests on a matrix of go versions (golang#168) * 6580a94 Robert Snedegar | Add missing methods on Edge (golang#166) * 0738b43 Robert Snedegar | Fix Loop contains which contained a missing negation and add test cases. (golang#156) * a9f12e8 dependabot[bot] | build(deps): bump github/codeql-action from 3.28.15 to 3.28.16 (golang#164) * 8f26a2e Alan Strohm | go.yml: use stable go-version (golang#162) * 7fd717b cui fliter | all: fix some comments (golang#161) * 8769abd Robert Snedegar | Update scorecard.yml with full version comment on Upload to code-scan… (golang#160) * 5905ce1 dependabot[bot] | build(deps): bump github/codeql-action from 3.28.13 to 3.28.15 (golang#159) * a33ded6 dependabot[bot] | build(deps): bump actions/upload-artifact from 4.6.1 to 4.6.2 (golang#158) * 5859d1c StepSecurity Bot | [StepSecurity] Apply security best practices (golang#155) * b9a2fb8 Robert Snedegar | Fix identified linter errors preventing errorlint, exhaustive, inamedparam, and staticcheck from running and enable those checks. (golang#153) ``` --------- Signed-off-by: StepSecurity Bot <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: cuishuang <[email protected]> Co-authored-by: Robert Snedegar <[email protected]> Co-authored-by: Alan Strohm <[email protected]> Co-authored-by: StepSecurity Bot <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: cui fliter <[email protected]> Co-authored-by: Panmari <[email protected]> Co-authored-by: Jesse Rosenstock <[email protected]>
1 parent 9579608 commit 86ec52a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+501
-287
lines changed

.github/workflows/go.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will checkout, build, and run the tests for the Go S2 project.
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Go Build and Test
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
17+
build:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
# Test on supported go compiler releases as well as the oldest version we support from go.mod.
22+
go: [ '1.21', 'oldstable', 'stable' ]
23+
name: Go version ${{ matrix.go }}
24+
steps:
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
29+
with:
30+
go-version: ${{ matrix.go }}
31+
32+
- name: Build
33+
run: go build -v ./...
34+
35+
- name: Test
36+
run: go test -v ./...

.github/workflows/scorecard.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '17 9 * * 6'
14+
push:
15+
branches: [ "master" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
25+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
26+
permissions:
27+
# Needed to upload the results to code-scanning dashboard.
28+
security-events: write
29+
# Needed to publish results and get a badge (see publish_results below).
30+
id-token: write
31+
# Uncomment the permissions below if installing in a private repository.
32+
# contents: read
33+
# actions: read
34+
35+
steps:
36+
- name: "Checkout code"
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
with:
39+
persist-credentials: false
40+
41+
- name: "Run analysis"
42+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
43+
with:
44+
results_file: results.sarif
45+
results_format: sarif
46+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
47+
# - you want to enable the Branch-Protection check on a *public* repository, or
48+
# - you are installing Scorecard on a *private* repository
49+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
50+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
51+
52+
# Public repositories:
53+
# - Publish results to OpenSSF REST API for easy access by consumers
54+
# - Allows the repository to include the Scorecard badge.
55+
# - See https://github.com/ossf/scorecard-action#publishing-results.
56+
# For private repositories:
57+
# - `publish_results` will always be set to `false`, regardless
58+
# of the value entered here.
59+
publish_results: true
60+
61+
# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
62+
# file_mode: git
63+
64+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
65+
# format to the repository Actions tab.
66+
- name: "Upload artifact"
67+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
68+
with:
69+
name: SARIF file
70+
path: results.sarif
71+
retention-days: 5
72+
73+
# Upload the results to GitHub's code scanning dashboard (optional).
74+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
75+
- name: "Upload to code-scanning"
76+
uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
77+
with:
78+
sarif_file: results.sarif

.golangci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ linters:
44
# Commented entries here are not enabled by default, but that we should
55
# add once the relevant lines are fixed up.
66

7-
# - errorlint # found 2 cases to be fixed.
8-
# - exhaustive # found some cases that should be fixed.
7+
- errorlint
8+
- exhaustive
99
# - exhaustruct # found some structs which missed fields in initializing.
10-
# - inamedparam # fix missing named param
10+
- inamedparam
1111
# - makezero # fix the unallocated elements.
1212
# - misspell # fix spelling
1313
# - nlreturn # fix these missing blank line
@@ -68,8 +68,6 @@ linters:
6868
# Triggers on most tests for failing to call paralleltest.
6969
# We don't have a need to use this so keep it disabled.
7070
- paralleltest
71-
# Enable once outstanding lint bugs are fixed.
72-
- staticcheck
7371
# This triggers on every _test file saying they should be separate
7472
# parallel packages e.g. s2->s2_test package. We do not plan to ever
7573
# reshuffle the tests into a separate package.

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# How to contribute #
2+
3+
We'd love to accept your patches and contributions to this project. There are
4+
a just a few small guidelines you need to follow.
5+
6+
7+
## Contributor License Agreement ##
8+
9+
Contributions to any Google project must be accompanied by a Contributor
10+
License Agreement. This is not a copyright **assignment**, it simply gives
11+
Google permission to use and redistribute your contributions as part of the
12+
project.
13+
14+
* If you are an individual writing original source code and you're sure you
15+
own the intellectual property, then you'll need to sign an [individual
16+
CLA][].
17+
18+
* If you work for a company that wants to allow you to contribute your work,
19+
then you'll need to sign a [corporate CLA][].
20+
21+
You generally only need to submit a CLA once, so if you've already submitted
22+
one (even if it was for a different project), you probably don't need to do it
23+
again.
24+
25+
[individual CLA]: https://developers.google.com/open-source/cla/individual
26+
[corporate CLA]: https://developers.google.com/open-source/cla/corporate
27+
28+
29+
## Submitting a patch ##
30+
31+
1. It's generally best to start by opening a new issue describing the bug or
32+
feature you're intending to fix. Even if you think it's relatively minor,
33+
it's helpful to know what people are working on. Mention in the initial
34+
issue that you are planning to work on that bug or feature so that it can
35+
be assigned to you.
36+
37+
1. Follow the normal process of [forking][] the project, and setup a new
38+
branch to work in. It's important that each group of changes be done in
39+
separate branches in order to ensure that a pull request only includes the
40+
commits related to that bug or feature.
41+
42+
1. Do your best to have [well-formed commit messages][] with a [good
43+
description][] for each change. This provides consistency throughout
44+
the project, and ensures that commit messages are able to be formatted
45+
properly by various git tools.
46+
47+
1. Keep PRs [small and focused][] on a single issue. Do not make unrelated
48+
changes in the same PR "because you're there"; this includes reformatting
49+
of code, whether automatically or manually.
50+
51+
1. Finally, push the commits to your fork and submit a [pull request][].
52+
53+
[forking]: https://help.github.com/articles/fork-a-repo
54+
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
55+
[good description]: https://google.github.io/eng-practices/review/developer/cl-descriptions.html
56+
[pull request]: https://help.github.com/articles/creating-a-pull-request
57+
[small and focused]: https://google.github.io/eng-practices/review/developer/small-cls.html
58+
59+
60+
## Style ##
61+
62+
Contributions should follow the [Go Style Guide](https://google.github.io/styleguide/go). Code should be [formatted] with `gofmt`.

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ S2ConvexHull | ✅
200200
S2CrossingEdge | ✅
201201
S2HausdorffDistance | ❌
202202
S2ShapeNesting | ❌
203+
S2ValidationQuery | ❌
203204

204205
### Supporting Types
205206

@@ -208,32 +209,37 @@ C++ Type | Go
208209
S2BooleanOperation | ❌
209210
S2BufferOperation | ❌
210211
S2Builder | ❌
211-
S2BuilderClosedSetNormalizer | ❌
212-
S2BuilderFindPolygonDegeneracies | ❌
213212
S2BuilderGraph | ❌
214-
S2BuilderLayers | ❌
215-
S2BuilderSnapFunctions | ❌
216-
S2BuilderTesting | ❌
217-
S2Builderutil\* | ❌
213+
S2BuilderLayer | ❌
214+
S2BuilderUtil_\* | ❌
215+
S2CellIterator | ❌
216+
S2CellIteratorJoin | ❌
217+
S2CellRangeIterator | ❌
218218
S2Coder | ❌
219+
S2Earth | ❌
219220
S2EdgeClipping | ✅
220221
S2EdgeCrosser | ✅
221222
S2EdgeCrossings | ✅
222223
S2EdgeDistances | ✅
223224
S2EdgeTessellator | ✅
225+
S2Fractal | ❌
224226
S2LoopMeasures | ❌
225227
S2Measures | ✅
226228
S2MemoryTracker | ❌
227229
S2Metrics | ❌
228230
S2PointUtil | 🟡
231+
S2PointCompression | 🟡
229232
S2PolygonBuilder | ❌
230233
S2PolylineAlignment | ❌
231234
S2PolylineMeasures | ✅
232235
S2PolylineSimplifier | ❌
233236
S2Predicates | ✅
234237
S2Projections | ❌
235-
S2rectBounder | ❌
238+
S2Random | ❌
239+
S2RectBounder | ❌
240+
S2RegionSharder | ❌
236241
S2RegionTermIndexer | ❌
242+
S2ShapeIndexBufferedRegion | ❌
237243
S2ShapeIndexMeasures | ❌
238244
S2ShapeIndexUtil\* | 🟡
239245
S2ShapeMeasures | ❌
@@ -244,7 +250,13 @@ S2TextFormat | ✅
244250
S2WedgeRelations | ✅
245251
S2WindingOperation | ❌
246252

253+
247254
### Encode/Decode
248255

249256
Encoding and decoding of S2 types is fully implemented and interoperable with
250257
C++ and Java.
258+
259+
260+
## Disclaimer
261+
262+
This is not an official Google product.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module github.com/blevesearch/geo
22

3+
// This declares what language features we use and may be updated freely up to "oldstable".
4+
// Update .github/workflows/go.yml when bumping this version.
35
go 1.21.0
46

57
require (

r3/vector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (v Vector) Ortho() Vector {
108108
ov.Z = 1
109109
case YAxis:
110110
ov.X = 1
111-
default:
111+
case ZAxis:
112112
ov.Y = 1
113113
}
114114
return v.Cross(ov).Normalize()

0 commit comments

Comments
 (0)