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

Comments

@Wang-Jun-Chao
Copy link

@Wang-Jun-Chao Wang-Jun-Chao commented Sep 6, 2020

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

@davecheney
Copy link
Contributor

@davecheney davecheney commented Sep 6, 2020

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?

@AlexRouSg
Copy link
Contributor

@AlexRouSg AlexRouSg commented Sep 6, 2020

@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

@gopherbot gopherbot commented Oct 6, 2020

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.)

@gopherbot gopherbot closed this Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.