Commit Graph

7 Commits

Author SHA1 Message Date
Jean-Hadrien Chabran
3d36d34b3d
ci: re-enable race detection (#52776)
The previous approach to enable race detection was too radical and
accidently led to build our binaries with the race flage enabled, which
caused issues when building images down the line.

This happened because putting a `test --something` in bazelrc also sets
it on `build` which is absolutely not what we wanted. Usually folks get
this one working by having a `--stamp` config setting that fixes this
when releasing binaries, which we don't at this stage, as we're still
learning Bazel.

Luckily, this was caught swiftly. The current approach insteads takes a
more granular approach, which makes the `go_test` rule uses our own
variant, which injects the `race = "on"` attribute, but only on
`go_test`.


## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

CI, being a main-dry-run, this will cover the container building jobs,
which were the ones failing.

---------

Co-authored-by: Alex Ostrikov <alex.ostrikov@sourcegraph.com>
2023-06-05 20:41:47 +02:00
Dave Try
2b8fa079f0
bazel: fix buf files (#49444)
fix protoc-gen-go version
2023-03-15 20:21:38 +00:00
Dave Try
293385d5dd
bazel: update timeouts to suppress warnings (#49399)
Updates all of the BUILD fields with timeouts to suppress warnings and
reduce log spam.


## Test plan

Green CI
2023-03-15 15:04:16 +02:00
David Veszelovszki
f23537a669
Housekeeping: Rename variables to avoid collisions with packages (#47179) 2023-01-31 16:28:43 +01:00
Jean-Hadrien Chabran
bc5490c4bb
bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
Keegan Carruthers-Smith
580f089ccd
iterator: return all items before returning error (#45704)
If the next function returns a non-empty slice and a non-nil error we
still iterate over the returned items before stopping the iteration.
Previously iteration stopped as soon as a non-nil error was returned.

Test Plan: go test
2022-12-15 20:21:48 +02:00
Keegan Carruthers-Smith
b14f7f0fcf
lib: generic iterator based on stripes iterator (#45017)
In a few places we have different patterns around pagination:
- Passing a closure in
- Returning a cursor for the client to use
- Just collect everything into a big slice

Other go libraries often will setup pagination patterns / use
interfaces. The API I quite like is the stripe-go one which is minimal
and reminds me a lot of Scanner from the stdlib. You just do something
like

  for it.Next() {
    doSomething(it.Current())
  }
  if it.Err() != nil {
    handle
  }

I imagine if we had this interface a few useful methods like

  Map[A,B](func(A() B, Iterator[A]) Iterator[B]
  Collect(Iterator[T]) ([]T, error)

etc. Basically could implement the same functions as present in
https://pkg.go.dev/golang.org/x/exp/slices
2022-12-05 11:55:11 +00:00