Difference between revisions of "Go: Hello world! example"
Jump to navigation
Jump to search
↑ "fmt - The Go Programming Language". golang.org. Retrieved 2019-04-08.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
(Created page with "==Hello world== touch hello_world.go <pre> package main import "fmt" func main() { fmt.Println("Hello, world!") } </pre> where "fmt" is the package for ''formatte...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
touch hello_world.go | touch hello_world.go | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | [[package]] main | ||
+ | |||
+ | [[import]] "fmt" | ||
+ | |||
+ | [[func]] main() { | ||
+ | fmt.[[Println]]("Hello, world!") | ||
+ | } | ||
+ | |||
where "[[fmt]]" is the package for ''formatted [[Input/output|I/O]]'', similar to C's [[C file input/output]].<ref>{{Cite web|url=https://golang.org/pkg/fmt/|title=fmt - The Go Programming Language|website=golang.org|access-date=2019-04-08}}</ref> | where "[[fmt]]" is the package for ''formatted [[Input/output|I/O]]'', similar to C's [[C file input/output]].<ref>{{Cite web|url=https://golang.org/pkg/fmt/|title=fmt - The Go Programming Language|website=golang.org|access-date=2019-04-08}}</ref> | ||
Line 22: | Line 21: | ||
== See also == | == See also == | ||
* {{go}} | * {{go}} | ||
+ | |||
+ | [[Category:Programming]] |
Latest revision as of 20:08, 10 December 2021
Hello world[edit]
touch hello_world.go
package main import "fmt" func main() { fmt.Println("Hello, world!") }
where "fmt" is the package for formatted I/O, similar to C's C file input/output.[1]
go build hello_world.go ./hello_world Hello, world!
See also[edit]
- Go, Gorutine:
go [ mod
|list
|fmt
,for
|build
|get
|version
|env | install | test
]go help
, Go template, Echo go web framework, Go packages, Blank identifier
Advertising: