Skip to content

[MAINT] Use gofmt to rewrite unwanted patterns#3265

Open
deiga wants to merge 10 commits intointegrations:mainfrom
F-Secure-web:gofmt-rewrites
Open

[MAINT] Use gofmt to rewrite unwanted patterns#3265
deiga wants to merge 10 commits intointegrations:mainfrom
F-Secure-web:gofmt-rewrites

Conversation

@deiga
Copy link
Collaborator

@deiga deiga commented Mar 10, 2026


Before the change?

  • Codebase had unwanted patterns and no automatic protection against them

After the change?

  • Configure gofmt to rewrite:
    • skipUnlessMode(t, enterprise) to skipUnlessEnterprise(t)
    • parseTwoPartID with parseID2
    • parseThreePartID with parseID3
    • usage of wrapErrors with single fmt.Errorf with diag.Errorf
    • unnecessary diag.FromErr(fmt.Errof( calls
    • usage of wrapErrors with single err element with diag.FromErr
  • Replace usage of wrapErrors directly with diag.Diagnostics
  • Fix github_branch_protection migration test to be unit tests
  • Replace all unnecessary context.Background() in tests with t.Context()

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

deiga added 10 commits March 10, 2026 23:02
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…orf`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…omErr`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…xt()`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
@deiga deiga requested review from nickfloyd and stevehipwell March 10, 2026 22:26
@github-actions
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant