-
Notifications
You must be signed in to change notification settings - Fork 725
Update golangci-lint, fix issues, modernize #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| return false | ||
| } | ||
|
|
||
| func Some[T any](slice []T, f func(T) bool) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func arguably shouldn't exist but that's larger diff.
There was a problem hiding this 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 modernizes the codebase by adopting newer Go standard library features and patterns introduced in recent Go versions (primarily Go 1.23+). The changes leverage built-in optimizations and cleaner APIs.
Key changes:
- Adopts
sync.WaitGroup.Go()method introduced in Go 1.23 to simplify goroutine spawning patterns - Uses
strings.Builderfor efficient string concatenation instead of repeated string concatenation operations - Replaces manual loops with standard library functions like
slices.Contains(),slices.ContainsFunc(),maps.Copy(), andstrings.CutPrefix/CutSuffix() - Migrates to
strings.SplitSeq()for iterator-based string splitting - Simplifies type checking with
reflect.TypeFor[T]() - Replaces
interface{}withanyalias for consistency - Updates golangci-lint version and enables the
modernizelinter
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| .golangci.yml | Enables the modernize linter to enforce modern Go patterns |
| .custom-gcl.yml | Updates golangci-lint version from v2.5.0 to v2.6.0 |
| internal/vfs/vfstest/vfstest_test.go | Adopts WaitGroup.Go() but missing wg.Wait() call |
| internal/tsoptions/tsconfigparsing_test.go | Uses maps.Copy() for map copying |
| internal/tsoptions/tsconfigparsing.go | Replaces runtime type check with compile-time type constant |
| internal/transformers/estransforms/objectrestspread.go | Uses slices.ContainsFunc() for cleaner iteration |
| internal/testutil/tsbaseline/error_baseline.go | Adopts strings.SplitSeq() iterator pattern with impossible condition bug |
| internal/testutil/harnessutil/harnessutil.go | Uses strings.CutPrefix/CutSuffix() for cleaner string trimming |
| internal/scanner/scanner.go | Migrates to strings.Builder for efficient string building |
| internal/project/background/queue.go | Adopts WaitGroup.Go() method |
| internal/project/ata/validatepackagename_test.go | Adds linter exception for intentional string concatenation in test |
| internal/parser/parser.go | Simplifies range loop with modern syntax |
| internal/module/resolver_test.go | Adopts WaitGroup.Go() method |
| internal/ls/signaturehelp.go | Removes custom containsNode() in favor of slices.Contains() |
| internal/ls/lsutil/userpreferences.go | Replaces interface{} with any alias |
| internal/ls/completions.go | Uses strings.CutPrefix() and strings.Builder |
| internal/glob/glob.go | Replaces interface{} with any alias |
| internal/fourslash/test_parser.go | Replaces interface{} with any alias |
| internal/fourslash/fourslash.go | Uses slices.Contains() for cleaner iteration |
| internal/fourslash/baselineutil.go | Replaces interface{} with any alias |
| internal/execute/tsctests/runner.go | Adds linter exception for intentional string concatenation |
| internal/core/workgroup.go | Adopts WaitGroup.Go() method |
| internal/core/core.go | Simplifies conditional logic with max() and adds linter exception |
| internal/compiler/projectreferenceparser.go | Uses maps.Copy() for map copying |
| internal/compiler/fileloader.go | Migrates to strings.Builder for efficient string building |
| internal/checker/nodebuilderimpl.go | Uses slices.Contains() for cleaner iteration |
| internal/checker/mapper.go | Uses slices.Contains() for cleaner iteration |
| internal/checker/grammarchecks.go | Adds linter exception to preserve existing loop pattern |
| internal/binder/binder.go | Adds linter exception to preserve existing loop pattern |
| internal/ast/ast.go | Adds linter exception to preserve existing loop pattern |
Updates the version, fixes or silences existing issues, then also enables the modernize fixes and fixes them except for the small number of cases I would like to ignore.