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

go fmt provider json format #41241

Closed
Wang-Jun-Chao opened this issue Sep 6, 2020 · 3 comments
Closed

go fmt provider json format #41241

Wang-Jun-Chao opened this issue Sep 6, 2020 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@Wang-Jun-Chao
Copy link

In many case, we want to print data infomation in json format. For simplicity, can fmt provide json format verb?

@davecheney
Copy link
Contributor

Go fmt formats go code as source code. What is the value of emitting the go ast as json? What problem would that allow you to solve?

@martisch martisch added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 6, 2020
@AlexRouSg
Copy link
Contributor

@davecheney I think he ment the fmt package and wnats something like fmt.Printf("%json", v)
That does something like:

b, err := json.Marshal(v)
if err != nil {
	fmt.Println("error:", err)
}
fmt.Printf("%s", string(b))

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants