Commit b84c70a
authored
[TT-15967] add alias packages (#7520)
### **User description**
<!-- Provide a general summary of your changes in the Title above -->
- Use alias package to export symbols to be used from this repository.
- After this is done, repositories importing tyk gateway packages
(except allowed ones) would be guarded with linter checks. This could be
helpful while automating dashboard <-> gateway coupled API tests, and
run them only when the allowed packages are changed.
- Upgraded mockgen from v0.4.0 to v0.6.0 to resolve an issue where the
`-imports` flag was not being respected in generated mocks - this
ensures that devX stays the same.
https://tyktech.atlassian.net/browse/TT-15967
<!-- Why is this change required? What problem does it solve? -->
<!-- Please describe in detail how you tested your changes --> <!--
Include details of your testing environment, and the tests --> <!-- you
ran to see how your change affects other areas of the code, etc. -->
<!-- This information is helpful for reviewers and QA. -->
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)
<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->
- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why
<!---TykTechnologies/jira-linter starts here-->
<details>
<summary>
<a href="https://tyktech.atlassian.net/browse/TT-15967" title="TT-15967"
target="_blank">TT-15967</a>
</summary>
| | |
|---------|----|
| Status | In Code Review |
| Summary | Remove direct package imports from Tyk Gateway, keep only
selected packages |
Generated at: 2025-11-04 07:49:31
</details>
<!---TykTechnologies/jira-linter ends here-->
<!-- Provide a general summary of your changes in the Title above -->
## Description
<!-- Describe your changes in detail -->
## Related Issue
<!-- This project only accepts pull requests related to open issues. -->
<!-- If suggesting a new feature or change, please discuss it in an
issue first. -->
<!-- If fixing a bug, there should be an issue describing it with steps
to reproduce. -->
<!-- OSS: Please link to the issue here. Tyk: please create/link the
JIRA ticket. -->
## Motivation and Context
<!-- Why is this change required? What problem does it solve? -->
## How This Has Been Tested
<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests -->
<!-- you ran to see how your change affects other areas of the code,
etc. -->
<!-- This information is helpful for reviewers and QA. -->
## Screenshots (if appropriate)
## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)
## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->
- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why
___
### **PR Type**
Enhancement, Tests, Configuration
___
### **Description**
- Introduce alias export packages
- Regenerate gomock with typed params
- Rename CI lint job and dependencies
- Improve SonarCloud PR analysis args
___
### Diagram Walkthrough
```mermaid
flowchart LR
alias["Alias packages under pkg/alias"] -- "expose selected symbols" --> consumers["Downstream consumers"]
mocks["Regenerated gomock mocks"] -- "typed params + isgomock marker" --> tests["More robust tests"]
ci["CI workflow updates"] -- "lint job rename, deps" --> jobs["Test and Sonar depend on lint"]
sonar["SonarCloud step"] -- "dynamic PR args" --> analysis["Accurate PR analysis"]
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>5
files</summary><table>
<tr>
<td><strong>mock.go</strong><dd><code>Regenerate certificate manager
gomock with typed args</code> </dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-75a25b7d4ff1829eb0c62d758828c98183e4d85e97db052db893e99054232370">+33/-32</a>
</td>
</tr>
<tr>
<td><strong>batcher_mock.go</strong><dd><code>Add isgomock and name
parameters in mocks</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-f060a65a8e827b3787a3d9a46b172e839bd3db0fbb328b111ec8245981736675">+14/-12</a>
</td>
</tr>
<tr>
<td><strong>cache_mock.go</strong><dd><code>Use descriptive param names
in cooldown cache mocks</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-a2c546883935af1b52620785f3531b1f1ad449de9e2f517f39e53da26b67e56e">+25/-24</a>
</td>
</tr>
<tr>
<td><strong>engine_mock_test.go</strong><dd><code>Refine GraphQL engine
mocks with named params</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-a867d75607ee7d81cb71edd40179ce8a58f6d4b60066384b28291b7fb789efed">+37/-32</a>
</td>
</tr>
<tr>
<td><strong>storage.go</strong><dd><code>Update rolling window mocks
with named params</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-0e75f439d0385d9272ea3afa9fc465dcae08554f19ff821e0743ad096325df40">+9/-8</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>2
files</summary><table>
<tr>
<td><strong>crypto.go</strong><dd><code>New crypto alias exposing
HashStr</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-b01f093e8c71d25116ca9527e7f4207f50e0ef48317ec89923cdc6ed84184193">+7/-0</a>
</td>
</tr>
<tr>
<td><strong>gateway.go</strong><dd><code>New gateway alias re-exporting
events and test utils</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-6c487d395487597b2aca27e8848025e410dd24b71734cd904b2e535b14a68a45">+29/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Configuration
changes</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>ci-tests.yml</strong><dd><code>Rename lint job and add
dynamic SonarCloud PR args</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-03609cb60b0c6e92fb771eb8787d6722b8c31ca4c03eabc788e147acd8c6fb43">+31/-13</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Dependencies</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>deps.yml</strong><dd><code>Upgrade mockgen to
v0.6.0</code>
</dd></td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/7520/files#diff-dd52559dac2636b84a787d78b08a48fb92258a5f586f097fd727941bd927d4b7">+1/-1</a>
</td>
</tr>
</table></details></td></tr></tr></tbody></table>
</details>
___1 parent fe0d4fd commit b84c70a
9 files changed
Lines changed: 186 additions & 122 deletions
File tree
- .github/workflows
- .taskfiles
- certs/mock
- internal
- certcheck
- graphengine
- pkg/alias
- crypto
- gateway
- storage/mock
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
204 | 231 | | |
205 | 232 | | |
206 | 233 | | |
207 | 234 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 235 | + | |
218 | 236 | | |
219 | 237 | | |
220 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments