You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
secondFormat, err := format.Source(firstPass)
if err != nil {
return nil, fmt.Errorf("failed to run second format on:\n%s\ngot err: %v", string(firstPass), err)
}
lsp_test.go:535: error converting command "gopls.fill_struct" to edits: error calling command.SuggestedFix: failed to run second format on:
{
ValuePos: 0,
Kind: 0,
Value: "",
}
got err: 2:13: expected 1 expression (and 2 more errors)
My question: why does format.Source blow up on this code? And, what does expected 1 expression mean - isn't what I passed in an expression [1]? And, what are the other 2 errors?
1: I'm not particularly well versed on the nouns that comprise a programming language - sorry!
The text was updated successfully, but these errors were encountered:
You can think of an expression here as any AST node that implements ast.Expr. I often use http://goast.yuroyoro.net/ to inspect the Go AST and understand it better. In this case, you've written an ast.CompositeLit without the Type field before the curly brace (Lbrace), so the expression does not parse.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
As part of https://go-review.googlesource.com/c/tools/+/262018, on,
What did you expect to see?
What did you see instead?
My question: why does
format.Source
blow up on this code? And, what doesexpected 1 expression
mean - isn't what I passed in an expression [1]? And, what are the other 2 errors?1: I'm not particularly well versed on the nouns that comprise a programming language - sorry!
The text was updated successfully, but these errors were encountered: