Skip to content
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

cmd/go: don't compute Embed fields if they're not needed #58522

Closed

Conversation

fviernau
Copy link
Contributor

If the user provides the -json flag to explicitly specify fields, but doesn't specify any Embed field, skip computing the embed fields.

This enhances the initial implementation of #29666.

@gopherbot
Copy link
Contributor

This PR (HEAD: 3c6c17f) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/468075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@fviernau fviernau force-pushed the list-cmd-skip-computing-embed-fields branch from 3c6c17f to 9ca3695 Compare February 14, 2023 15:18
@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 9ca3695) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/468075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@fviernau fviernau force-pushed the list-cmd-skip-computing-embed-fields branch from 9ca3695 to dcf229b Compare February 14, 2023 15:25
@gopherbot
Copy link
Contributor

This PR (HEAD: dcf229b) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/468075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@fviernau fviernau force-pushed the list-cmd-skip-computing-embed-fields branch from dcf229b to 3c58e7a Compare February 14, 2023 15:31
@gopherbot
Copy link
Contributor

This PR (HEAD: 3c58e7a) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/468075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Ian Lance Taylor:

Patch Set 4: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 4: TryBot-Result-1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 4: Code-Review+2 Hold+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 4:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

If the user provides the -json flag to explicitly specify fields, but
doesn't specify any *Embed* field, skip computing the embed fields.

This enhances the initial implementation of golang#29666.
@fviernau fviernau force-pushed the list-cmd-skip-computing-embed-fields branch from 3c58e7a to 2795c19 Compare February 20, 2023 09:03
@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 4:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 2795c19) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/468075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 5:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 5: Code-Review+2 Hold+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

fviernau added a commit to fviernau/tools that referenced this pull request Feb 22, 2023
`gopls` attempts to diagnose incorrect embed patterns. The logic to do
so relies on `go list` to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

`go pls` explicitly specifies the needed JSON fields towards
`go list -json` which internall skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there is
plans to change it such that patterns are only evaluated if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to fviernau/tools that referenced this pull request Feb 22, 2023
`gopls` attempts to diagnose incorrect embed patterns. The logic to do
so relies on `go list` to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

`go pls` explicitly specifies the needed JSON fields towards
`go list -json` which internally skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there is
plans to only run pattern evaluation if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to fviernau/tools that referenced this pull request Feb 22, 2023
`gopls` attempts to diagnose incorrect embed patterns. The logic to do
so relies on `go list` to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

`go pls` explicitly specifies the needed JSON fields towards
`go list -json` which internally skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there is
plans to only run pattern evaluation if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522
@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

fviernau added a commit to fviernau/tools that referenced this pull request Feb 22, 2023
`gopls` attempts to diagnose incorrect embed patterns. The logic to
do so relies on `go list` to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

`go pls` explicitly specifies the needed JSON fields towards
`go list -json` which internally skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there
is plans to only run pattern evaluation if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522
@gopherbot
Copy link
Contributor

Message from Frank Viernau:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

fviernau added a commit to fviernau/tools that referenced this pull request Feb 22, 2023
`Gopls` attempts to diagnose incorrect embed patterns. The logic to
do so relies on `go list` to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

`Gopls` explicitly specifies the needed JSON fields towards
`go list -json` which internally skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there
is plans to only run pattern evaluation if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522
gopherbot pushed a commit to golang/tools that referenced this pull request Feb 22, 2023
Gopls attempts to diagnose incorrect embed patterns. The logic to
do so relies on 'go list' to actually resolve those patterns and to
propagate an error in case the pattern is incorrect, see also [1].

Gopls explicitly specifies the needed JSON fields towards
'go list -json' which internally skips evaluation steps for unneeded
fields. Currently, the embed patterns are always evaluated but there
is plans to only run pattern evaluation if needed [2].

So, explicitly ask for EmbedFiles to prepare for [2].

[1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40
[2]: golang/go#58522

Change-Id: I615cd5076659f192d884504ab735ce77b6e0e129
GitHub-Last-Rev: 9c1addb
GitHub-Pull-Request: #428
Reviewed-on: https://go-review.googlesource.com/c/tools/+/470157
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 5: -Hold


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 5: Run-TryBot+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 5: TryBot-Result+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 5: Auto-Submit+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/468075.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Feb 23, 2023
If the user provides the -json flag to explicitly specify fields, but doesn't specify any *Embed* field, skip computing the embed fields.

This enhances the initial implementation of #29666.

Change-Id: I60e86fb25a445689aecbcc7f3f3f88e0f37a0fc5
GitHub-Last-Rev: 2795c19
GitHub-Pull-Request: #58522
Reviewed-on: https://go-review.googlesource.com/c/go/+/468075
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/468075 has been merged.

@gopherbot gopherbot closed this Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants