Skip to content

Improve platform-specific crypto filenames#2159

Merged
gdams merged 1 commit intomicrosoft/mainfrom
dev/dagood/file-naming
Feb 25, 2026
Merged

Improve platform-specific crypto filenames#2159
gdams merged 1 commit intomicrosoft/mainfrom
dev/dagood/file-naming

Conversation

@dagood
Copy link
Member

@dagood dagood commented Feb 25, 2026

Follows up on #2157 (comment)

AI review is totally right IMO, darwin_darwin is redundant ("stuttering") for no good reason:

 create mode 100644 src/crypto/internal/backend/fips140/cng_windows.go
 create mode 100644 src/crypto/internal/backend/fips140/darwin_darwin.go
 create mode 100644 src/crypto/internal/backend/fips140/openssl_linux.go

Not only that, darwin_darwin.go also doesn't include the name of the backend like the cng and openssl files do in their names. And one step further: these files are serving the same purpose, so they should share a prefix to be easier to find and more readable.

Updated patches to change names to:

 create mode 100644 src/crypto/internal/backend/fips140/systemfips_darwin.go
 create mode 100644 src/crypto/internal/backend/fips140/systemfips_linux.go
 create mode 100644 src/crypto/internal/backend/fips140/systemfips_windows.go

 create mode 100644 src/crypto/internal/backend/backend_darwin.go
 create mode 100644 src/crypto/internal/backend/backend_linux.go
 create mode 100644 src/crypto/internal/backend/backend_windows.go

 create mode 100644 src/crypto/rsa/rsa_darwin.go

(Can use git go-patch review to confirm that these are just renames.)

@dagood dagood requested a review from a team as a code owner February 25, 2026 18:08
@github-actions
Copy link

Patch Consistency Review: ✅ APPROVED

This PR successfully improves the platform-specific filename conventions across the patches. The changes are consistent and follow the repository guidelines.

Summary of Changes

The PR renames platform-specific files to use clearer, more consistent naming conventions:

In 0003-Implement-crypto-internal-backend.patch:

  • darwin_darwin.gobackend_darwin.go
  • openssl_linux.gobackend_linux.go
  • cng_windows.gobackend_windows.go
  • fips140/darwin_darwin.gofips140/systemfips_darwin.go
  • fips140/openssl_linux.gofips140/systemfips_linux.go
  • fips140/cng_windows.gofips140/systemfips_windows.go

In 0004-Use-crypto-backends.patch:

  • rsa/darwin_darwin.gorsa/rsa_darwin.go

Consistency Checks ✅

  1. Filename suffix convention: All files correctly use _darwin.go, _linux.go, _windows.go suffixes to indicate platform constraints, eliminating the redundant "darwin_darwin" pattern.

  2. Build tag adherence: The build tags properly follow guideline Build a Docker prereqs image for linux-amd64 longtest #5 - they specify only //go:build goexperiment.systemcrypto without duplicating the OS/arch that's already expressed in the filename suffix.

  3. Unified naming: Files serving the same purpose across platforms now share consistent prefixes (backend_*, systemfips_*, rsa_*) making them easier to find and more readable.

  4. No extraneous blank lines: The code maintains appropriate spacing between functions and import groups per guideline Skip tests during official builds #6.

  5. Patch organization: All related platform-specific changes are grouped in the correct patches (backend implementation in 0003, crypto usage in 0004).

The renaming makes the codebase more maintainable and follows Go conventions. Great improvement! 🎉

AI generated by Patch Consistency Review Agent

@gdams gdams enabled auto-merge (squash) February 25, 2026 19:30
@gdams gdams merged commit b057ef3 into microsoft/main Feb 25, 2026
49 checks passed
@gdams gdams deleted the dev/dagood/file-naming branch February 25, 2026 20:01
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.

2 participants