Skip to content

chore: fix deprecated ioutil usage and lint warnings#633

Open
dlevy-msft-sql wants to merge 3 commits intomicrosoft:mainfrom
dlevy-msft-sql:lint-cleanup
Open

chore: fix deprecated ioutil usage and lint warnings#633
dlevy-msft-sql wants to merge 3 commits intomicrosoft:mainfrom
dlevy-msft-sql:lint-cleanup

Conversation

@dlevy-msft-sql
Copy link
Copy Markdown
Contributor

@dlevy-msft-sql dlevy-msft-sql commented Jan 25, 2026

Replace deprecated io/ioutil.ReadFile with os.ReadFile, remove redundant capacity in make, handle unchecked errors in tests, fix import ordering, and replace deprecated reflect.SliceHeader with unsafe.Slice.

Changes

File Fix
internal/io/file/file.go ioutil.ReadFile -> os.ReadFile (io/ioutil deprecated since Go 1.16)
internal/credman/credman_windows.go make([]*Credential, count, count) -> make([]*Credential, count)
internal/credman/credman_windows.go Replace reflect.SliceHeader with unsafe.Slice (Go 1.17+)
internal/credman/credman_windows.go Explicitly discard credFree.Call return values
internal/credman/types_windows.go CREDENTIAL.CredentialBlob: uintptr -> unsafe.Pointer (eliminates go vet warnings)
internal/credman/credman_windows_test.go Handle unchecked errors, update copyBytesToSlice test for new signature
All credman files Remove unused reflect import, fix import ordering
internal/io/file/file.go Import ordering: stdlib before third-party

Copy link
Copy Markdown

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 resolves several Go linting warnings in the Windows credential manager and file I/O utilities without changing runtime behavior.

Changes:

  • Replaced deprecated ioutil.ReadFile with os.ReadFile and cleaned up import ordering in the file I/O helper.
  • Simplified make usage in EnumerateCredentials by removing redundant capacity specification and adjusted import ordering.
  • Updated tests for the Windows credential manager to explicitly ignore setup/cleanup errors to satisfy linting while preserving original behavior.

Reviewed changes

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

File Description
internal/io/file/file.go Replaces deprecated ioutil.ReadFile with os.ReadFile and reorders imports to follow Go style.
internal/credman/credman_windows_test.go Reorders imports and explicitly discards return values for WriteCredential/DeleteCredential where errors are intentionally ignored.
internal/credman/credman_windows.go Reorders imports and simplifies slice allocation in EnumerateCredentials by removing unnecessary capacity argument.

@dlevy-msft-sql dlevy-msft-sql self-assigned this Jan 25, 2026
@dlevy-msft-sql dlevy-msft-sql added Size: S Small issue (less than one week effort) go Pull requests that update go code labels Jan 25, 2026
@dlevy-msft-sql dlevy-msft-sql added this to the v1.9.2 milestone Jan 28, 2026
@dlevy-msft-sql dlevy-msft-sql changed the title Fix linting warnings fix: linting warnings Feb 5, 2026
@dlevy-msft-sql dlevy-msft-sql changed the title fix: linting warnings chore: fix deprecated ioutil usage and lint warnings Apr 16, 2026
- Replace deprecated io/ioutil with os.ReadFile in internal/io/file
- Simplify make([]*Credential, count, count) to make([]*Credential, count)
- Explicitly ignore errors in test cleanup/setup for credman tests

Remaining warnings are for unsafe pointer handling in credman which
requires careful review before modifying.
Replace reflect.SliceHeader usage with unsafe.Slice (available since
Go 1.17) in credman_windows.go. Change CREDENTIAL.CredentialBlob from
uintptr to unsafe.Pointer to eliminate go vet warnings. Explicitly
discard credFree.Call return values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code Size: S Small issue (less than one week effort)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants