sourcegraph/lib/codeintel
Jean-Hadrien Chabran a115e0d08f
Migrate to autogold/v2 (needed by Bazel) (#47891)
Due to an issue with Autogold and Bazel, we have to migrate all
`autogold` tests to use the `v2`. This draft PR loses some annotations
describing the test cases, but I'll update that after once I have
validate that we can get those to work with Bazel.

Why is this a huge PR and not a couple of smaller ones: Because this PR
needed a few manual fixes, it was simpler to grind through the changes
after running comby locally. I have attached the config below so you can
review what I used instead.

@chwarwick the code insights tests were heavily relying on the attached
description on `autogold.Want` to provide context, I manually ported
them by adding a new `name string` field on the test cases.

Comby config I used: 

```
[update-imports]

match="\"github.com/hexops/autogold\""
rewrite="\"github.com/hexops/autogold/v2\""

[update-api-want]

match="autogold.Want(:[desc], :[v])"
rewrite="autogold.Expect(:[v])"

[update-api-equal]

match="autogold.Equal(:[v])"
rewrite="autogold.ExpectFile(:[v])"
```

```
$ comby -config ../autogold-comby.toml -matcher .go -exclude-dir vendor,node_modules -in-place
```

I then followed up with some manual fixes for the test cases that were
making the assumption that `want.Name()` exists.

## Test plan

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

Green go tests.

---------

Co-authored-by: davejrt <davetry@gmail.com>
2023-02-21 10:37:13 +01:00
..
autoindex/config bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
lsif bazel: update buildfiles (#47744) 2023-02-16 16:32:59 +01:00
pathexistence bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
precise Migrate to autogold/v2 (needed by Bazel) (#47891) 2023-02-21 10:37:13 +01:00
tools Housekeeping: Rename variables to avoid collisions with packages (#47179) 2023-01-31 16:28:43 +01:00
upload Housekeeping: Rename variables to avoid collisions with packages (#47179) 2023-01-31 16:28:43 +01:00
CODENOTIFY codeintel: Move semantic/repl to tools/lsif-repl (#20971) 2021-05-14 08:55:29 -05:00