Go language example: Hello World

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. Go language example: Hello World


Our first example is the classic "Hello World". Here is the whole code.



Plain Text Code ?
12345 package main import " FMT "func main ()  {     fmt. Println ("Hello world") }


in order to run this program. We put the program in the Hello-world.go file and run the Go Run command.
$ go Run hello-world.go
Hello World

sometimes we want to generate binary files. We can use the Go Build command.
$ go Build hello-world.go
$ ls
Hello-world Hello-world.go

then we can execute the binary directly.
$./hello-world
Hello World

now we are ready to run and build the basic Go Language program. Well, let's learn more.




Original Address:Https://gobyexample.com/hello-world
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.