You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .apm/instructions/backend.instructions.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,5 +5,8 @@ applyTo: "**/*.go"
5
5
6
6
* When adding or updating APIs, **use HATEOAS** in responses to support discoverability and consistent client interaction.
7
7
* Follow idiomatic Go practices.
8
+
* Use `k8s.io/apimachinery/pkg/util/sets` (e.g. `sets.NewString()`) to deduplicate or collect unique strings. Do not use `map[string]bool` as a hand-rolled set.
9
+
* Prefer structured logging where it makes sense; particularly for names and IDs, and often for
10
+
counts, a log.WithField() call is preferred over formatting values into a string.
8
11
* After making changes, always run `gofmt -w` on modified files to ensure proper formatting.
9
12
* When modifying any data provider (BigQuery or PostgreSQL), ensure **parity between both implementations**. Changes to query logic, filtering, or returned data in one provider must be reflected in the other.
Copy file name to clipboardExpand all lines: .apm/instructions/testing.instructions.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,11 @@ applyTo: "**/*_test.go"
4
4
---
5
5
6
6
* Use `go vet` and `go test ./pkg/...` to validate changes before resorting to a full e2e run.
7
-
* Run `make e2e 2>&1 | tee e2e-test.log` to verify your changes don't break end-to-end tests. You **MUST** read the log file (`e2e-test.log`) for results. Do not re-run e2e just to grep for different things — all output is already in the log file.
7
+
* Run `make e2e 2>&1 | tee e2e-test.log` to verify your changes don't break end-to-end tests. You **MUST** read the log file (`e2e-test.log`) for results. Do not re-run e2e just to grep for different things. All output is already in the log file.
8
+
* Do not mock storage clients (BigQuery, GCS, Postgres, etc.) when constructing golang unit tests.
9
+
Go does not make it easy to substitute mocks for concrete SDK clients, and mock-heavy tests tend
10
+
to verify the mock implementation rather than real behavior. Instead, structure code to separate
11
+
pure logic from client calls. Unit test the logic functions directly (validation, data
12
+
transformation, result aggregation and analysis). Enable testing against real storage systems with
13
+
functional tests that skip unless the user supplies connection credentials via environment
14
+
variables (see `releasesync_functional_test.go` for the pattern).
0 commit comments