Skip to content

fix: add replace directive to ensure lowercase vendoring path#318

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-vendor-case-sensitivity
Draft

fix: add replace directive to ensure lowercase vendoring path#318
Copilot wants to merge 1 commit intomainfrom
copilot/fix-vendor-case-sensitivity

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Fix vendoring case sensitivity issue

This PR addresses the vendoring issue where go-mssqldb might be vendored with incorrect casing on case-sensitive filesystems (Linux).

Plan:

  • Understand the root cause of the vendoring case sensitivity issue
  • Add replace directive to go.mod to ensure consistent lowercase paths
  • Test vendoring behavior with the changes
  • Verify that go.mod is valid and builds correctly
  • Run unit tests to ensure no regressions
  • Run code review
  • Run security scan (CodeQL)
  • Address review feedback: Update replace directive to use local directory path
  • Remove unrelated formatting changes

Root Cause:

When users vendor projects that depend on go-mssqldb (github.com/microsoft/go-mssqldb), if they also have dependencies on packages from GitHub organizations with capital letters (e.g., github.com/Microsoft/...), Go's vendoring might create directory structures with capital letters, causing issues on case-sensitive filesystems like Linux.

Solution:

Added a replace directive in go.mod that maps github.com/Microsoft/go-mssqldb => ./ to document the canonical lowercase path and ensure any capital-M references point to the current codebase.

Changes Made:

This PR now contains only a single, focused change to go.mod as intended.

Original prompt

This section details on the original issue you should resolve

<issue_title>Not vendorable</issue_title>
<issue_description>Describe the bug
At the moment go-mssqldb is vendored as vendor/Microsoft/go-mssqldb (capital M).
The module is named vendor/microsoft/go-mssqldb (minor M).
This will work on MacOS, but not on Linux (as paths are handled case-sensitive, see golang/go#38342).
The capital M seems to come from github.com/Microsoft/go-winio (dependency) as first come first serve.

To Reproduce
Vendor project that includes vendor/Microsoft/go-mssqldb on MacOS and build on Linux.

Expected behavior
Be consistent in module naming and dependencies.
My proposal would be the consistent usage of github.com/microsoft accross modules.
Quick fix could be a replace in context of go-winio (https://go.dev/ref/mod#go-mod-file-replace).
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix vendored module naming issue for go-mssqldb fix: add replace directive to ensure lowercase vendoring path Feb 2, 2026
Copilot AI requested a review from dlevy-msft-sql February 2, 2026 16:11
@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.95%. Comparing base (1c8ea5b) to head (38992ce).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   75.45%   78.95%   +3.49%     
==========================================
  Files          34       34              
  Lines        6597     6648      +51     
==========================================
+ Hits         4978     5249     +271     
+ Misses       1333     1112     -221     
- Partials      286      287       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dlevy-msft-sql dlevy-msft-sql added Size: S Small issue (less than one week effort, less than 250 lines of code) needs-work labels Feb 2, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix a vendoring issue on case-sensitive filesystems (Linux) where Go's vendoring may create vendor/github.com/Microsoft/go-mssqldb instead of the correct lowercase path, breaking builds. The solution adds a replace directive in go.mod to canonicalize the module path. The PR also includes various code formatting improvements (alignment and whitespace fixes).

Changes:

  • Added replace directive in go.mod to redirect github.com/Microsoft/go-mssqldb to lowercase path
  • Fixed whitespace and alignment in multiple files (conn_str.go, channel_binding.go, auth_test.go, and channel_binding example)

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go.mod Added replace directive to ensure lowercase module path for vendoring compatibility
msdsn/conn_str.go Removed extra space in conditional check
integratedauth/channel_binding_test.go Added trailing newline
integratedauth/channel_binding.go Aligned struct field declarations and const values
integratedauth/auth_test.go Aligned function signatures
examples/channel_binding/tsql.go Aligned variable declarations, reordered imports, fixed trailing whitespace

@dlevy-msft-sql
Copy link

@copilot fix the review comments

@dlevy-msft-sql
Copy link

@copilot fix the review comments

Copy link
Author

Copilot AI commented Feb 2, 2026

@copilot fix the review comments

Fixed in commit c59e2fb. Changed the replace directive from github.com/Microsoft/go-mssqldb => github.com/microsoft/go-mssqldb v1.7.2 to github.com/Microsoft/go-mssqldb => ./ to ensure it always points to the current codebase instead of a pinned version.

auth = flag.String("a", "ntlm", "Authentication method: ntlm, krb5 or winsspi")
epa = flag.Bool("epa", true, "EPA enabled: true, false")
encrypt = flag.String("e", "required", "encrypt mode: required, disabled, strict, optional")
query = flag.String("q", "", "query to execute")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot why are we changing formatting? I'd expect this pr to be a single line change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in commit cc2726c. The formatting changes were unintentionally included from running go fmt. The PR now contains only the single change to go.mod as intended.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

Add replace directive in go.mod to ensure consistent lowercase module path
for vendoring compatibility on case-sensitive filesystems (Linux).

Fixes #234
@dlevy-msft-sql dlevy-msft-sql force-pushed the copilot/fix-vendor-case-sensitivity branch from cc2726c to 38992ce Compare February 6, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: S Small issue (less than one week effort, less than 250 lines of code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not vendorable

3 participants