Go Playground 在线编程环境

For all examples in this and the next chapter, we will use Go Playground. Go Playground represents a web service that can run programs written in Go. It can be opened in a web browser using the following link: https://go.dev/play/

对于本章和下一章的所有示例,我们将使用Go Playground。Go Playground代表了一个可以运行用Go语言编写的程序的web服务。可通过以下链接在浏览器中打开: https://go.dev/play/

By Default, Go Playground uses the latest stable version, but if necessary, we can lower it to one of the earlier versions.

默认情况下,Go Playground使用最新的稳定版本,但如果有必要,我们可以将其降低到较早的版本之一。

Once we learn all the important concepts of the Go programming language and we are ready to start the development of our web application, we will learn how to install and set up the Go environment on our local machine. Until then, Go Playground is a good enough tool to get familiarized with the Go programming language.

一旦我们学习了Go编程语言的所有重要概念,并准备开始开发我们的web应用程序,我们将学习如何在本地机器上安装和设置Go环境。在此之前,Go Playground是一个足够好的工具,可以让你熟悉Go编程语言。

But we must be aware of a couple of Go Playground's limitations:

  • Go supports (through standard library) functionality for measuring and displaying time. In Go Playground, the current time will always be 2009-11-10 23:00:00 UTC (the day when Go was officially announced).
  • Execution time is limited.
  • CPU and memory usage is limited.
  • The program cannot access the external network host.
  • Libraries (except the standard ones) are not available.

但我们必须意识到Go Playground的一些局限性:

  • Go支持(通过标准库)测量和显示时间的功能。在Go Playground中,当前时间始终是2009-11-10 23:00:00 UTC (Go正式发布的那一天)。
  • 限制执行时间。
  • 限制CPU和内存的使用。
  • 程序无法访问外部网络主机。
  • 库(标准库除外)不可用。

For the small code examples presented in this chapter, these limitations will not cause any problems.

对于本章提供的小代码示例,这些限制不会造成任何问题。

Just for the test, we can copy this code examples in Go Playground.

只是为了测试,我们可以在Go Playground中复制这些代码示例。

go 复制代码
package main

import "fmt"

func main(){
    a := 3
    b := 33
    c := a * b
    fmt.Println("Result is:", c)
}

If we click on the Run button, the following output should be displayed.

如果单击Run按钮,应该显示以下输出。

bash 复制代码
Result is: 99
Program exited.

In later examples, the declaration of the package and main() function may be omitted. If that is the case, code examples should be copied inside the body of main() function.

在后面的示例中,可以省略包和main()函数的声明。如果是这种情况,代码示例应该复制到main()函数体内。

相关推荐
Chase_______2 分钟前
Java基础语言 ④ :面向对象核心——构造方法、this关键字与对象内存模型详解
java·开发语言·面向对象·类与对象
欢璃2 分钟前
表白墙案例
java·开发语言·jvm·spring boot·spring·maven·mybatis
IT知识分享7 分钟前
数字上标、下标如何打,6种常用方法详解
开发语言·c#·xhtml
qwert103713 分钟前
深入解析Python标识符:定义、规则、规范与实践指南
开发语言·数据库·python
cqwuliu20 分钟前
Freemarker模板工具
java·开发语言
学习,学习,在学习20 分钟前
Qt多线程的使用与注意事项
开发语言·数据库·qt
asdfg125896321 分钟前
`(line1, line2) -> line1 + line2` 此Lambda 表达式的理解
java·开发语言
如竟没有火炬23 分钟前
去除重复字母——贪心+单调栈
开发语言·数据结构·python·算法·leetcode·深度优先
AI人工智能+电脑小能手32 分钟前
【大白话说Java面试题 第49题】【JVM篇】第9题:什么是双亲委派机制?介绍一下运作过程。?
java·开发语言·jvm
码农-阿杰34 分钟前
Java 线程中断机制深度解析:从 API 到底层 C++ 实现
java·开发语言·c++