[tools] go/analysis/passes/modernize: additional pattern for embedlit

0 views
Skip to first unread message

Madeline Kalil (Gerrit)

unread,
4:03 PM (2 hours ago) 4:03 PM
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Alan Donovan, golang-co...@googlegroups.com

Madeline Kalil submitted the change with unreviewed changes

Unreviewed changes

10 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: go/analysis/passes/modernize/embedlit.go
Insertions: 1, Deletions: 16.

@@ -258,7 +258,7 @@
filename := tokFile.Name()
src, err := pass.ReadFile(filename)
if err != nil {
- return nil
+ return err
}

hasTrailingComma := false
@@ -404,18 +404,3 @@
}
return obj
}
-
-// type T struct {
-// A
-// }
-
-// type A struct {
-// longfieldname123849138499482938592359324 int
-// }
-
-// func _() {
-// v := T{
-// A: A{longfieldname123849138499482938592359324: 1}, //comment, with a comma
-// }
-
-// }
```

Change information

Commit message:
go/analysis/passes/modernize: additional pattern for embedlit

Modifies the embedlit modernizer to recognize an additional pattern:
t := T{...}
t.x = x

becomes

t := T{..., x:x}

Updates golang/go#77965
Change-Id: Ide5fee8d419cc5d6e8fb39c20cf552c3c72bf418
Reviewed-by: Alan Donovan <adon...@google.com>
Files:
  • M go/analysis/passes/modernize/embedlit.go
  • M go/analysis/passes/modernize/testdata/src/embedlit/embedlit_go127.go
  • M go/analysis/passes/modernize/testdata/src/embedlit/embedlit_go127.go.golden
Change size: L
Delta: 3 files changed, 480 insertions(+), 78 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ide5fee8d419cc5d6e8fb39c20cf552c3c72bf418
Gerrit-Change-Number: 773220
Gerrit-PatchSet: 12
Gerrit-Owner: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages