Go语言之工具Go Playground
簡介
Go Playground 允許在瀏覽器里編輯并運行 Go 語言代碼。
用途
分享 Go 代碼:Go 開發(fā)者使用 Playground 分享他們的想法,測試理論,或者調(diào)試代碼。你也可以這么做。每次使用 Playground 創(chuàng)建一個新程序之后,可以點擊 Share 分享。
要給想要學(xué)習(xí)寫東西或者尋求幫助的同事或者朋友演示某個想法時,Go Playground 是非常
好的方式。在 Go 語言的 IRC 頻道、Slack 群組、郵件列表和 Go 開發(fā)者發(fā)送的無數(shù)郵件里,用戶都能看到創(chuàng)建、修改和分享 Go Playground 上的程序。
官網(wǎng)
http://play.golang.org
界面如下
?
下面是Go Playground官網(wǎng)下的英文介紹,后面用google機翻了一下
About the Playground
The Go Playground is a web service that runs on?go.dev's servers. The service receives a Go program,?vets, compiles, links, and runs the program inside a sandbox, then returns the output.
If the program contains?tests or examples?and no main function, the service runs the tests. Benchmarks will likely not be supported since the program runs in a sandboxed environment with limited resources.
There are limitations to the programs that can be run in the playground:
- The playground can use most of the standard library, with some exceptions. The only communication a playground program has to the outside world is by writing to standard output and standard error.
- In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
- There are also limits on execution time and on CPU and memory usage.
The article "Inside the Go Playground" describes how the playground is implemented. The source code is available at?https://go.googlesource.com/playground.
The playground uses the?latest stable release of Go.
The playground service is used by more than just the official Go project (Go by Example?is one other instance) and we are happy for you to use it on your own site. All we ask is that you?contact us first (note this is a public mailing list), that you use a unique user agent in your requests (so we can identify you), and that your service is of benefit to the Go community.
Any requests for content removal should be directed to?security@golang.org. Please include the URL and the reason for the request.
Google翻譯:
關(guān)于游樂場
Go Playground 是一個運行在 go.dev 的服務(wù)器上的 Web 服務(wù)。該服務(wù)接收一個 Go 程序,審查、編譯、鏈接并在沙箱中運行該程序,然后返回輸出。
如果程序包含測試或示例并且沒有主要功能,則服務(wù)會運行測試。由于該程序在資源有限的沙盒環(huán)境中運行,因此可能不支持基準(zhǔn)測試。
可以在 Playground 中運行的程序有一些限制:
Playground 可以使用大部分標(biāo)準(zhǔn)庫,但有一些例外。 Playground 程序與外界的唯一通信是寫入標(biāo)準(zhǔn)輸出和標(biāo)準(zhǔn)錯誤。
在操場上,時間從 2009 年 11 月 10 日 23:00:00 UTC 開始(確定這個日期的重要性是讀者的練習(xí))。通過為程序提供確定性的輸出,這使得緩存程序變得更加容易。
執(zhí)行時間以及 CPU 和內(nèi)存使用也有限制。
《Inside the Go Playground》一文描述了 Playground 是如何實現(xiàn)的。源代碼可在 https://go.googlesource.com/playground 獲得。
Playground 使用 Go 的最新穩(wěn)定版本。
Playground 服務(wù)不僅用于官方 Go 項目(Go by Example 是另一個實例),我們很高興您在自己的網(wǎng)站上使用它。我們所要求的只是您首先與我們聯(lián)系(注意這是一個公共郵件列表),您在請求中使用唯一的用戶代理(以便我們可以識別您),并且您的服務(wù)對 Go 社區(qū)有益。
任何內(nèi)容刪除請求都應(yīng)發(fā)送至 security@golang.org。請包括請求的 URL 和原因。
參考
[1]《Go語言實戰(zhàn)》1.2章
總結(jié)
以上是生活随笔為你收集整理的Go语言之工具Go Playground的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 黑板主题教育教学课件PPT模板
- 下一篇: 创意黑板论文答辩PPT模板