chore: fix deprecated ioutil usage and lint warnings#633
Open
dlevy-msft-sql wants to merge 3 commits intomicrosoft:mainfrom
Open
chore: fix deprecated ioutil usage and lint warnings#633dlevy-msft-sql wants to merge 3 commits intomicrosoft:mainfrom
dlevy-msft-sql wants to merge 3 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
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.ReadFilewithos.ReadFileand cleaned up import ordering in the file I/O helper. - Simplified
makeusage inEnumerateCredentialsby 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. |
c39227c to
7eafd66
Compare
- 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.
764614e to
d953ece
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace deprecated
io/ioutil.ReadFilewithos.ReadFile, remove redundant capacity inmake, handle unchecked errors in tests, fix import ordering, and replace deprecatedreflect.SliceHeaderwithunsafe.Slice.Changes
internal/io/file/file.goioutil.ReadFile->os.ReadFile(io/ioutildeprecated since Go 1.16)internal/credman/credman_windows.gomake([]*Credential, count, count)->make([]*Credential, count)internal/credman/credman_windows.goreflect.SliceHeaderwithunsafe.Slice(Go 1.17+)internal/credman/credman_windows.gocredFree.Callreturn valuesinternal/credman/types_windows.goCREDENTIAL.CredentialBlob:uintptr->unsafe.Pointer(eliminates go vet warnings)internal/credman/credman_windows_test.gocopyBytesToSlicetest for new signaturereflectimport, fix import orderinginternal/io/file/file.go