Editing Go

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
[[wikipedia:Go (programming language)]] (Nov [[2009]])
+
{{Draft}}
 +
[[wikipedia:Go (programming language)]] (2009)
  
* [[Concurrent]]
+
* [[concurrent]]
  
== Installation ==
 
* macOS: <code>[[brew install go]]</code>
 
* [[Ubuntu]]: <code>[[apt install golang-go]]</code> (aprox 500MB)
 
  
 +
== Tools ==
 +
* <code>go build</code>, which builds Go binaries using only information in the source files themselves, no separate makefiles
 +
* <code>go test</code>, for unit testing and microbenchmarks
 +
* <code>go fmt</code>, for formatting code
 +
* <code>go get</code>, for retrieving and installing remote packages
 +
* <code>go vet</code>, a static analyzer looking for potential errors in code
 +
* <code>go run</code>, a shortcut for building and executing code
 +
* <code>godoc</code>, for displaying documentation or serving it via HTTP
 +
* <code>gorename</code>, for renaming variables, functions, and so on in a type-safe way
 +
* <code>go generate</code>, a standard way to invoke code generators
  
* [[Ubuntu VM]] on [[Apple M]]:
+
===Hello world===
[[wget]] https://go.dev/dl/go1.20.3.linux-arm64.tar.gz
+
<pre>
  rm -rf [[/usr/local/]]go && tar -C /usr/local -xzf go1.20.3.linux-arm64.tar.gz && [[export]] [[PATH]]=$PATH:/usr/local/go/bin &&  [[go version]]
+
package main
  
== Commands ==
+
import "fmt"
* <code>[[go help]]</code>
 
* <code>[[go build]]</code>, which builds Go binaries using only information in the source files themselves, no separate makefiles
 
* <code>[[go install]]</code>
 
* <code>[[go test]]</code>, for unit testing and microbenchmarks
 
* <code>[[go fmt]]</code>, for formatting code
 
* <code>[[go get]]</code>, for retrieving and installing remote [[packages]]
 
* <code>[[go vet]]</code>, a static analyzer looking for potential errors in code
 
* <code>[[go run]]</code>, a shortcut for building and executing code
 
* <code>[[godoc]]</code>, for displaying documentation or serving it via HTTP
 
* <code>[[gorename]]</code>, for renaming variables, functions, and so on in a type-safe way
 
* <code>[[go generate]]</code>, a standard way to invoke code generators
 
* <code>[[go mod]] init</code>
 
* <code>[[go list]]</code>
 
  
== Examples ==
+
func main() {
* [[Go: Hello world! example]]
+
    fmt.Println("Hello, world!")
* [[for (Go lang)]]
+
}
 +
</pre>
  
== Activities ==
+
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>
* Read go FAQs: https://go.dev/doc/faq#goroutines
 
  
== Projects ==
+
== See also ==
* [[Kubernetes]] (2014)
+
* {{C}}
* [[GVisor]] (2018)
 
* [[Grafana]] (2014)
 
  
== Related ==
 
* [[Class Inheritance]]: [[embedding]] and [[interfaces]] ([[duck typing]])
 
* [[net/http]]
 
* [[channels]]
 
* https://pkg.go.dev/std
 
* <code>[[defer]]</code>
 
* <code>[[$HOME/go/bin/]]</code>
 
* [[Concurrency vs parallelism]]
 
 
== See also ==
 
* https://en.wikipedia.org/wiki/Go_(programming_language)#Version_history
 
* {{Go}}
 
  
 
[[Category:Programming]]
 
[[Category:Programming]]
[[Category:Go]]
 

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page:

Advertising: