1
0
mirror of https://github.com/golang/go synced 2024-07-05 18:00:52 +00:00

url updates to go.dev / pkg.go.dev

Sean Liao 2022-01-22 17:27:16 +01:00
parent 6fe9f52ac7
commit 3c9c9e1ade
97 changed files with 384 additions and 384 deletions

@ -143,7 +143,7 @@ Start by reading the [overview of mobile development](Mobile) documentation firs
* [Go Performance Observations](http://hashrocket.com/blog/posts/go-performance-observations) _2014-08-07_
* [Debugging performance issues in Go programs - Intel](https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs) _2014-05-10_
* [How to write benchmarks in Go](http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) _2013-06-30_
* [Profiling Go Programs - Go blog](http://blog.golang.org/profiling-go-programs) _2011-06-24_
* [Profiling Go Programs - Go blog](https://go.dev/blog/profiling-go-programs) _2011-06-24_
## Pointers, References and Memory Management

@ -8,5 +8,5 @@ In general, the rules are:
* Minimize use of assembly. We'd rather have a small amount of assembly for a 50% speedup rather than twice as much assembly for a 55% speedup. Explain the decision to place the assembly/Go boundary where it is in the commit message, and support it with benchmarks.
* Use higher level programs to generate non-trivial amounts of assembly, either standalone Go programs or `go get`-able programs, like [avo](https://github.com/mmcloughlin/avo). Output of other reproducible processes (like formally verified code generators) will also be considered. Discuss the implementation strategy on the issue tracker in advance.
* Use small, testable units (2575 lines) called from higher-level logic written in Go. If using small, testable functions called from logic written in Go is too slow, use small, testable assembly units with Go-compatible wrappers, so that Go tests can still test the individual units.
* Any assembly function needs a reference Go implementation, thats tested and fuzzed side-by-side with the assembly. Follow [golang.org/wiki/TargetSpecific](https://golang.org/wiki/TargetSpecific) for structure and testing practices.
* Any assembly function needs a reference Go implementation, thats tested and fuzzed side-by-side with the assembly. Follow [golang.org/wiki/TargetSpecific](https://go.dev/wiki/TargetSpecific) for structure and testing practices.
* Document in the Go code why the implementation requires assembly (specific performance benefit, access to instructions, etc), so we can reevaluate as the compiler improves.

@ -8,7 +8,7 @@ NOTE: Please don't add individual blog entries to this page. Those belong in [ar
## English
* [The official Go Blog](https://blog.golang.org) - For in depth posts by the Go team
* [The official Go Blog](https://go.dev/blog) - For in depth posts by the Go team
* [Gopher Academy Blog](http://blog.gopheracademy.com/)
* [Dave Cheney's Blog](http://dave.cheney.net)
* [Dave Cheney's Resources for Go Programmers](http://dave.cheney.net/resources-for-new-go-programmers)

@ -27,4 +27,4 @@ func handle(r *Request) {
## References
Effective Go's discussion of channels: https://golang.org/doc/effective_go.html#channels
Effective Go's discussion of channels: https://go.dev/doc/effective_go#channels

@ -1,6 +1,6 @@
# Go CSS Coding Guidelines
**Please [discuss changes](https://golang.org/issue/new?title=wiki%3A+CSSStyleGuide+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars.
**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+CSSStyleGuide+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars.
Go's naming conventions are adapted from [Medium's style guide](https://gist.github.com/fat/a47b882eb5f84293c4ed#javascript) and the work being done in the [SUIT CSS framework](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md). Which is to say, it relies on _structured class names_ and _meaningful hyphens_ (i.e., not using hyphens merely to separate words). This is to help work around the current limits of applying CSS to the DOM (i.e., the lack of style encapsulation) and to better communicate the relationships between classes.

@ -6,7 +6,7 @@ This tutorial will show you how to install, build, and run Go on Chrome OS.
Please note this has only been tested on a 64GB LTE Pixel, however it should work on other Chromebooks. Note that enabling developer mode reduces the security guarantees offered by Chrome OS.
# Install Go
First download the latest version of Go for Linux from the [Go Downloads page](http://golang.org/dl/).
First download the latest version of Go for Linux from the [Go Downloads page](https://go.dev/dl/).
After that, open a shell by hitting (CTRL+ALT+T) and typing in `shell` then hit enter. Then extract it using the following command (when replacing `< Go Linux package >` with the name of the file you downloaded):
```
@ -41,4 +41,4 @@ Now, run `go install hello`. Then, run `${GOPATH}/bin/hello` (or just `hello` if
***
# Reporting bugs
Please go to [Issues](https://github.com/golang/go/issues) to report any issues you have.
Please go to [Issues](https://github.com/golang/go/issues) to report any issues you have.

@ -1,4 +1,4 @@
Be sure to familiarize yourself with the code review process from the official [Contribution Guide](https://golang.org/doc/contribute.html) first.
Be sure to familiarize yourself with the code review process from the official [Contribution Guide](https://go.dev/doc/contribute) first.
# Reviewer Parlance

@ -4,11 +4,11 @@ This page collects common comments made during reviews of Go code, so
that a single detailed explanation can be referred to by shorthands.
This is a laundry list of common mistakes, not a comprehensive style guide.
You can view this as a supplement to [Effective Go](https://golang.org/doc/effective_go.html).
You can view this as a supplement to [Effective Go](https://go.dev/doc/effective_go).
Additional comments related to testing can be found at [Go Test Comments](https://github.com/golang/go/wiki/TestComments)
**Please [discuss changes](https://golang.org/issue/new?title=wiki%3A+CodeReviewComments+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars.
**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+CodeReviewComments+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars.
* [Gofmt](#gofmt)
* [Comment Sentences](#comment-sentences)
@ -44,13 +44,13 @@ Additional comments related to testing can be found at [Go Test Comments](https:
## Gofmt
Run [gofmt](https://golang.org/cmd/gofmt/) on your code to automatically fix the majority of mechanical style issues. Almost all Go code in the wild uses `gofmt`. The rest of this document addresses non-mechanical style points.
Run [gofmt](https://pkg.go.dev/cmd/gofmt/) on your code to automatically fix the majority of mechanical style issues. Almost all Go code in the wild uses `gofmt`. The rest of this document addresses non-mechanical style points.
An alternative is to use [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports), a superset of `gofmt` which additionally adds (and removes) import lines as necessary.
## Comment Sentences
See https://golang.org/doc/effective_go.html#commentary. Comments documenting declarations should be full sentences, even if that seems a little redundant. This approach makes them format well when extracted into godoc documentation. Comments should begin with the name of the thing being described and end in a period:
See https://go.dev/doc/effective_go#commentary. Comments documenting declarations should be full sentences, even if that seems a little redundant. This approach makes them format well when extracted into godoc documentation. Comments should begin with the name of the thing being described and end in a period:
```go
// Request represents a request to run a command.
@ -157,11 +157,11 @@ For more discussion about nil in Go see Francesc Campoy's talk [Understanding Ni
## Doc Comments
All top-level, exported names should have doc comments, as should non-trivial unexported type or function declarations. See https://golang.org/doc/effective_go.html#commentary for more information about commentary conventions.
All top-level, exported names should have doc comments, as should non-trivial unexported type or function declarations. See https://go.dev/doc/effective_go#commentary for more information about commentary conventions.
## Don't Panic
See https://golang.org/doc/effective_go.html#errors. Don't use panic for normal error handling. Use error and multiple return values.
See https://go.dev/doc/effective_go#errors. Don't use panic for normal error handling. Use error and multiple return values.
## Error Strings
@ -172,7 +172,7 @@ Error strings should not be capitalized (unless beginning with proper nouns or a
When adding a new package, include examples of intended usage: a runnable Example,
or a simple test demonstrating a complete call sequence.
Read more about [testable Example() functions](https://blog.golang.org/examples).
Read more about [testable Example() functions](https://go.dev/blog/examples).
## Goroutine Lifetimes
@ -192,7 +192,7 @@ If that just isn't feasible, document when and why the goroutines exit.
## Handle Errors
See https://golang.org/doc/effective_go.html#errors. Do not discard errors using `_` variables. If a function returns an error, check it to make sure the function succeeded. Handle the error, return it, or, in truly exceptional situations, panic.
See https://go.dev/doc/effective_go#errors. Do not discard errors using `_` variables. If a function returns an error, check it to make sure the function succeeded. Handle the error, return it, or, in truly exceptional situations, panic.
## Imports
@ -424,7 +424,7 @@ boundaries are, not to start counting lines.
## Mixed Caps
See https://golang.org/doc/effective_go.html#mixed-caps. This applies even when it breaks conventions in other languages. For example an unexported constant is `maxLength` not `MaxLength` or `MAX_LENGTH`.
See https://go.dev/doc/effective_go#mixed-caps. This applies even when it breaks conventions in other languages. For example an unexported constant is `maxLength` not `MaxLength` or `MAX_LENGTH`.
Also see [Initialisms](https://github.com/golang/go/wiki/CodeReviewComments#initialisms).
@ -545,7 +545,7 @@ of the sentence. When the binary name is the first word, capitalizing it is
required even though it does not strictly match the spelling of the
command-line invocation.
See https://golang.org/doc/effective_go.html#commentary for more information about commentary conventions.
See https://go.dev/doc/effective_go#commentary for more information about commentary conventions.
## Package Names
@ -553,8 +553,8 @@ All references to names in your package will be done using the package name,
so you can omit that name from the identifiers. For example, if you are in package chubby,
you don't need type ChubbyFile, which clients will write as `chubby.ChubbyFile`.
Instead, name the type `File`, which clients will write as `chubby.File`.
Avoid meaningless package names like util, common, misc, api, types, and interfaces. See http://golang.org/doc/effective_go.html#package-names and
http://blog.golang.org/package-names for more.
Avoid meaningless package names like util, common, misc, api, types, and interfaces. See https://go.dev/doc/effective_go#package-names and
https://go.dev/blog/package-names for more.
## Pass Values

@ -14,16 +14,16 @@ of all these concurrency gotchas.
Insufficient synchronisation and race conditions
- [HTTP handler functions are thread-safe?](#http-handlers)
- [Global functions and variables are protected by mutexes or otherwise thread-safe?](
https://golang.org/doc/articles/race_detector#Unprotected_global_variable)
https://go.dev/doc/articles/race_detector#Unprotected_global_variable)
- [*Reads* of fields and variables are protected?](#sync-balance)
- [The loop variable is passed into the goroutine function as an argument?](
https://golang.org/doc/articles/race_detector#Race_on_loop_counter)
https://go.dev/doc/articles/race_detector#Race_on_loop_counter)
- [Methods on thread-safe types don't return pointers to protected structures?](#return-pointer)
- [`Load()` or `Delete()` calls on a `sync.Map` after `Load()` is not a race condition?
](#sync-map-race)
Testing
- [Running tests with `-race` flag in CI/CD?](https://golang.org/doc/articles/race_detector)
- [Running tests with `-race` flag in CI/CD?](https://go.dev/doc/articles/race_detector)
Scalability
- [A channel is intentionally created with zero capacity?](#zero-cap-ch)
@ -54,7 +54,7 @@ synchronising reads even to primitive variables because of non-atomic hardware w
memory visibility problems.
See also a [Typical Data Race: Primitive unprotected variable](
https://golang.org/doc/articles/race_detector#Primitive_unprotected_variable).
https://go.dev/doc/articles/race_detector#Primitive_unprotected_variable).
<a name="return-pointer"></a>
[#](#return-pointer) RC.3. **A method on a thread-safe type doesn't return a pointer to a protected
@ -125,8 +125,8 @@ same result and doesn't have side effects.
> ⚠️ **Potentially misleading information**. "Race condition" can refer to logic errors, like this example, which can be benign. But the phrase is also commonly used to refer to violations of the memory model, which are never benign.
If the race condition is not benign, use methods [`sync.Map.LoadOrStore()`](
https://golang.org/pkg/sync/#Map.LoadOrStore) and [`LoadAndDelete()`](
https://golang.org/pkg/sync/#Map.LoadAndDelete) to fix it.
https://pkg.go.dev/sync/#Map.LoadOrStore) and [`LoadAndDelete()`](
https://pkg.go.dev/sync/#Map.LoadAndDelete) to fix it.
### Scalability
@ -176,7 +176,7 @@ not to stop the ticker when the function which uses the ticker in a loop returns
<a name="time-eq"></a>
[#](#time-eq) Tm.2. **Are `time.Time` structs compared using `Equal()` method, not just `==`?**
Quoting the [documentation for `time.Time`](https://golang.org/pkg/time/#Time):
Quoting the [documentation for `time.Time`](https://pkg.go.dev/time/#Time):
> Note that the Go `==` operator compares not just the time instant but also the Location and the
> monotonic clock reading. Therefore, `Time` values should not be used as map or database keys
@ -231,15 +231,15 @@ This code would be wrong without calling `Round(0)`, i. e. stripping the monoton
reviewing Go code, not concurrency-specific.
Go concurrency:
- [The Go Memory Model](https://golang.org/ref/mem)
- [The Go Memory Model](https://go.dev/ref/mem)
- [Section about concurrency in *Effective Go*](
https://golang.org/doc/effective_go.html#concurrency)
https://go.dev/doc/effective_go#concurrency)
- Posts in The Go Blog:
- [Share Memory By Communicating](https://blog.golang.org/codelab-share)
- [Go Concurrency Patterns: Timing out, moving on](https://blog.golang.org/concurrency-timeouts)
- [Go Concurrency Patterns: Context](https://blog.golang.org/context)
- [Go Concurrency Patterns: Pipelines and cancellation](https://blog.golang.org/pipelines)
- [Advanced Go Concurrency Patterns](https://blog.golang.org/io2013-talk-concurrency) (video)
- [Share Memory By Communicating](https://go.dev/blog/codelab-share)
- [Go Concurrency Patterns: Timing out, moving on](https://go.dev/blog/concurrency-timeouts)
- [Go Concurrency Patterns: Context](https://go.dev/blog/context)
- [Go Concurrency Patterns: Pipelines and cancellation](https://go.dev/blog/pipelines)
- [Advanced Go Concurrency Patterns](https://go.dev/blog/io2013-talk-concurrency) (video)
- [Rethinking Classical Concurrency Patterns](https://www.youtube.com/watch?v=5zXAHh5tJqQ) (video)
- [Understanding Real-World Concurrency Bugs in Go](https://songlh.github.io/paper/go-study.pdf)

@ -13,7 +13,7 @@ An overview of tools that will help improve your Go code
### Tools
- [gofmt](https://golang.org/cmd/gofmt/) - Start with the standard Go code formatter
- [gofmt](https://pkg.go.dev/cmd/gofmt/) - Start with the standard Go code formatter
- [golint](https://github.com/golang/lint) - Detects style mistakes in Go code
- [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) - Format code and fix your import statements
- [gofumpt](https://github.com/mvdan/gofumpt) - A stricter gofmt
@ -40,7 +40,7 @@ An overview of tools that will help improve your Go code
### Tools
- [eg](https://pkg.go.dev/golang.org/x/tools/cmd/eg) - Example-based refactoring tool for Go
- [gofmt](https://golang.org/cmd/gofmt/) - Start with the standard Go code formatter
- [gofmt](https://pkg.go.dev/cmd/gofmt/) - Start with the standard Go code formatter
- [gorename](https://golang.org/x/tools/refactor/rename) - Renaming tool for Go
## Error Detection
@ -53,12 +53,12 @@ An overview of tools that will help improve your Go code
- [AlignCheck, StructCheck, VarCheck](https://github.com/opennota/check/) - A suite of tools for checking your code.
- [errcheck](https://github.com/kisielk/errcheck) - Ensure you check your error conditions.
- [go vet](http://golang.org/cmd/vet/) - Read this first on how to use the `go vet` command.
- [go vet](https://pkg.go.dev/cmd/vet/) - Read this first on how to use the `go vet` command.
- [SafeSQL](https://github.com/stripe/safesql) - Protect against unsafe SQL in your code.
## Navigation
- [Go Guru - User Manual](https://golang.org/s/using-guru) - A tool for understanding Go code.
- [Go Guru - User Manual](https://go.dev/s/using-guru) - A tool for understanding Go code.
- [Pythia](https://github.com/fzipp/pythia) - A browser-based UI for Go Guru.
## Visualization

@ -68,7 +68,7 @@ Values: [[3] [3] [3]]
The same issue can be demonstrated also when the loop variable is being used in a Goroutine (see the following section).
# Using goroutines on loop iterator variables
# Using goroutines on loop iterator variables
When iterating in Go, one might attempt to use goroutines to process data in parallel. For example, you might write something like this, using a closure:
@ -115,7 +115,7 @@ for i := 1; i <= 10; i++ {
```
Even though the closures all still close over the same variable (in this case, ` i `), they are executed before the variable changes, resulting in the desired behavior.
http://golang.org/doc/go_faq.html#closures_and_goroutines
https://go.dev/doc/faq#closures_and_goroutines
You may find another, similar situation like the following:
@ -128,7 +128,7 @@ func (v *val) MyMethod() {
fmt.Println(v)
}
```
The above example also will print last element of values, the reason is same as closure. To fix the issue declare another variable inside the loop.
The above example also will print last element of values, the reason is same as closure. To fix the issue declare another variable inside the loop.
```go
for _, val := range values {

@ -92,7 +92,7 @@ for i := range s {
}
```
are converted into efficient runtime memclr calls. [Issue](https://github.com/golang/go/issues/5373) and [commit](https://golang.org/change/f03c9202c43e0abb130669852082117ca50aa9b1).
are converted into efficient runtime memclr calls. [Issue](https://github.com/golang/go/issues/5373) and [commit](https://go.dev/change/f03c9202c43e0abb130669852082117ca50aa9b1).
* **gc:** 1.5+
* **gccgo:** ?

@ -20,7 +20,7 @@ This page outlines the steps that need to be done to create a new golang.org/x r
5. Redeploy all affected commands (or ask an x/build [owner](https://dev.golang.org/owners) to deploy if you're not; the order shouldn't matter):
1. `x/build/cmd/gitmirror`
2. `x/build/maintner/maintnerd`
- Note that it's expected for the new repo not to appear in maintner until first issue or PR is created (see [#25744](https://golang.org/issue/25744)).
- Note that it's expected for the new repo not to appear in maintner until first issue or PR is created (see [#25744](https://go.dev/issue/25744)).
3. `x/build/cmd/gerritbot`
4. `x/build/cmd/coordinator`
5. `x/website/cmd/golangorg`

@ -5,7 +5,7 @@ Originally published at https://rakyll.org/custom-profiles/.
Go provides several pprof profiles out of the box to gather
profiling data from Go programs.
The builtin profiles provided by the [runtime/pprof](https://golang.org/pkg/runtime/pprof/) package:
The builtin profiles provided by the [runtime/pprof](https://pkg.go.dev/runtime/pprof/) package:
* **profile**: CPU profile determines where a program spends its time while actively consuming CPU cycles (as opposed while sleeping or waiting for I/O).
* **heap**: Heap profile reports the currently live allocations; used to monitor current memory usage or check for memory leaks.
@ -14,7 +14,7 @@ The builtin profiles provided by the [runtime/pprof](https://golang.org/pkg/runt
* **block**: Block profile show where goroutines block waiting on synchronization primitives (including timer channels). Block profile is not enabled by default; use runtime.SetBlockProfileRate to enable it.
* **mutex**: Mutex profile reports the lock contentions. When you think your CPU is not fully utilized due to a mutex contention, use this profile. Mutex profile is not enabled by default, see runtime.SetMutexProfileFraction to enable.
Additional to the builtin profiles, [runtime/pprof](https://golang.org/pkg/runtime/pprof/) package allows you to export your custom profiles, and instrument your code to record
Additional to the builtin profiles, [runtime/pprof](https://pkg.go.dev/runtime/pprof/) package allows you to export your custom profiles, and instrument your code to record
execution stacks that contributes to this profile.
Imagine we have a blob server, and we are writing a Go client for it. And our users want to be able to profile the opened blobs on the client. We can create a profile and record the events of blob opening and closing, so the user can tell how many open blobs they are at any time.

@ -8,7 +8,7 @@ A builder runs on a certain host type. (e.g. `linux-386-387` is a build type. It
They come from the file https://github.com/golang/build/blob/master/dashboard/builders.go
For design details about the coordinator, see https://golang.org/s/builderplan
For design details about the coordinator, see https://go.dev/s/builderplan
# How to set up a builder
@ -33,6 +33,6 @@ For WIP ports, the steps above can be done out of order as needed. But as a port
# Security notes
Generally, community-run builders only run code that's already been reviewed & submitted. We only enable pre-submit testing for builders run by the Go team that have a lot of hardware available. However, the [Gomote tool](https://golang.org/wiki/Gomote) is available for a number of people on the Go team and in the Go community that lets them have arbitrary access to the builders for development & debugging.
Generally, community-run builders only run code that's already been reviewed & submitted. We only enable pre-submit testing for builders run by the Go team that have a lot of hardware available. However, the [Gomote tool](https://go.dev/wiki/Gomote) is available for a number of people on the Go team and in the Go community that lets them have arbitrary access to the builders for development & debugging.
For paranoia reasons, you might want to run your builder in an isolated network that can't access any of your internal resources.

@ -9,9 +9,9 @@ deprecation, and a recommendation on what to use instead, if applicable.
The paragraph does not have to be the last paragraph in the doc comment.
[Some tools will warn on use of deprecated identifiers](https://staticcheck.io/docs/checks#SA1019)
and their docs [will be hidden by godoc once #17056 is implemented](https://golang.org/issue/17056).
and their docs [will be hidden by godoc once #17056 is implemented](https://go.dev/issue/17056).
The original issue to document the "Deprecated" convention was [issue #10909](https://golang.org/issue/10909).
The original issue to document the "Deprecated" convention was [issue #10909](https://go.dev/issue/10909).
Note that, if function `F1` is being replaced by function `F2`,
and the first release in which `F2` is available is Go 1.N,

@ -5,45 +5,45 @@
# Go 1.2
* [xml.Marshaler and Unmarshaler](http://golang.org/s/go12xml)
* [encoding.TextMarshaler and Unmarshaler](http://golang.org/s/go12encoding)
* [Runtime Symbol Table Format](http://golang.org/s/go12symtab)
* [Field Selectors and Nil Checks](http://golang.org/s/go12nil)
* [```x[i:j:k]``` Slice Syntax](http://golang.org/s/go12slice)
* [xml.Marshaler and Unmarshaler](https://go.dev/s/go12xml)
* [encoding.TextMarshaler and Unmarshaler](https://go.dev/s/go12encoding)
* [Runtime Symbol Table Format](https://go.dev/s/go12symtab)
* [Field Selectors and Nil Checks](https://go.dev/s/go12nil)
* [```x[i:j:k]``` Slice Syntax](https://go.dev/s/go12slice)
* [Preemptive Scheduler](https://docs.google.com/document/d/1ETuA2IOmnaQ4j81AtTGT40Y4_Jr6_IDASEKg0t0dBR8/edit?usp=sharing)
# Go 1.3
* [Contiguous Stacks](https://docs.google.com/document/d/1wAaf1rYoM4S4gtnPh0zOlGzWtrZFQ5suE8qr2sD8uWQ/pub)
* [Go 1.3 Linker Overhaul](https://golang.org/s/go13linker)
* [Go 1.3 Linker Overhaul](https://go.dev/s/go13linker)
* [Go 1.3 Native Client Support](https://docs.google.com/document/d/1oA4rs0pfk5NzUyA0YX6QsUEErNIMXawoscw9t0NHafo/pub)
# Go 1.4
* [Go channels on steroids](http://golang.org/s/go13chan)
* [Go 1.4 “Internal” Packages](http://golang.org/s/go14internal)
* [Go 1.4 src/pkg → src](http://golang.org/s/go14nopkg)
* [Go 1.4 Custom Import Path Checking](http://golang.org/s/go14customimport)
* [Go generate: A Proposal](http://golang.org/s/go1.4-generate)
* [Go channels on steroids](https://go.dev/s/go13chan)
* [Go 1.4 “Internal” Packages](https://go.dev/s/go14internal)
* [Go 1.4 src/pkg → src](https://go.dev/s/go14nopkg)
* [Go 1.4 Custom Import Path Checking](https://go.dev/s/go14customimport)
* [Go generate: A Proposal](https://go.dev/s/go1.4-generate)
* [The syscall package](https://docs.google.com/a/golang.org/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs)
* [Go 1.4 Subrepo Renaming](http://golang.org/s/go14subrepo)
* [Go 1.4 Native Client Support for ARM](http://golang.org/s/go14naclarm)
* [dev.cc branch plan](http://golang.org/s/dev.cc)
* [Go 1.4 Subrepo Renaming](https://go.dev/s/go14subrepo)
* [Go 1.4 Native Client Support for ARM](https://go.dev/s/go14naclarm)
* [dev.cc branch plan](https://go.dev/s/dev.cc)
# Go 1.5
* [Go 1.5 Bootstrap Plan](https://golang.org/s/go15bootstrap)
* [Go Compiler Overhaul](http://golang.org/s/go13compiler)
* [Go 1.5 Bootstrap Plan](https://go.dev/s/go15bootstrap)
* [Go Compiler Overhaul](https://go.dev/s/go13compiler)
* [Go Execution Tracer](http://goo.gl/eXjfeS)
# Future Proposals
* [New SSA Backend for the Go Compiler](https://docs.google.com/document/d/1szwabPJJc4J-igUZU4ZKprOrNRNJug2JPD8OYi3i1K0/edit?usp=sharing_eid)
* [Go 1.4+ Garbage Collection (GC) Plan and Roadmap](http://golang.org/s/go14gc)
* [Go 1.4+ Garbage Collection (GC) Plan and Roadmap](https://go.dev/s/go14gc)
* [Better GC and Memory Allocator for Go](https://docs.google.com/document/d/1HCPu3WKyCX3ZRYxmIMKTk0Ik1dePxKW1p02k3uhcft4/view)
* [Groups Discussion](https://groups.google.com/d/topic/golang-dev/pwUh0BVFpY0/discussion)
* [Precise GC Stack Roots](https://docs.google.com/document/d/13v_u3UrN2pgUtPnH4y-qfmlXwEEryikFu0SQiwk35SA/pub)
* [Go 1.3 cmd/go and os/fsnotify](http://golang.org/s/go13fsnotify)
* [Go 1.3 cmd/go and os/fsnotify](https://go.dev/s/go13fsnotify)
* [Go 1.5 os/fsnotify API](http://goo.gl/MrYxyA)
* [Simple Multi-Dimensional Slices (Tables)](https://docs.google.com/document/d/1eHm7KqfKP9_s4vR1zToxq-FBazdUQ9ZYi-YhcEtdfR0/edit)
* [Go execution modes](https://docs.google.com/a/golang.org/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ/edit)
@ -53,8 +53,8 @@
# Other Tools
* [Go Oracle](https://docs.google.com/document/d/1WmMHBUjQiuy15JfEnT8YBROQmEv-7K6bV-Y_K53oi5Y)
* [Binding Go and Java](http://golang.org/s/gobind)
* [Go Builder Plan](http://golang.org/s/builderplan)
* [Binding Go and Java](https://go.dev/s/gobind)
* [Go Builder Plan](https://go.dev/s/builderplan)
* [gomobile — a tool for building apps](https://docs.google.com/document/d/1cePOQ35PNEb_QqxnPAmBv0cEnAm7AQSGuz9wVeJ-lBs/edit)
# Rejected Proposals

@ -92,7 +92,7 @@ A natural thought would be to modify `IsX` to unwrap the error it is passed, che
Your situation is like that of the standard `os` package, which has several such functions. We recommend the approach we took there. The `os` package has several predicates, but we treated most of them the same. For concreteness, we'll look at `os.IsExist`.
Instead of changing `os.IsExist`, we made `errors.Is(err, os.ErrExist)` behave like it, except that `Is` unwraps. (We did this by having `syscall.Errno` implement an `Is` method, as described in the documentation for [`errors.Is`](https://golang.org/pkg/errors/#Is).) Using `errors.Is` will always work correctly, because it will exist only in Go versions 1.13 and higher. For older versions of Go, you should recursively unwrap the error yourself, calling `os.IsExist` on each underlying error.
Instead of changing `os.IsExist`, we made `errors.Is(err, os.ErrExist)` behave like it, except that `Is` unwraps. (We did this by having `syscall.Errno` implement an `Is` method, as described in the documentation for [`errors.Is`](https://pkg.go.dev/errors/#Is).) Using `errors.Is` will always work correctly, because it will exist only in Go versions 1.13 and higher. For older versions of Go, you should recursively unwrap the error yourself, calling `os.IsExist` on each underlying error.
This technique only works if you have control of the errors being wrapped, so you can add `Is` methods to them.
In that case, we recommend:

@ -97,6 +97,6 @@ func foo() {
## References
* Errors (specification): http://golang.org/ref/spec#Errors
* Package `errors`: http://golang.org/pkg/errors/
* Type switches: http://golang.org/doc/go_spec.html#TypeSwitchStmt
* Errors (specification): https://go.dev/ref/spec#Errors
* Package `errors`: https://pkg.go.dev/errors/
* Type switches: https://go.dev/ref/spec#TypeSwitchStmt

@ -1,10 +1,10 @@
This page collects experience reports about problems with Go that might inform our design of solutions to those problems. These reports should focus on the _problems_: they should not focus on and need not propose solutions. To propose solutions, see the [proposal process](https://golang.org/s/proposal).
This page collects experience reports about problems with Go that might inform our design of solutions to those problems. These reports should focus on the _problems_: they should not focus on and need not propose solutions. To propose solutions, see the [proposal process](https://go.dev/s/proposal).
We hope to use these experience reports to understand where people are having trouble writing Go, to help us prioritize future changes to the Go ecosystem. (We do not promise to reply to these. If you need immediate help answering questions about Go, see [https://golang.org/help/](https://golang.org/help/) for resources.)
We hope to use these experience reports to understand where people are having trouble writing Go, to help us prioritize future changes to the Go ecosystem. (We do not promise to reply to these. If you need immediate help answering questions about Go, see [https://go.dev/help/](https://go.dev/help/) for resources.)
__The best experience reports tell: (1) what you wanted to do, (2) what you actually did, and (3) why that wasnt great, illustrating those by real concrete examples, ideally from production use.__ Please write these reports about the problems most significant to you, post them on your own blog, or on Medium, or as a [Github Gist](https://gist.github.com/) (use a `.md` extension for Markdown), or as a publicly-readable Google doc, and then link them here. (Talk videos or slides are also welcome, although they are not as convenient for us to digest.)
If you do not have permission to edit the wiki to add an article to this list, [please file an issue](https://golang.org/issue/new).
If you do not have permission to edit the wiki to add an article to this list, [please file an issue](https://go.dev/issue/new).
Please keep the overall page sorted alphabetically by section (Error Handling before Logging, and so on).
Within a section, please keep articles sorted chronologically.
@ -69,7 +69,7 @@ Add new sections as appropriate.
## Declarations
- Christophe Meessen, "[Problems with Go's shorthand declaration :=](https://gist.github.com/chmike/ac0113afefbc04e67323b4a3688d6b54#file-godeclareproblem-md)", July 2017, about the shadowing var trap and apparent inconsistency of `:=`.
- Christophe Meessen, "[Problems with Go's shorthand declaration :=](https://gist.github.com/chmike/ac0113afefbc04e67323b4a3688d6b54#file-godeclareproblem-md)", July 2017, about the shadowing var trap and apparent inconsistency of `:=`.
- Brian Will, "[Go's := syntax is error-prone with multiple target variables](https://gist.github.com/BrianWill/671ce51e6ef6a9f0caa27272a9a0637f)", August 2017.
## Dependencies
@ -99,7 +99,7 @@ Add new sections as appropriate.
(This section is about writing `if err != nil`.)
- Andrew Gerrand, “[Error Handling and Go](https://blog.golang.org/error-handling-and-go),” July 2011,
- Andrew Gerrand, “[Error Handling and Go](https://go.dev/blog/error-handling-and-go),” July 2011,
showing Go error handling patterns.
- Martin Sústrik, “[Why should I have written ZeroMQ in C, not C++ (part I)](http://www.250bpm.com/blog:4),” May 2012,
discussing production problems with C++ exception handling due to error-handling code being far from code that causes the error.
@ -120,7 +120,7 @@ Add new sections as appropriate.
- Andrew Morgan, “[What I Don't Like About Error Handling in Go, and How to Work Around It](https://opencredo.com/why-i-dont-like-error-handling-in-go/),” January 2017,
about it being difficult to force good error handling, errors not having stack traces, and error handling being too verbose.
- Chris Siebenmann, “[Go's net package doesn't have opaque errors, just undocumented ones](https://utcc.utoronto.ca/~cks/space/blog/programming/GoNetErrorsUndocumented),” August 2018
- Bryan C. Mills, “[Error Wrapping and Redundancy in Go](https://github.com/bcmills/go-experience-reports/blob/master/errors.md),” September 2019
- Bryan C. Mills, “[Error Wrapping and Redundancy in Go](https://github.com/bcmills/go-experience-reports/blob/master/errors.md),” September 2019
## File System
@ -147,9 +147,9 @@ Add new sections as appropriate.
- Sameer Ajmani, "[Go Experience Report for Generics: Google metrics API](https://medium.com/@sameer_74231/go-experience-report-for-generics-google-metrics-api-b019d597aaa4)", August 2017
- Chewxy, "[Tensor Refactor: A Go Experience Report](https://blog.chewxy.com/2017/09/11/tensor-refactor/)", September 2017, discusses the lack of generics and how it affects building high performance multidimensional arrays for different data types (having to resort to a lot of pointer ugliness, and manually keeping track of type and runtime type checking)
- qwerty2501,"[A problem runtime error due to lack of Generics](https://gist.github.com/qwerty2501/8839af87946571943a6c4f623c6124e2)", October 2017
- posener, "[Why I recommend to avoid using the go-kit library](https://gist.github.com/posener/330c2b08aaefdea6f900ff0543773b2e)", clear separation of concern need lots of boilerplate code. gokit try
- posener, "[Why I recommend to avoid using the go-kit library](https://gist.github.com/posener/330c2b08aaefdea6f900ff0543773b2e)", clear separation of concern need lots of boilerplate code. gokit try
code generation to avoid this [#70](https://github.com/go-kit/kit/issues/70) [#308](https://github.com/go-kit/kit/pull/308) [protoc-gen-gokit](https://github.com/AmandaCameron/protoc-gen-gokit) , but it looks like
a complex solution for the problem.
a complex solution for the problem.
- Xavier Leroy, "[A modular module system](http://gallium.inria.fr/%7Exleroy/publi/modular-modules-jfp.pdf)", paper about module description for generics.
- Tobias Gustafsson, "[Experiences implementing PEDS](https://github.com/tobgu/peds/blob/master/experience_report.md)", PEDS is a set of statically type safe, immutable/persistent, collections. November 2017
- A Googler "[govisor/generics.go](https://github.com/google/gvisor/blob/master/tools/go_generics/generics.go)". April 27, 2018
@ -166,7 +166,7 @@ a complex solution for the problem.
- Pablo R. Larraondo "[A Go interprocess communication model](https://gist.github.com/prl900/a7aaa41707e2236592da5e78d8a10dc9)," August 2017
## Large-Scale Software Development
- Russ Cox, “[Codebase Refactoring (with help from Go)](https://talks.golang.org/2016/refactor.article),” November 2016, laying out the gradual code repair problem addressed in part by type aliases ([#18130](https://golang.org/issue/18130)).
- Russ Cox, “[Codebase Refactoring (with help from Go)](https://talks.golang.org/2016/refactor.article),” November 2016, laying out the gradual code repair problem addressed in part by type aliases ([#18130](https://go.dev/issue/18130)).
- Travis Jeffery, "[I'll take pkg over internal](https://travisjeffery.com/b/2019/11/i-ll-take-pkg-over-internal/)," November 2019; talking about Go project layouts, problems with internal, and why people use pkg.
## Logging
@ -206,7 +206,7 @@ a complex solution for the problem.
- Nathan Kerr, "[Concurrency Slower?](https://pocketgophers.com/concurrency-slower/)", shows how to use Go's testing, benchmarking, and profiling tools to improve the performance of a concurrent implementation of a function. April 2017.
## Porting
- Shannon Pekary, "[Why GOPP](https://github.com/spekary/gopp/blob/master/Why.md)," an attempt to create
- Shannon Pekary, "[Why GOPP](https://github.com/spekary/gopp/blob/master/Why.md)," an attempt to create
a 'class' keyword that simply makes a struct to also be an interface to make porting code from object-oriented languages much easier.
## Slices
@ -219,9 +219,9 @@ a 'class' keyword that simply makes a struct to also be an interface to make por
- Bojan Zivanovic, "[Optional function parameters](https://bojanz.github.io/optional-parameters-go/)", May 2020
- Raanan Hadar, "[A data scientist's take on Go](https://medium.com/@rhadar/a-data-scientists-take-on-go-ed408c00ac45)", September 2020
## Time
## Time
- John Graham-Cumming, “[How and Why the Leap Second Affected Cloudflare DNS](https://blog.cloudflare.com/how-and-why-the-leap-second-affected-cloudflare-dns/),” January 2017, about timing across leap seconds ([#12914](https://golang.org/issue/12914)).
- John Graham-Cumming, “[How and Why the Leap Second Affected Cloudflare DNS](https://blog.cloudflare.com/how-and-why-the-leap-second-affected-cloudflare-dns/),” January 2017, about timing across leap seconds ([#12914](https://go.dev/issue/12914)).
## Tooling
@ -249,9 +249,9 @@ a 'class' keyword that simply makes a struct to also be an interface to make por
- Mike Schinkel, "[Pros and cons of leveraging Go types](https://mikeschinkel.me/2019/pros-and-cons-of-leveraging-go-types/), April 2019, Discusses how great Go's type system is but tries to show how really using it can be extremely tedious and make for code that is harder-to-reason-about, so proposes an explicit `type alias` feature.
## Typed nils
- David Cheney, "[Typed nils in Go 2](https://dave.cheney.net/2017/08/09/typed-nils-in-go-2)", August 2017.
## Vendoring
- Jeremy Loy, "[Go Modules and Vendoring](https://github.com/golang/go/issues/27227#issuecomment-420428896)", September 2018.
- Ian Davis, "[Vendoring for self-contained builds](https://github.com/golang/go/issues/27227#issuecomment-459171581)", January 2019
- Ian Davis, "[Vendoring for self-contained builds](https://github.com/golang/go/issues/27227#issuecomment-459171581)", January 2019

@ -12,4 +12,4 @@
_*_ Go 1.5 or above is recommended.
_**_ FreeBSD 12/13 requires a kernel with `options COMPAT_FREEBSD11` config (this is the default). 64-bit inode aware system calls are available since https://golang.org/cl/143637. See https://golang.org/issues/22447.
_**_ FreeBSD 12/13 requires a kernel with `options COMPAT_FREEBSD11` config (this is the default). 64-bit inode aware system calls are available since https://go.dev/cl/143637. See https://go.dev/issues/22447.

@ -1,12 +1,12 @@
## GOPATH variable
Go development using dependencies beyond the standard library is done [using Go modules](https://blog.golang.org/using-go-modules). When using Go modules, the GOPATH variable (which defaults to `$HOME/go` on Unix and `%USERPROFILE%\go` on Windows) is used for the following purposes:
Go development using dependencies beyond the standard library is done [using Go modules](https://go.dev/blog/using-go-modules). When using Go modules, the GOPATH variable (which defaults to `$HOME/go` on Unix and `%USERPROFILE%\go` on Windows) is used for the following purposes:
- The `go install` command installs binaries to `$GOBIN`, which defaults to `$GOPATH/bin`.
- The `go get` command caches downloaded modules in `$GOMODCACHE`, which defaults to `$GOPATH/pkg/mod`.
- The `go get` command caches downloaded checksum database state in `$GOPATH/pkg/sumdb`.
See the [go command documentation](http://golang.org/cmd/go/#hdr-GOPATH_environment_variable) for full details about the GOPATH variable. The rest of this page concerns the GOPATH development mode, which is now deprecated.
See the [go command documentation](https://pkg.go.dev/cmd/go/#hdr-GOPATH_environment_variable) for full details about the GOPATH variable. The rest of this page concerns the GOPATH development mode, which is now deprecated.
## GOPATH development mode
@ -43,7 +43,7 @@ No. The GOPATH variable (set in the environment or by `go env -w`) is **not** be
### Can I still write code in GOPATH/src/import/path?
Yes. Many Go developers appreciate the structure that this convention provides and check out their module repositories into it. All your code needs to get started with modules is a `go.mod` file. See [`go mod init`](https://golang.org/cmd/go/#hdr-Initialize_new_module_in_current_directory).
Yes. Many Go developers appreciate the structure that this convention provides and check out their module repositories into it. All your code needs to get started with modules is a `go.mod` file. See [`go mod init`](https://pkg.go.dev/cmd/go/#hdr-Initialize_new_module_in_current_directory).
### How can I compile one repo in GOPATH/src against changes made in another?
@ -71,8 +71,8 @@ None of this is possible with GOPATH development mode as it exists today. We can
### When was it decided to deprecate GOPATH development mode?
The [original plan](https://blog.golang.org/modules2019) was to deprecate GOPATH mode in Go 1.13, but we wanted to take extra time to make modules even more robust for as many Go users as possible, so the deprecation was pushed back from that release. Discussion on [issue #41330](https://golang.org/issue/41330) and in the golang-tools group did not identify any remaining blockers for deprecating GOPATH, so it is now scheduled for Go 1.16, with removal in a future release, as stated in the timeline above.
The [original plan](https://go.dev/blog/modules2019) was to deprecate GOPATH mode in Go 1.13, but we wanted to take extra time to make modules even more robust for as many Go users as possible, so the deprecation was pushed back from that release. Discussion on [issue #41330](https://go.dev/issue/41330) and in the golang-tools group did not identify any remaining blockers for deprecating GOPATH, so it is now scheduled for Go 1.16, with removal in a future release, as stated in the timeline above.
### What if I have more questions about moving from GOPATH development mode to Go modules?
See [golang.org/help](https://golang.org/help/) for a list of resources. If none of those are appropriate, feel free to [file an issue](https://golang.org/issue) here. We want everyone to be successful adopting Go modules.
See [golang.org/help](https://go.dev/help/) for a list of resources. If none of those are appropriate, feel free to [file an issue](https://go.dev/issue) here. We want everyone to be successful adopting Go modules.

@ -10,7 +10,7 @@ This page lists common Go gardening tasks.
If you've been regularly active in the Go community for some time, feel free to ask for Gerrit and/or Github access to modify things.
See http://golang.org/wiki/GerritAccess and http://golang.org/wiki/GithubAccess
See https://go.dev/wiki/GerritAccess and https://go.dev/wiki/GithubAccess
## Gardening Tasks
@ -27,12 +27,12 @@ Look at the [untriaged issues](https://github.com/golang/go/issues?q=is%3Aopen+i
While triaging the bug:
* is it a duplicate? Close it, referencing the dup.
* is it a Question rather than a bug? Reply with something like "For questions about Go, see https://golang.org/wiki/Questions".
* is it a Question rather than a bug? Reply with something like "For questions about Go, see https://go.dev/wiki/Questions".
* is the subject the correct format? It should start with the package path and a colon: "net/http: fix crash in Server during foo operation".
* is it in a subrepo? Leave the milestone as `Unreleased` unless it's a subrepo that goes into a release, like `http2`.
* if it is a regression and you can reproduce it, use `git bisect` to find the bad commit (optional but very helpful).
When the issue has been triaged, add an appropriate label (per https://golang.org/wiki/HandlingIssues) to mark it as such.
When the issue has been triaged, add an appropriate label (per https://go.dev/wiki/HandlingIssues) to mark it as such.
### WaitingForInfo
@ -56,4 +56,4 @@ If a new CL arrives without a test, but could/should have a test, ask if they co
### Pending CLs: run TryBots
If you have access (see https://golang.org/wiki/GerritAccess) to run the TryBots and you see a CL with plausible (and non-malicious) code, kick off the TryBots. (We've never seen malicious code trying to escape our TryBot sandboxes, but that's why it's not automatic yet. Please alert us if you see something.)
If you have access (see https://go.dev/wiki/GerritAccess) to run the TryBots and you see a CL with plausible (and non-malicious) code, kick off the TryBots. (We've never seen malicious code trying to escape our TryBot sandboxes, but that's why it's not automatic yet. Please alert us if you see something.)

@ -5,12 +5,12 @@ This page documents some less well-known (perhaps advanced) tricks for the ` gc
### Use ` syso ` file to embed arbitrary self-contained C code
Basically, you write your assembly language in GNU as(1) format, but make sure
all the interface functions are using Go's ABI (everything on stack, etc., please read [Go 1.2 Assembler Introduction](https://golang.org/doc/asm) for more details).
all the interface functions are using Go's ABI (everything on stack, etc., please read [Go 1.2 Assembler Introduction](https://go.dev/doc/asm) for more details).
The most important step is compiling that file to file.syso (` gcc -c -O3 -o file.syso file.S `),
and put the resulting syso in the package source directory.
And then, suppose your assembly function is named Func, you need one stub
[cmd/asm](https://golang.org/cmd/asm) assembly file to call it:
[cmd/asm](https://pkg.go.dev/cmd/asm) assembly file to call it:
```as
TEXT ·Func(SB),$0-8 // please set the correct parameter size (8) here
JMP Func(SB)
@ -94,7 +94,7 @@ use cgo, at least for now. I (minux) is working on figuring out why they're inco
# Including build information in the executable
The gc toolchain linker, [cmd/link](https://golang.org/cmd/link), provides a `-X` option that may be used to record arbitrary information in a Go string variable at link time. The format is `-X importpath.name=val`. Here `importpath` is the name used in an import statement for the package (or `main` for the main package), `name` is the name of the string variable defined in the package, and `val` is the string you want to set that variable to. When using the go tool, use its `-ldflags` option to pass the `-X` option to the linker.
The gc toolchain linker, [cmd/link](https://pkg.go.dev/cmd/link), provides a `-X` option that may be used to record arbitrary information in a Go string variable at link time. The format is `-X importpath.name=val`. Here `importpath` is the name used in an import statement for the package (or `main` for the main package), `name` is the name of the string variable defined in the package, and `val` is the string you want to set that variable to. When using the go tool, use its `-ldflags` option to pass the `-X` option to the linker.
Let's suppose this file is part of the package `company/buildinfo`:

@ -15,13 +15,13 @@ More definitions and complex cross situations can be found at the [Wikipedia art
## Go tools and gccgo
You will later need to source code to the Go tool, so you might as well uninstall the version you have installed from your package manager to avoid confusion (fully optional tho). Also build & install gccgo targeting host(!, that's right, you need a gcco compiling for not only target but one for host).
* [Installing Go from source](http://golang.org/doc/install/source)
* [Official Go documentation](http://golang.org/doc/install/gccgo)
* [Installing Go from source](https://go.dev/doc/install/source)
* [Official Go documentation](https://go.dev/doc/install/gccgo)
## Build the cross-compiler
### Build
First you have to build your cross-compiling version of GCC. This is complex process as it requires several stages with bootstrapping since there are mutual dependency relations between GCC and libc implementations. A very fine tutorial on how to build a GCC cross-toolchain with eglic (works with glibc too) was written by Jim Blandy and posted at eglibc's mailinglist [patches Cross-building instructions](http://www.eglibc.org/archives/patches/msg00078.html). In the final stage where the full GCC is built, simply configure script with _--enable-languages=c,c++,go_ (see [official Go documentation](http://golang.org/doc/install/gccgo)).
First you have to build your cross-compiling version of GCC. This is complex process as it requires several stages with bootstrapping since there are mutual dependency relations between GCC and libc implementations. A very fine tutorial on how to build a GCC cross-toolchain with eglic (works with glibc too) was written by Jim Blandy and posted at eglibc's mailinglist [patches Cross-building instructions](http://www.eglibc.org/archives/patches/msg00078.html). In the final stage where the full GCC is built, simply configure script with _--enable-languages=c,c++,go_ (see [official Go documentation](https://go.dev/doc/install/gccgo)).
You can use the [ewxb\_gcc\_cross-compiler\_builder](https://github.com/erikw/ewxb_gcc_cross-compiler_builder) script as a starting point. Don't expect that script to work out of the box, but rather as a hint to which steps you're likely to take when building your x-toolchain.
@ -71,7 +71,7 @@ If you haven't compiled a shared object of the go library, _libgo_, for your tar
## Build a cross-gccgo aware version of the Go tool
### Assumptions
* Assuming that you've followed the instructions on [Installing Go from source](http://golang.org/doc/install/source) you should have a checked out version of the go source at _$GOROOT_.
* Assuming that you've followed the instructions on [Installing Go from source](https://go.dev/doc/install/source) you should have a checked out version of the go source at _$GOROOT_.
* Envvar _$GOROOT_ is set.
* The envvars _$GOARCH_ and _$GOOS_ represent the **target** architecture and operating system. Figure these out and set them to these values when you want to cross-compile.

@ -2,7 +2,7 @@
There are two types of Gerrit access described here, with different powers & responsibilities. Only ask for access if you're an active member of the community. New contributors should participate in the Gerrit code review process for some time before requesting access.
(For Github access, see https://golang.org/wiki/GithubAccess)
(For Github access, see https://go.dev/wiki/GithubAccess)
## Becoming an Approver ("approvers")
@ -10,13 +10,13 @@ Approvers can review and submit code changes (CLs), subject to the review rules
Every CL requires _both_ a code review (Code-Review+2) from an approver and the involvement of a second trusted approver (an additional Code-Review+2, or a Trust+1). Requiring two people ensures that code cannot be submitted unilaterally from a single compromised account. If the author of a change is an approver, they can provide the Trust+1 for their own CLs, but not the Code-Review+2. Once a review has a Code-Review+2 and either a second Code-Review+2 or a Trust+1, it can be submitted, by any approver. All these rules are enforced by the Gerrit server.
A Code-Review+2 vote means that you have read the change and are confident that it is correct and appropriate to submit. Typically, you should only Code-Review+2 code in directories or packages that you "own"; the exception is trivial and obviously correct changes. Note that all user-visible new features or changes—new API, new command-line flags, and so on—need to go through the [proposal process](https://golang.org/s/proposal-process). The CLs should reference the specific accepted proposal [in the commit message](https://github.com/golang/go/wiki/CommitMessage) (“For #NNN.”).
A Code-Review+2 vote means that you have read the change and are confident that it is correct and appropriate to submit. Typically, you should only Code-Review+2 code in directories or packages that you "own"; the exception is trivial and obviously correct changes. Note that all user-visible new features or changes—new API, new command-line flags, and so on—need to go through the [proposal process](https://go.dev/s/proposal-process). The CLs should reference the specific accepted proposal [in the commit message](https://github.com/golang/go/wiki/CommitMessage) (“For #NNN.”).
A Trust+1 vote means that you have read the change and are confident that the change does not introduce any sort of security vulnerability or other clearly inappropriate code change. As long as you are sure about that, it's OK to Trust+1 a change even if you don't fully understand all the details of the change.
When a change has the appropriate reviews to be submitted, a Submit button appears in Gerrit (for approvers). You should only submit changes with a Code-Review+2 from the owner of that area (maybe you!).
If you are an approver, you can (and are encouraged to) Trust+1 every change you mail, by changing your [`git mail` alias](https://golang.org/doc/contribute#git-config) to be `git codereview mail -trust`.
If you are an approver, you can (and are encouraged to) Trust+1 every change you mail, by changing your [`git mail` alias](https://go.dev/doc/contribute#git-config) to be `git codereview mail -trust`.
To request approver access, reference https://go-review.googlesource.com/#/admin/groups/1005,members in your bug. See below.
@ -30,10 +30,10 @@ To request trybot access, reference https://go-review.googlesource.com/#/admin/g
# Requesting Access
To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://golang.org/wiki/GerritAccess) and list and state which access you want (its name and group URL), and state your Gerrit email address.
To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://go.dev/wiki/GerritAccess) and list and state which access you want (its name and group URL), and state your Gerrit email address.
Decisions about granting access are made by the Go release team at Google. If your request is declined, it is almost always because you haven't been active enough for them to get a clear enough signal about your work, understanding of project conventions, and so on. Don't lose heart: it can take time to reach that level of familiarity.
## Once you have access
Go help garden! See https://golang.org/wiki/Gardening.
Go help garden! See https://go.dev/wiki/Gardening.

@ -1,8 +1,8 @@
# Github Access
There are two types of Github access described here, with different powers & responsibilities. Only ask for access if you're an active member of the community. New contributors should participate in the Github & Gerrit review process for some time before requesting access. See https://golang.org/wiki/Gardening.
There are two types of Github access described here, with different powers & responsibilities. Only ask for access if you're an active member of the community. New contributors should participate in the Github & Gerrit review process for some time before requesting access. See https://go.dev/wiki/Gardening.
(For Gerrit access, see https://golang.org/wiki/GerritAccess)
(For Gerrit access, see https://go.dev/wiki/GerritAccess)
## Assignees
@ -20,8 +20,8 @@ Please do not edit any field you're not confident about. Feel free to ask for se
## Requesting Access
To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://golang.org/wiki/GithubAccess) and list and state which access you want (its name and group URL).
To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://go.dev/wiki/GithubAccess) and list and state which access you want (its name and group URL).
## Once you have access
Go help garden! See https://golang.org/wiki/Gardening.
Go help garden! See https://go.dev/wiki/Gardening.

@ -1,8 +1,8 @@
This wiki page is maintained by the Go team.
Please [send comments to golang-dev](https://groups.google.com/group/golang-dev)
or [file issues](https://golang.org/issue) instead of making changes directly.
or [file issues](https://go.dev/issue) instead of making changes directly.
Short link: https://golang.org/s/release.
Short link: https://go.dev/s/release.
## Overview
@ -207,13 +207,13 @@ but nothing more.
Minor releases to address non-security problems for Go 1.x stop once Go 1.x+2 is released.
Minor releases to address security problems for Go 1.x stop once Go 1.x+2 is released.
For more about security updates, see the [security policy](https://golang.org/security).
For more about security updates, see the [security policy](https://go.dev/security).
See also the [MinorReleases](https://golang.org/wiki/MinorReleases) wiki page.
See also the [MinorReleases](https://go.dev/wiki/MinorReleases) wiki page.
## Freeze Exceptions
Any exceptions to the freeze must be communicated to and explicitly approved by the Go Release Team before the freeze. If youd like to request an exception, please file an issue in the issue tracker with "[freeze exception]" as a suffix and include "CC @golang/release" ([example](https://golang.org/issue/42747)). We will address any requests on a case-by-case basis with a strong preference for not permitting changes after the freeze.
Any exceptions to the freeze must be communicated to and explicitly approved by the Go Release Team before the freeze. If youd like to request an exception, please file an issue in the issue tracker with "[freeze exception]" as a suffix and include "CC @golang/release" ([example](https://go.dev/issue/42747)). We will address any requests on a case-by-case basis with a strong preference for not permitting changes after the freeze.
## History
@ -226,7 +226,7 @@ we extended Go 1.5's development phase by two months
to shift the cycle to begin and end on February 1 and August 1,
as described above.
The [original proposal](https://golang.org/s/release-old)
The [original proposal](https://go.dev/s/release-old)
did not contain enough detail about the milestones during the freeze,
and over the course of a few releases development work took over
much of the freeze.

2
Go2.md

@ -4,7 +4,7 @@ This page tracks the status of "Go 2".
We are currently seeking feedback on potential designs for improved error handling, error values, and generics:
* [Announcement of Go2 Draft Designs](https://blog.golang.org/go2draft)
* [Announcement of Go2 Draft Designs](https://go.dev/blog/go2draft)
* [Go2 Error Handling, Generics, and Error Values](https://go.googlesource.com/proposal/+/master/design/go2draft.md)
## Bugs

@ -7,11 +7,11 @@ Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google D
Please help categorize the rest of the uncategorized proposals at the bottom.
**Update, June 19, 2019** Based on this feedback we have posted a [proposal for a try builtin](https://golang.org/design/32437-try-builtin), which produced significant feedback on #32437 ([threaded view here](https://swtch.com/try.html)).
**Update, June 19, 2019** Based on this feedback we have posted a [proposal for a try builtin](https://go.dev/design/32437-try-builtin), which produced significant feedback on #32437 ([threaded view here](https://swtch.com/try.html)).
We've disabled comments on that issue until July 1 to give people time to experiment in their own code. We would very much like to see experience reports about using the general try approach in your own code, including trial conversions with [tryhard](https://github.com/griesemer/tryhard). Thanks!
# Experience with the [“try proposal”](https://golang.org/design/32437-try-builtin)
# Experience with the [“try proposal”](https://go.dev/design/32437-try-builtin)
Add to this list:
@ -150,7 +150,7 @@ Concepts that appear repeatedly among the suggestions below.
- Paul Borman, "[Arguments against the Go 2 error handling proposal](https://gist.github.com/pborman/c69e79690d86dfc5c371f096be22930c)", August 2018
- krhubert, "[Error default handler for tests](https://golang.org/issue/32361)", May 2019
- krhubert, "[Error default handler for tests](https://go.dev/issue/32361)", May 2019
- Franz, Implement error handling like an invariant check of a variable. when the value changes, a function is called. this can then be used in other situations too.

@ -29,7 +29,7 @@ As the amount of feedback grows, please feel free to organize this page by speci
- Cosmos Nicolaou "[Inspection of errors in a different address space](https://github.com/cosnicolaou/core/wiki/go-2.0-error-handling-feedback)", September 2018
- Chris Siebenmann, "[Error inspection improves current annoyances but may not go far enough](https://utcc.utoronto.ca/~cks/space/blog/programming/Go2ErrorInspectionViews)", September 2018
- Paul Meyer, “[errors.New?]( - _Your Name_, “[_Title_](#URL)”, August 2018
- Vojtech Vitek "[adopt Cause and Wrap from github.com/pkg/errors](https://golang.org/issue/25675)", May 2018
- Vojtech Vitek "[adopt Cause and Wrap from github.com/pkg/errors](https://go.dev/issue/25675)", May 2018
- Andrew Wilkins "[Programmatic Frame inspection](https://gist.github.com/axw/247b6f69d2da016bb21a5eb1be44e611)", January 2019
- _Carl Johnson_, "[_`As()` and `Is()` are useful for optional interfaces beyond error_](https://gist.github.com/carlmjohnson/d06cd8d10e0aef65f565a55cc57cd986), Feb. 2019
- ques0942, "[xerrors has less feature about trace's detail](https://dev.to/ques0942/xerrors-has-less-feature-about-traces-detail-4861)", Mar. 2019

@ -2,7 +2,7 @@
This page is meant to collect and organize feedback about the Go 2 [contracts (generics) draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md).
A prototype implementation of the syntax can be found in https://golang.org/cl/149638 which may be
A prototype implementation of the syntax can be found in https://go.dev/cl/149638 which may be
patched on tip of the Go repo.
Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here.

@ -1007,12 +1007,12 @@ abishek@Titan:~$ uname -a
Linux Titan 4.9.140 #1 SMP PREEMPT Thu May 23 01:33:05 IST 2019 aarch64 aarch64 aarch64 GNU/Linux
```
Go Version:
Go Version:
```
abishek@Titan:~$ go version
go version go1.12.5 linux/arm64
```
I used the ARMv8 version from [Other Ports](https://golang.org/dl/) section of official downloads.
I used the ARMv8 version from [Other Ports](https://go.dev/dl/) section of official downloads.
I set the following system wide environment variables in /etc/environment.
```
GOROOT="/usr/local/go"

@ -2,9 +2,9 @@ Go is a systems programming language intended to be a general-purpose systems la
An important point to keep in mind is that there are some fundamental differences in the thought processes required to be proficient in the two respective languages. Most formidably, C++'s object model is based on classes and class hierarchies while Go's object model is based on interfaces (and is essentially flat). Consequently, C++ design patterns rarely translate verbatim to Go. To program effectively in Go, one has to consider the _problem_ being solved, not the mechanisms one might use in C++ to solve the problem.
For a more general introduction to Go, see the <a href='http://tour.golang.org/'>Go Tour</a>, <a href='http://golang.org/doc/code.html'>How to Write Go Code</a> and <a href='http://golang.org/doc/effective_go.html'>Effective Go</a>.
For a more general introduction to Go, see the <a href='http://tour.golang.org/'>Go Tour</a>, <a href='https://go.dev/doc/code'>How to Write Go Code</a> and <a href='https://go.dev/doc/effective_go'>Effective Go</a>.
For a detailed description of the Go language, see the <a href='http://golang.org/doc/go_spec.html'>Go spec</a>.
For a detailed description of the Go language, see the <a href='https://go.dev/ref/spec'>Go spec</a>.
<h2>Conceptual Differences</h2>
@ -130,7 +130,7 @@ if result, ok := g(); !ok {
```
Go code uses very few semicolons in practice. Technically, all Go statements are terminated by a semicolon. However, Go treats the end of a non-blank line as a semicolon unless the line is clearly incomplete (the exact rules are in <a href='https://golang.org/ref/spec#Semicolons'>the language specification</a>). A consequence of this is that in some cases Go does not permit you to use a line break. For example, you may not write
Go code uses very few semicolons in practice. Technically, all Go statements are terminated by a semicolon. However, Go treats the end of a non-blank line as a semicolon unless the line is clearly incomplete (the exact rules are in <a href='https://go.dev/ref/spec#Semicolons'>the language specification</a>). A consequence of this is that in some cases Go does not permit you to use a line break. For example, you may not write
```go
func g()
@ -607,7 +607,7 @@ go func(i int) {
}(1000) // Passes argument 1000 to the function literal.
```
Like C++11, but unlike prior versions of C++, Go defines a <a href='http://golang.org/ref/mem'>memory model</a> for unsynchronized accesses to memory. Although Go provides an analogue of `std::mutex` in its ` sync ` package, this is not the normal way to implement inter-thread communication and synchronization in Go programs. Instead, Go threads more typically communicate by message passing, which is a fundamentally different approach from locks and barriers. The Go mantra for this subject is,
Like C++11, but unlike prior versions of C++, Go defines a <a href='https://go.dev/ref/mem'>memory model</a> for unsynchronized accesses to memory. Although Go provides an analogue of `std::mutex` in its ` sync ` package, this is not the normal way to implement inter-thread communication and synchronization in Go programs. Instead, Go threads more typically communicate by message passing, which is a fundamentally different approach from locks and barriers. The Go mantra for this subject is,
> Do not communicate by sharing memory; instead, share memory by communicating.

@ -1,4 +1,4 @@
[`go generate`](https://blog.golang.org/generate) is only useful if you have tools to use it with! Here is an incomplete list of useful tools that generate code.
[`go generate`](https://go.dev/blog/generate) is only useful if you have tools to use it with! Here is an incomplete list of useful tools that generate code.
* [goyacc](https://pkg.go.dev/golang.org/x/tools/cmd/goyacc) Yacc for Go.
* [stringer](https://pkg.go.dev/golang.org/x/tools/cmd/stringer) Implements `fmt.Stringer` interface for enums.

@ -59,7 +59,7 @@ but it's still a good introduction.
A talk by Rob Pike and Andrew Gerrand presented at Google I/O 2011.
It walks through the construction and deployment of a simple web application
and unveils the [Go runtime for App Engine](http://blog.golang.org/2011/05/go-and-google-app-engine.html).
and unveils the [Go runtime for App Engine](https://go.dev/blog/2011/05/go-and-google-app-engine.html).
### Real World Go

@ -1254,7 +1254,7 @@ Certificate Expiry Monitor Controller monitors the expiration of TLS certificate
* [A lot of scripts that earlier were written in Sawzall](http://www.unofficialgoogledatascience.com/2015/12/replacing-sawzall-case-study-in-domain.html)
* [Seesaw load balancer](http://google-opensource.blogspot.nl/2016/01/seesaw-scalable-and-robust-load.html) -[github repo](https://github.com/google/seesaw)
* Other known uses include
* the [Turkey Doodle (2011)](http://blog.golang.org/2011/12/from-zero-to-go-launching-on-google.html),
* the [Turkey Doodle (2011)](https://go.dev/blog/2011/12/from-zero-to-go-launching-on-google.html),
* the [Santa Tracker (2012)](https://www.youtube.com/watch?v=fc25ihfXhbg),
* [writing map/reduce jobs](http://simplystatistics.org/2013/02/15/interview-with-nick-chamandy-statistician-at-google/),
* [Jam With Chrome](http://www.jamwithchrome.com/technology),
@ -1416,7 +1416,7 @@ Certificate Expiry Monitor Controller monitors the expiration of TLS certificate
* [Happy Pancake](http://www.happypancake.com/) - [blog](https://abdullin.com/happypancake/)
* [HashiCorp](https://hashicorp.com/) - [github](https://github.com/hashicorp)
* [HER](https://weareher.com/)
* [Heroku](http://heroku.com/) - [Go blog post](http://blog.golang.org/2011/04/go-at-heroku.html), [news](http://www.theregister.co.uk/2011/05/05/google_go/)
* [Heroku](http://heroku.com/) - [Go blog post](https://go.dev/blog/2011/04/go-at-heroku.html), [news](http://www.theregister.co.uk/2011/05/05/google_go/)
* [Hewlett Packard Enterprise](https://hpe.com) - [Github](https://github.com/HewlettPackard)
* [Home24](http://www.home24.de) - [github](https://github.com/home24)
* [Honeywell](https://www.honeywell.com)
@ -1606,7 +1606,7 @@ Certificate Expiry Monitor Controller monitors the expiration of TLS certificate
* [StackEngine](http://www.stackengine.com) - [blog](http://stackengine.com/golang-with-circleci/)
* [Stack Exchange](http://stackexchange.com/) - [blog](http://blog.stackoverflow.com/2014/11/announcing-bosun-our-new-open-source-monitoring-alerting-system/), [github](https://github.com/bosun-monitor/bosun), [website](http://bosun.org/)
* [Staffjoy](https://www.staffjoy.com) - [blog](https://blog.staffjoy.com/staffjoys-v2-architecture-9d2fcb4015fd)
* [StatHat](http://stathat.com/) - [Go blog post](http://blog.golang.org/2011/12/building-stathat-with-go.html)
* [StatHat](http://stathat.com/) - [Go blog post](https://go.dev/blog/2011/12/building-stathat-with-go.html)
* [Steals.com](http://steals.com) [blog](http://blog.gopheracademy.com/day-15-shopping-with-go)
* [SteelSeries](http://www.steelseries.com) - [blog](http://techblog.steelseries.com/golisp/index.html)
* [StorReduce](http://storreduce.com)

@ -18,7 +18,7 @@ TODO: examples. For now:
The gomote command is a client for the Go builder infrastructure. It's a
remote control for remote Go builder machines.
See https://golang.org/wiki/Gomote
See https://go.dev/wiki/Gomote
Usage:

@ -1,6 +1,6 @@
The Go gopher was designed by [Renee French](https://www.instagram.com/reneefrench/).
The design is licensed under the Creative Commons 3.0 Attributions license.
Read [this article](https://blog.golang.org/gopher) and watch [The Go Gopher A Character Study](https://www.youtube.com/watch?v=4rw_B4yY69k) for more details.
Read [this article](https://go.dev/blog/gopher) and watch [The Go Gopher A Character Study](https://www.youtube.com/watch?v=4rw_B4yY69k) for more details.
## Where can I find more gopher illustrations?

@ -1,4 +1,4 @@
This document explains how we handle issue triage and scheduling in [the Go project's issue tracker](http://golang.org/issue).
This document explains how we handle issue triage and scheduling in [the Go project's issue tracker](https://go.dev/issue).
# Issue States

22
Home.md

@ -1,4 +1,4 @@
Welcome to the Go wiki, a collection of information about the [Go Programming Language](https://golang.org/). [Awesome Go](http://awesome-go.com/) is another great resource for Go programmers, curated by the Go community.
Welcome to the Go wiki, a collection of information about the [Go Programming Language](https://go.dev/). [Awesome Go](http://awesome-go.com/) is another great resource for Go programmers, curated by the Go community.
## Questions about Go
@ -28,9 +28,9 @@ See [Questions](Questions).
## Getting started with Go
- [The Go Tour](http://tour.golang.org) is the best place to start.
- [Effective Go](https://golang.org/doc/effective_go.html) will help you learn how to write idiomatic Go code.
- [Go standard library documentation](https://golang.org/pkg/) to familiarize yourself with the standard library.
- [Use the Go Playground](http://play.golang.org) to test out Go programs in your browser.
- [Effective Go](https://go.dev/doc/effective_go) will help you learn how to write idiomatic Go code.
- [Go standard library documentation](https://pkg.go.dev/) to familiarize yourself with the standard library.
- [Use the Go Playground](https://go.dev/play) to test out Go programs in your browser.
- Still not convinced? Check out this list of [Go Users](GoUsers) and a few of their [Success stories](SuccessStories). We've also assembled a long list of reasons [why you should give Go a try](whygo).
- Read about the companies which have [switched from other languages to Go](https://github.com/golang/go/wiki/FromXToGo).
@ -39,13 +39,13 @@ See [Questions](Questions).
Ready to write some Go code of your own? Here are a few links to help you get started.
- Install and Setup your Environment
- Start here: [Official Installation Documentation](https://golang.org/doc/install)
- If you prefer to install from source, [read this first](https://golang.org/doc/install/source).
- Start here: [Official Installation Documentation](https://go.dev/doc/install)
- If you prefer to install from source, [read this first](https://go.dev/doc/install/source).
- [InstallFromSource](InstallFromSource) - Additional tips on source installs.
- Windows user? [Install and configure Go, Git, and Atom for Windows](https://github.com/abourget/getting-started-with-golang)
- Mac user? [How I start - Go](https://howistart.org/posts/go/1) - A step-by-step guide to installing Go and building your first web service.
- Having installation problems? [InstallTroubleShooting](InstallTroubleShooting)
- Make sure you have your [$GOPATH environment variable set correctly](https://golang.org/doc/install/source#gopath)
- Make sure you have your [$GOPATH environment variable set correctly](https://go.dev/doc/install/source#gopath)
- If you need additional tips on using [$GOPATH, go here](GOPATH).
- [MultipleGoRoots](MultipleGoRoots) - More advanced information on working with multiple go installations and the `$GOROOT` variable.
- [Go IDEs and Editors](IDEsAndTextEditorPlugins) - Information on how to use your favorite editor with Go.
@ -116,8 +116,8 @@ Here are some of the places where you can find Gophers online. To get a sense of
## Using the Go Toolchain
- Start with the standard documentation for the `go` command [available here](https://golang.org/cmd/go/)
- Start here to learn about [vendoring](https://golang.org/cmd/go/#hdr-Vendor_Directories).
- Start with the standard documentation for the `go` command [available here](https://pkg.go.dev/cmd/go/)
- Start here to learn about [vendoring](https://pkg.go.dev/cmd/go/#hdr-Vendor_Directories).
- See also [PackageManagementTools](PackageManagementTools) for package management tools.
- [Cross Compilation](https://rakyll.org/cross-compilation/)
- Shared libraries and Go (buildmode)
@ -197,7 +197,7 @@ If you're looking for services that support Go, here's a list to get you started
## Troubleshooting Go Programs in Production
- Understand the performance of your Go apps using the [pprof package](http://blog.golang.org/profiling-go-programs)
- Understand the performance of your Go apps using the [pprof package](https://go.dev/blog/profiling-go-programs)
- Heap Dumps
- [heapdump13](heapdump13)
- [heapdump14](heapdump14)
@ -205,7 +205,7 @@ If you're looking for services that support Go, here's a list to get you started
## Contributing to the Go Project
- Start by reading the [Go Contribution Guidelines](https://golang.org/doc/contribute.html)
- Start by reading the [Go Contribution Guidelines](https://go.dev/doc/contribute)
- If you'd like to propose a change to the Go project, start by reading the [Go Change Proposal Process](https://github.com/golang/proposal)
- An archive of [design documents is also available](DesignDocuments)
- Go releases happen at ~6-month intervals. [See here for more information](Go-Release-Cycle)

@ -54,7 +54,7 @@ The best way to get help is to show
- If you are posting a large amount of output, you may consider using a pastebin or gist service.
- When posting code samples, use the [Go playground][2] (unless it is unavailable in your country).
[0]: https://blog.golang.org/error-handling-and-go
[1]: https://blog.golang.org/race-detector
[2]: https://play.golang.org
[0]: https://go.dev/blog/error-handling-and-go
[1]: https://go.dev/blog/race-detector
[2]: https://go.dev/play
[3]: https://github.com/golang/go/wiki/questions

@ -19,7 +19,7 @@ What are you trying to accomplish?<br>
What is the context of the problem?<br>
What are the requirements for the solution?<br>
What are the context-specific constraints/properties?<br>
Your compilable and runnable example on <a href='http://play.golang.org'>play.golang.org</a><br>
Your compilable and runnable example on <a href='https://go.dev/play'>play.golang.org</a><br>
<br>
Other notes about the situation (production/school/playing/learning)</blockquote>
@ -59,7 +59,7 @@ Now the asker will provide an example:<br>
</code></pre>
But it just panics.</blockquote>
Now you've got some code that even doesn't compile. This means you need to copy paste it somewhere and fix the mistakes. Putting it on <a href='http://play.golang.org'>play.golang.org</a> makes it easier to see the problem (e.g. <a href='http://play.golang.org/p/fCxBlL9V4Y'>play.golang.org/p/fCxBlL9V4Y</a>).<br>
Now you've got some code that even doesn't compile. This means you need to copy paste it somewhere and fix the mistakes. Putting it on <a href='https://go.dev/play'>play.golang.org</a> makes it easier to see the problem (e.g. <a href='https://go.dev/play/p/fCxBlL9V4Y'>play.golang.org/p/fCxBlL9V4Y</a>).<br>
<br>
<i>The fix is simple; just use <code>SetMapIndex</code> instead.</i> Of course that may not be the full story. The asker now comes back with another problem:<br>
<br>
@ -91,7 +91,7 @@ The initial question could have been:<br>
<br>
<blockquote>How do I use the reflect <code>Set</code> method with <code>MapIndex</code>?<br>
<br>
I'm trying to set a value on a generic map for a set package. But it just gives a panic when I try to do that. <a href='http://play.golang.org/p/fCxBlL9V4Y'>play.golang.org/p/fCxBlL9V4Y</a><br>
I'm trying to set a value on a generic map for a set package. But it just gives a panic when I try to do that. <a href='https://go.dev/play/p/fCxBlL9V4Y'>play.golang.org/p/fCxBlL9V4Y</a><br>
<br>
I use the set package in a program that goes over multiple sequences and find all the common elements in a sequence. The sequence elements could be nucleotides or proteins. The program needs to be able to deal with data-sizes upto 1GB.<br>
<br>

@ -1,6 +1,6 @@
# Editors and IDEs for Go
## Popular
The [Go Developer Survey](https://blog.golang.org/survey2019-results) showed these as the most popular editors.
The [Go Developer Survey](https://go.dev/blog/survey2019-results) showed these as the most popular editors.
* **[Visual Studio Code](https://code.visualstudio.com/)**: Free & open source IDE by Microsoft. Visual Studio Code supports Go syntax highlighting out of the box. Additional features are provided by the official [vscode-go](https://github.com/golang/vscode-go) plugin.
* **[GoLand](https://www.jetbrains.com/go/)**: JetBrains's cross-platform, [fully featured](https://www.jetbrains.com/go/features/) Go IDE (commercial). Free for students, teachers, open-source developers, and user-groups ([see details](https://www.jetbrains.com/go/buy/#edition=discounts)). Also available as part of IntelliJ IDEA Ultimate.

@ -1,6 +1,6 @@
# Introduction
This is a companion to http://golang.org/doc/install/source providing additional instructions for various operating systems.
This is a companion to https://go.dev/doc/install/source providing additional instructions for various operating systems.
## Install C tools

@ -16,7 +16,7 @@ There are many times in which you may install Go (either from source or from a b
To start out with, check the following first:
* GOROOT
* This should _only_ be set if you used a binary distribution and it's not installed in the default location.
* [GOPATH](http://golang.org/cmd/go#GOPATH_environment_variable)
* [GOPATH](https://pkg.go.dev/cmd/go#GOPATH_environment_variable)
* This should be set to the directory under which you want your source (and third party packages).
* This can also be set to a list of absolute paths separated by : (or ; on Windows).
* Note that ~/some/path is not absolute and will probably not work the way you expect (try $HOME/some/path instead).

@ -4,15 +4,15 @@ This page describes the background for build errors like `invalid flag in #cgo C
[CVE-2018-6574](https://nvd.nist.gov/vuln/detail/CVE-2018-6574) described a potential security violation in the go tool: running `go get` downloads and builds Go code from the Internet, Go code that uses cgo can specify options to pass to the compiler, so careful use of `-fplugin` can cause `go get` to execute arbitrary code. While it is difficult to block every possible way that the compiler might be attacked, we have chosen to block the obvious ones.
As described at [issue 23672](https://golang.org/issue/23672), this is done by using a safelist of compiler/linker options that are permitted during `go get`, `go build`, and friends. When cgo code tries to use to pass an option that is not on the safelist, the go tool will report an error `invalid flag in #cgo CFLAGS` (or `#cgo LDFLAGS`, `pkg-config --cflags`, `pkg-config --ldflags`, and so forth).
As described at [issue 23672](https://go.dev/issue/23672), this is done by using a safelist of compiler/linker options that are permitted during `go get`, `go build`, and friends. When cgo code tries to use to pass an option that is not on the safelist, the go tool will report an error `invalid flag in #cgo CFLAGS` (or `#cgo LDFLAGS`, `pkg-config --cflags`, `pkg-config --ldflags`, and so forth).
This safelist is new in releases 1.8.7, 1.9.4, and 1.10, and all subsequent releases.
## What can I do?
If this happens to you, and the option is benign, you should do two things:
1. Set the environment variable `CGO_CFLAGS_ALLOW` (or `CGO_LDFLAGS_ALLOW`, `CGO_CXXFLAGS_ALLOW`, and so forth) to a [regexp](https://golang.org/pkg/regexp/) that matches the option.
2. [File a bug](https://golang.org/issue/new) requesting that the option be added to the safelist. Be sure to include the complete error message and, if possible, a description of the code you are building.
1. Set the environment variable `CGO_CFLAGS_ALLOW` (or `CGO_LDFLAGS_ALLOW`, `CGO_CXXFLAGS_ALLOW`, and so forth) to a [regexp](https://pkg.go.dev/regexp/) that matches the option.
2. [File a bug](https://go.dev/issue/new) requesting that the option be added to the safelist. Be sure to include the complete error message and, if possible, a description of the code you are building.
## Why not use an unsafe list?

@ -2,17 +2,17 @@
Go's ` iota ` identifier is used in ` const ` declarations to simplify definitions of incrementing numbers. Because it can be used in expressions, it provides a generality beyond that of simple enumerations.
The value of iota is reset to 0 whenever the reserved word ` const ` appears in the source (i.e. each const block) and incremented by one after each [ConstSpec](https://golang.org/ref/spec#ConstSpec) e.g. each Line. This can be combined with the constant shorthand (leaving out everything after the constant name) to very concisely define related constants.
The value of iota is reset to 0 whenever the reserved word ` const ` appears in the source (i.e. each const block) and incremented by one after each [ConstSpec](https://go.dev/ref/spec#ConstSpec) e.g. each Line. This can be combined with the constant shorthand (leaving out everything after the constant name) to very concisely define related constants.
Iota: http://golang.org/doc/go_spec.html#Iota
Iota: https://go.dev/ref/spec#Iota
Constant declarations: http://golang.org/doc/go_spec.html#Constant_declarations
Constant declarations: https://go.dev/ref/spec#Constant_declarations
# Examples
The official spec has two great examples:
http://golang.org/doc/go_spec.html#Iota
https://go.dev/ref/spec#Iota
Here's one from Effective Go:

@ -1,4 +1,4 @@
In addition to the resources available [at golang.org](http://golang.org/doc/#learning) there are a range of community-driven initiatives:
In addition to the resources available [at golang.org](https://go.dev/doc/#learning) there are a range of community-driven initiatives:
* [Go Mastery](https://qvault.io/go-mastery-course/) - Code in the browser exercises with answer checking
* [Essential Go](https://www.programming-books.io/essential/go/) -- a free book about Go programming language.

@ -1,44 +1,44 @@
This page links to resources for learning about concurrency in Go. The items are presented in order, from beginner material to advanced topics.
## Beginner
- Read [Effective Go: Concurrency](https://golang.org/doc/effective_go.html#concurrency)
- Read [Effective Go: Concurrency](https://go.dev/doc/effective_go#concurrency)
- Watch [Simulating a real-world system in Go](https://www.dotconferences.com/2017/11/sameer-ajmani-simulating-a-real-world-system-in-go)
- Study [The Go Programming Language Specification](https://golang.org/ref/spec), especially
- [Go statements](https://golang.org/ref/spec#Go_statements)
- [Channel types](https://golang.org/ref/spec#Channel_types)
- [Send statements](https://golang.org/ref/spec#Send_statements)
- [Receive operator](https://golang.org/ref/spec#Receive_operator)
- [Select statements](https://golang.org/ref/spec#Select_statements)
- Study [The Go Programming Language Specification](https://go.dev/ref/spec), especially
- [Go statements](https://go.dev/ref/spec#Go_statements)
- [Channel types](https://go.dev/ref/spec#Channel_types)
- [Send statements](https://go.dev/ref/spec#Send_statements)
- [Receive operator](https://go.dev/ref/spec#Receive_operator)
- [Select statements](https://go.dev/ref/spec#Select_statements)
- Code [A Tour of Go: Concurrency](http://tour.golang.org/concurrency/1)
- Read the [Frequently Asked Questions (FAQ)](http://golang.org/doc/faq), especially
- [Why build concurrency on the ideas of CSP?](http://golang.org/doc/faq#csp)
- [Why goroutines instead of threads?](http://golang.org/doc/faq#goroutines)
- [Why are map operations not defined to be atomic?](http://golang.org/doc/faq#atomic_maps)
- [What operations are atomic? What about mutexes?](http://golang.org/doc/faq#What_operations_are_atomic_What_about_mutexes)
- [Why doesn't my program run faster with more CPUs?](https://golang.org/doc/faq#parallel_slow)
- [How can I control the number of CPUs?](https://golang.org/doc/faq#number_cpus)
- [What happens with closures running as goroutines?](http://golang.org/doc/faq#closures_and_goroutines)
- Read the [Frequently Asked Questions (FAQ)](https://go.dev/doc/faq), especially
- [Why build concurrency on the ideas of CSP?](https://go.dev/doc/faq#csp)
- [Why goroutines instead of threads?](https://go.dev/doc/faq#goroutines)
- [Why are map operations not defined to be atomic?](https://go.dev/doc/faq#atomic_maps)
- [What operations are atomic? What about mutexes?](https://go.dev/doc/faq#What_operations_are_atomic_What_about_mutexes)
- [Why doesn't my program run faster with more CPUs?](https://go.dev/doc/faq#parallel_slow)
- [How can I control the number of CPUs?](https://go.dev/doc/faq#number_cpus)
- [What happens with closures running as goroutines?](https://go.dev/doc/faq#closures_and_goroutines)
## Intermediate
- Study [Go by Example](https://gobyexample.com) from [goroutines](https://gobyexample.com/goroutines) through [stateful goroutines](https://gobyexample.com/stateful-goroutines)
- Watch [Go Concurrency Patterns](https://talks.golang.org/2012/concurrency.slide#1)
- Watch [A Practical Guide to Preventing Deadlocks and Leaks in Go](https://www.youtube.com/watch?v=3EW1hZ8DVyw)
- Read [Share Memory By Communicating](http://blog.golang.org/share-memory-by-communicating) and do the [codewalk](http://golang.org/doc/codewalk/sharemem/)
- Read [Go Concurrency Patterns: Timing out, moving on](http://blog.golang.org/go-concurrency-patterns-timing-out-and)
- Read [Share Memory By Communicating](https://go.dev/blog/share-memory-by-communicating) and do the [codewalk](https://go.dev/doc/codewalk/sharemem/)
- Read [Go Concurrency Patterns: Timing out, moving on](https://go.dev/blog/go-concurrency-patterns-timing-out-and)
- Watch [Concurrency is not Parallelism](http://talks.golang.org/2012/waza.slide#1)
- Read [Go Concurrency Patterns: Pipelines and Cancellation](http://blog.golang.org/pipelines)
- Read [Go Concurrency Patterns: Pipelines and Cancellation](https://go.dev/blog/pipelines)
- Read [Rethinking Classical Concurrency Patterns](https://github.com/golang/go/wiki/Go-Community-Slides#rethinking-classical-concurrency-patterns)
- Study [Package sync](https://golang.org/pkg/sync/)
- Read [Introducing the Go Race Detector](http://blog.golang.org/race-detector)
- Study [Package sync](https://pkg.go.dev/sync/)
- Read [Introducing the Go Race Detector](https://go.dev/blog/race-detector)
- Watch [Go: code that grows with grace](http://talks.golang.org/2012/chat.slide#1)
- Read [Mutexes and Semaphores Demystified](http://www.barrgroup.com/Embedded-Systems/How-To/RTOS-Mutex-Semaphore)
## Advanced
- Watch [Advanced Go Concurrency Patterns](http://blog.golang.org/advanced-go-concurrency-patterns)
- Watch [Advanced Go Concurrency Patterns](https://go.dev/blog/advanced-go-concurrency-patterns)
- Read [Advanced Go Concurrency Patterns](http://talks.golang.org/2013/advconc.slide#1)
- Read [Go Concurrency Patterns: Context](http://blog.golang.org/context)
- Study [The Go Memory Model](https://golang.org/ref/mem)
- Study [Package atomic](https://golang.org/pkg/sync/atomic/)
- Read [Go Concurrency Patterns: Context](https://go.dev/blog/context)
- Study [The Go Memory Model](https://go.dev/ref/mem)
- Study [Package atomic](https://pkg.go.dev/sync/atomic/)
- Read [Principles of Designing Go APIs with Channels](https://inconshreveable.com/07-08-2014/principles-of-designing-go-apis-with-channels/)
- Read [Advanced Go Concurrency Primitives](https://encore.dev/blog/advanced-go-concurrency)
- Watch [The Scheduler Saga](https://www.youtube.com/watch?v=YHRO5WQGh0k)

@ -2,22 +2,22 @@ This page links to resources about error handling in Go.
## Getting Started
- Read [Effective Go: Errors](https://golang.org/doc/effective_go.html#errors)
- Read [Effective Go: Errors](https://go.dev/doc/effective_go#errors)
- Code [A Tour of Go: Errors](http://tour.golang.org/methods/19) and do the [exercise](http://tour.golang.org/methods/20)
- Study [The Go Programming Language Specification: Errors](http://golang.org/ref/spec#Errors)
- Study [Package errors](http://golang.org/pkg/errors/)
- Study [func fmt.Errorf](https://golang.org/pkg/fmt/#Errorf)
- Study [The Go Programming Language Specification: Errors](https://go.dev/ref/spec#Errors)
- Study [Package errors](https://pkg.go.dev/errors/)
- Study [func fmt.Errorf](https://pkg.go.dev/fmt/#Errorf)
## Standard Practice
- Read [Why does Go not have exceptions?](http://golang.org/doc/faq#exceptions)
- Read [Error handling and Go](http://blog.golang.org/error-handling-and-go)
- Read [Why does Go not have exceptions?](https://go.dev/doc/faq#exceptions)
- Read [Error handling and Go](https://go.dev/blog/error-handling-and-go)
- Read [Go by Example: Errors](https://gobyexample.com/errors)
- Read [Errors are values](http://blog.golang.org/errors-are-values)
- Read [Working with Errors in Go 1.13](https://blog.golang.org/go1.13-errors)
- Read [Errors are values](https://go.dev/blog/errors-are-values)
- Read [Working with Errors in Go 1.13](https://go.dev/blog/go1.13-errors)
- Read [golang/go/wiki: Errors](Errors)
## Advanced Topics
- Read [Why is my nil error value not equal to nil?](http://golang.org/doc/faq#nil_error)
- Read [Defer, Panic, and Recover](http://blog.golang.org/defer-panic-and-recover)
- Read [Why is my nil error value not equal to nil?](https://go.dev/doc/faq#nil_error)
- Read [Defer, Panic, and Recover](https://go.dev/blog/defer-panic-and-recover)

@ -2,7 +2,7 @@ This page links to resources for learning about server programming in Go - both
## Getting Started
- Read [Writing Web Applications with the Go standard library](http://golang.org/doc/articles/wiki/)
- Read [Writing Web Applications with the Go standard library](https://go.dev/doc/articles/wiki/)
- Read [Build a Web Application With Go](https://astaxie.gitbooks.io/build-web-application-with-golang/content/) from the author of the [BeeGo web framework](http://beego.me/)
- Read [Webapps in Go the anti textbook](https://github.com/thewhitetulip/web-dev-golang-anti-textbook)
- Read [Building Web Applications in Go](https://codegangsta.gitbooks.io/building-web-apps-with-go/content/) from the author of the [Negroni](https://github.com/codegangsta/negroni) and [Martini](http://martini.codegangsta.io/) webserver toolkits. First learn the absolute basics before going to this book.
@ -22,7 +22,7 @@ A topic you will see discussed frequently is "middleware". If you're not familia
## Toolkits and Frameworks
Before you decide to adopt a third party web framework or toolkit, keep in mind that the Go standard library provides all of the tools you need to build a sophisticated, modern web application. Keeping with Go's preference for simplicity and composability over complexity and magic, we suggest you [see how far the standard library can take you](http://golang.org/doc/articles/wiki/).
Before you decide to adopt a third party web framework or toolkit, keep in mind that the Go standard library provides all of the tools you need to build a sophisticated, modern web application. Keeping with Go's preference for simplicity and composability over complexity and magic, we suggest you [see how far the standard library can take you](https://go.dev/doc/articles/wiki/).
If you decide you need a bit more infrastructure, start by looking at some of the toolkits and libraries available.
@ -53,39 +53,39 @@ If you decide you need a bit more infrastructure, start by looking at some of th
## Communication
- [Package net/http](http://golang.org/pkg/net/http) provides HTTP client and server implementations.
- [Package encoding/json](http://golang.org/pkg/encoding/json) implements encoding and decoding of JSON objects as defined in RFC 4627.
- [Package net/rpc](http://golang.org/pkg/net/rpc) provides access to the exported methods of an object across a network or other I/O connection.
- [Package os/exec](http://golang.org/pkg/os/exec) runs external commands.
- [Package net/http](https://pkg.go.dev/net/http) provides HTTP client and server implementations.
- [Package encoding/json](https://pkg.go.dev/encoding/json) implements encoding and decoding of JSON objects as defined in RFC 4627.
- [Package net/rpc](https://pkg.go.dev/net/rpc) provides access to the exported methods of an object across a network or other I/O connection.
- [Package os/exec](https://pkg.go.dev/os/exec) runs external commands.
## Presentation
- [Package text/template](http://golang.org/pkg/text/template) implements data-driven templates for generating textual output.
- [Package html/template](http://golang.org/pkg/html/template) implements data-driven templates for generating HTML output safe against code injection.
- [Package text/template](https://pkg.go.dev/text/template) implements data-driven templates for generating textual output.
- [Package html/template](https://pkg.go.dev/html/template) implements data-driven templates for generating HTML output safe against code injection.
## Profiling and Performance
- Read [Profiling Go Programs](http://blog.golang.org/profiling-go-programs)
- Read [Arrays, slices (and strings): The mechanics of 'append'](http://blog.golang.org/slices)
- Read the [Frequently Asked Questions (FAQ)](http://golang.org/doc/faq), especially
- [Why does Go perform badly on benchmark X?](http://golang.org/doc/faq#Why_does_Go_perform_badly_on_benchmark_x)
- [Why do garbage collection? Won't it be too expensive?](http://golang.org/doc/faq#garbage_collection)
- [Package bufio](http://golang.org/pkg/bufio) implements buffered I/O.
- [Package runtime/pprof](http://golang.org/pkg/runtime/pprof) writes runtime profiling data in the format expected by the pprof visualization tool.
- [Package net/http/pprof](http://golang.org/pkg/net/http/pprof) serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
- Read [Profiling Go Programs](https://go.dev/blog/profiling-go-programs)
- Read [Arrays, slices (and strings): The mechanics of 'append'](https://go.dev/blog/slices)
- Read the [Frequently Asked Questions (FAQ)](https://go.dev/doc/faq), especially
- [Why does Go perform badly on benchmark X?](https://go.dev/doc/faq#Why_does_Go_perform_badly_on_benchmark_x)
- [Why do garbage collection? Won't it be too expensive?](https://go.dev/doc/faq#garbage_collection)
- [Package bufio](https://pkg.go.dev/bufio) implements buffered I/O.
- [Package runtime/pprof](https://pkg.go.dev/runtime/pprof) writes runtime profiling data in the format expected by the pprof visualization tool.
- [Package net/http/pprof](https://pkg.go.dev/net/http/pprof) serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
## Tracing, Monitoring, Logging, and Configuration
- [Package expvar](http://golang.org/pkg/expvar) provides a standardized interface to public variables, such as operation counters in servers.
- [Package flag](http://golang.org/pkg/flag) implements command-line flag parsing.
- [Package log](http://golang.org/pkg/log) implements a simple logging package.
- [Package expvar](https://pkg.go.dev/expvar) provides a standardized interface to public variables, such as operation counters in servers.
- [Package flag](https://pkg.go.dev/flag) implements command-line flag parsing.
- [Package log](https://pkg.go.dev/log) implements a simple logging package.
- [Package glog](https://github.com/golang/glog) implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
## Storage
- [Package os](http://golang.org/pkg/os) provides a platform-independent interface to operating system functionality.
- [Package path/filepath](http://golang.org/pkg/path/filepath) implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths.
- [Package database/sql](http://golang.org/pkg/database/sql) provides a generic interface around SQL (or SQL-like) databases.
- [Package os](https://pkg.go.dev/os) provides a platform-independent interface to operating system functionality.
- [Package path/filepath](https://pkg.go.dev/path/filepath) implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths.
- [Package database/sql](https://pkg.go.dev/database/sql) provides a generic interface around SQL (or SQL-like) databases.
## Platforms

@ -1,9 +1,9 @@
This page links to resources about testing in Go.
- Read [How to Write Go Code](http://golang.org/doc/code.html), especially [Testing](https://golang.org/doc/code.html#Testing)
- Study [Package testing](http://golang.org/pkg/testing)
- Read [Why does Go not have assertions?](http://golang.org/doc/faq#assertions)
- Read [Where is my favorite helper function for testing?](http://golang.org/doc/faq#testing_framework)
- Read [How to Write Go Code](https://go.dev/doc/code), especially [Testing](https://go.dev/doc/code#Testing)
- Study [Package testing](https://pkg.go.dev/testing)
- Read [Why does Go not have assertions?](https://go.dev/doc/faq#assertions)
- Read [Where is my favorite helper function for testing?](https://go.dev/doc/faq#testing_framework)
- Watch [Testing Techniques](https://talks.golang.org/2014/testing.slide#1)
- Read [TableDrivenTests](TableDrivenTests)
- Read [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)
- Read [Using Subtests and Sub-benchmarks](https://go.dev/blog/subtests)

@ -4,7 +4,7 @@ If you reached this page because of a message like this printed by a Go program:
```
runtime: note: your Linux kernel may be buggy
runtime: note: see https://golang.org/wiki/LinuxKernelSignalVectorBug
runtime: note: see https://go.dev/wiki/LinuxKernelSignalVectorBug
runtime: note: mlock workaround for kernel bug failed with errno <number>
```
@ -256,8 +256,8 @@ The bug is still present, and memory corruption may still occur.
# Questions?
Ask on the mailing list golang-nuts@googlegroups.com, or on any Go forum as described at [Questions](https://golang.org/wiki/Questions).
Ask on the mailing list golang-nuts@googlegroups.com, or on any Go forum as described at [Questions](https://go.dev/wiki/Questions).
# Details
To see more details on how the bug affects Go programs and how it was detected and understood, see [#35777](https://golang.org/issue/35777) and [#35326](https://golang.org/issue/35326).
To see more details on how the bug affects Go programs and how it was detected and understood, see [#35777](https://go.dev/issue/35777) and [#35326](https://go.dev/issue/35326).

@ -18,7 +18,7 @@ then you are running a program built with an old version of Go (Go 1.10 or befor
# Details
Programs built with Go 1.10 or before use a way of issuing system calls that is no longer supported by the kernel on macOS 12 Monterey. In [Go 1.11](https://golang.org/doc/go1.11#runtime) and later, system calls are issued via `libSystem.dylib`, which is supported by the OS.
Programs built with Go 1.10 or before use a way of issuing system calls that is no longer supported by the kernel on macOS 12 Monterey. In [Go 1.11](https://go.dev/doc/go1.11#runtime) and later, system calls are issued via `libSystem.dylib`, which is supported by the OS.
# What to do

@ -15,12 +15,12 @@ Method sets of a particular type or value are of particular importance in Go, wh
# The Spec
There are two important clauses in the [Go Language Specification](http://golang.org/doc/go_spec.html) about method sets. They are as follows:
There are two important clauses in the [Go Language Specification](https://go.dev/ref/spec) about method sets. They are as follows:
[Method Sets](http://golang.org/doc/go_spec.html#Method_sets):
[Method Sets](https://go.dev/ref/spec#Method_sets):
A type may have a method set associated with it. The method set of an interface type is its interface. The method set of any other named ` type T ` consists of all methods with receiver type ` T `. The method set of the corresponding pointer type ` *T ` is the set of all methods with receiver ` *T ` or ` T ` (that is, it also contains the method set of ` T `). Any other type has an empty method set. In a method set, each method must have a unique name.
[Calls](http://golang.org/doc/go_spec.html#Calls):
[Calls](https://go.dev/ref/spec#Calls):
A method call ` x.m() ` is valid if the method set of (the type of) ` x ` contains ` m ` and the argument list can be assigned to the parameter list of ` m `. If ` x ` is addressable and ` &x `'s method set contains ` m `, ` x.m() ` is shorthand for ` (&x).m() `.
# Usage

@ -8,7 +8,7 @@ Kernel version 2.6.23 or later. [_This depends on architecture though, we need t
We don't support CentOS 5. The kernel is too old (2.6.18).
For little-endian MIPS64, kernel version [4.1 is known to fail, and 4.8 works](https://golang.org/issue/16848).
For little-endian MIPS64, kernel version [4.1 is known to fail, and 4.8 works](https://go.dev/issue/16848).
If you are using tinyconfig (e.g. make tinyconfig) for embedded systems, you will also almost certainly enable printk in the kernel as well as a console; we will not include those generic options here. For Go, you must also enable CONFIG_FUTEX.
@ -26,9 +26,9 @@ macOS Sierra 10.12 or higher requires Go 1.7.1 or above.
macOS Monterey 12 or higher requires Go 1.11 or above.
Go 1.15 and later only support macOS Sierra 10.12 or newer; see https://golang.org/doc/go1.15#darwin.
Go 1.15 and later only support macOS Sierra 10.12 or newer; see https://go.dev/doc/go1.15#darwin.
Go 1.17 and later only support macOS High Sierra 10.13 or newer; see https://golang.org/doc/go1.17#darwin.
Go 1.17 and later only support macOS High Sierra 10.13 or newer; see https://go.dev/doc/go1.17#darwin.
We only have builders for 10.12, 10.14, 10.15, and 11.0 as of 2021-09-28.
@ -55,7 +55,7 @@ There are known NetBSD bugs (including kernel crashes) up to the current NetBSD
Go 1.13: pepper_39 or newer.
Go 1.14 and later: [unsupported](https://golang.org/doc/go1.14#nacl).
Go 1.14 and later: [unsupported](https://go.dev/doc/go1.14#nacl).
### [Solaris](Solaris)
@ -92,14 +92,14 @@ See section [Microarchitecture support](#microarchitecture-support) for hints on
### 386
See https://golang.org/doc/install/source#environment
See https://go.dev/doc/install/source#environment
* GO386=sse2 (default): Any processor with at least SSE2
* GO386=softfloat: All Pentium MMX or later processors (uses software floating point emulation)
### arm
See https://golang.org/doc/install/source#environment
See https://go.dev/doc/install/source#environment
* GOARM=5: use software floating point; when CPU doesn't have VFP co-processor
* GOARM=6: use VFPv1 only; default if cross compiling; usually ARM11 or better cores (VFPv2 or better is also supported)

@ -45,7 +45,7 @@ git codereview mail
Gerrit is configured to only allow release managers to submit to release branches, but the code review process is otherwise the usual.
At this time, it's not possible to make a cherry-pick CL by sending a [[Pull Request|GerritBot]]. Only Gerrit is supported. See [golang.org/issue/30037](https://golang.org/issue/30037).
At this time, it's not possible to make a cherry-pick CL by sending a [[Pull Request|GerritBot]]. Only Gerrit is supported. See [golang.org/issue/30037](https://go.dev/issue/30037).
### Cherry-pick CLs for vendored golang.org/x packages
@ -66,7 +66,7 @@ The Go standard library includes some generated files whose source of truth is o
The commit message should include "Fixes #nnn" to close the backport issue.
(As of Go 1.16, the golang.org/x branch name is always `internal-branch.go1.x-vendor`. In Go 1.15, the name of the golang.org/x branch is `release-branch.go1.x` or `release-branch.go1.x-bundle` in [special cases](https://golang.org/cl/305489).)
(As of Go 1.16, the golang.org/x branch name is always `internal-branch.go1.x-vendor`. In Go 1.15, the name of the golang.org/x branch is `release-branch.go1.x` or `release-branch.go1.x-bundle` in [special cases](https://go.dev/cl/305489).)
## Security releases

@ -20,12 +20,12 @@ these strategies.
## Tools
You need to have [Go 1.16 or above](https://golang.org/dl/) to install mobile tools.
You need to have [Go 1.16 or above](https://go.dev/dl/) to install mobile tools.
Go Mobile introduces a tool, [`gomobile`](https://golang.org/x/mobile/cmd/gomobile),
to help you with the build and the binding process.
`gomobile` also supports [Go Modules](https://golang.org/ref/mod), e.g. using
`gomobile` also supports [Go Modules](https://go.dev/ref/mod), e.g. using
```
$ gomobile bind -v -o android.aar -target=android ./package

@ -1,18 +1,18 @@
# Go Modules
This wiki page serves as a usage and troubleshooting guide.
* For tutorial blog posts, see [Using Go Modules](https://blog.golang.org/using-go-modules).
* For a technical reference, see the [Go Modules Reference](https://golang.org/ref/mod) (under development).
* For tutorial blog posts, see [Using Go Modules](https://go.dev/blog/using-go-modules).
* For a technical reference, see the [Go Modules Reference](https://go.dev/ref/mod) (under development).
Go has included support for versioned modules as proposed [here](https://golang.org/design/24301-versioned-go) since 1.11. The initial prototype `vgo` was [announced](https://research.swtch.com/vgo) in February 2018. In July 2018, versioned modules [landed](https://groups.google.com/d/msg/golang-dev/a5PqQuBljF4/61QK4JdtBgAJ) in the main Go repository.
Go has included support for versioned modules as proposed [here](https://go.dev/design/24301-versioned-go) since 1.11. The initial prototype `vgo` was [announced](https://research.swtch.com/vgo) in February 2018. In July 2018, versioned modules [landed](https://groups.google.com/d/msg/golang-dev/a5PqQuBljF4/61QK4JdtBgAJ) in the main Go repository.
Since [Go 1.14](https://golang.org/doc/go1.14), module support is considered ready for production use, and all users are encouraged to migrate to modules from other dependency management systems. If you are unable to migrate due to a problem in the Go toolchain, please ensure that the problem has an [open issue](#github-issues) filed. (If the issue is not on the Go1.16 milestone, please comment on why it prevents you from migrating so it can be prioritized appropriately). You can also provide an [experience report](https://github.com/golang/go/wiki/ExperienceReports) for more detailed feedback.
Since [Go 1.14](https://go.dev/doc/go1.14), module support is considered ready for production use, and all users are encouraged to migrate to modules from other dependency management systems. If you are unable to migrate due to a problem in the Go toolchain, please ensure that the problem has an [open issue](#github-issues) filed. (If the issue is not on the Go1.16 milestone, please comment on why it prevents you from migrating so it can be prioritized appropriately). You can also provide an [experience report](https://github.com/golang/go/wiki/ExperienceReports) for more detailed feedback.
## Recent Changes
### Go 1.16
See the [Go 1.16 release notes](https://golang.org/doc/go1.16#go-command) for details.
See the [Go 1.16 release notes](https://go.dev/doc/go1.16#go-command) for details.
* Module mode (`GO111MODULE=on`) is the default in all cases
* Commands no longer modify `go.mod` / `go.sum` by default (`-mod=readonly`)
@ -21,14 +21,14 @@ See the [Go 1.16 release notes](https://golang.org/doc/go1.16#go-command) for de
### Go 1.15
See the [Go 1.15 release notes](https://golang.org/doc/go1.15#go-command) for details.
See the [Go 1.15 release notes](https://go.dev/doc/go1.15#go-command) for details.
* The location of the module cache may now be set with the `GOMODCACHE` environment variable. The default value of `GOMODCACHE` is `GOPATH[0]/pkg/mod`, the location of the module cache before this change.
* A workaround is now available for Windows "Access is denied" errors in go commands that access the module cache, caused by external programs concurrently scanning the file system (see issue [#36568](https://golang.org/issue/36568)). The workaround is not enabled by default because it is not safe to use when Go versions lower than 1.14.2 and 1.13.10 are running concurrently with the same module cache. It can be enabled by explicitly setting the environment variable `GODEBUG=modcacheunzipinplace=1`.
* A workaround is now available for Windows "Access is denied" errors in go commands that access the module cache, caused by external programs concurrently scanning the file system (see issue [#36568](https://go.dev/issue/36568)). The workaround is not enabled by default because it is not safe to use when Go versions lower than 1.14.2 and 1.13.10 are running concurrently with the same module cache. It can be enabled by explicitly setting the environment variable `GODEBUG=modcacheunzipinplace=1`.
### Go 1.14
See the [Go 1.14 release notes](https://golang.org/doc/go1.14#go-command) for details.
See the [Go 1.14 release notes](https://go.dev/doc/go1.14#go-command) for details.
* When the main module contains a top-level vendor directory and its `go.mod file` specifies `go 1.14` or higher, the go command now defaults to `-mod=vendor` for operations that accept that flag.
* `-mod=readonly` is now set by default when the go.mod file is read-only and no top-level vendor directory is present.
@ -39,10 +39,10 @@ See the [Go 1.14 release notes](https://golang.org/doc/go1.14#go-command) for de
### Go 1.13
See the [Go 1.13 release notes](https://golang.org/doc/go1.13#modules) for details.
See the [Go 1.13 release notes](https://go.dev/doc/go1.13#modules) for details.
* The `go` tool now defaults to downloading modules from the public Go module mirror at https://proxy.golang.org, and also defaults to validating downloaded modules (regardless of source) against the public Go checksum database at https://sum.golang.org.
* If you have private code, you most likely should configure the `GOPRIVATE` setting (such as `go env -w GOPRIVATE=*.corp.com,github.com/secret/repo`), or the more fine-grained variants `GONOPROXY` or `GONOSUMDB` that support less frequent use cases. See the [documentation](https://golang.org/ref/mod#private-module-privacy) for more details.
* If you have private code, you most likely should configure the `GOPRIVATE` setting (such as `go env -w GOPRIVATE=*.corp.com,github.com/secret/repo`), or the more fine-grained variants `GONOPROXY` or `GONOSUMDB` that support less frequent use cases. See the [documentation](https://go.dev/ref/mod#private-module-privacy) for more details.
* `GO111MODULE=auto` enables module-mode if any go.mod is found, even inside GOPATH. (Prior to Go 1.13, `GO111MODULE=auto` would never enable module-mode inside GOPATH).
* `go get` arguments have changed:
* `go get -u` (without any arguments) now only upgrades the direct and indirect dependencies of your current _package_, and no longer examines your entire _module_.
@ -203,7 +203,7 @@ After reading the next four sections on "New Concepts", you will have enough inf
## New Concepts
These sections provide a high-level introduction to the main new concepts. For more details and rationale, please see this 40-minute introductory [video by Russ Cox describing the philosophy behind the design](https://www.youtube.com/watch?v=F8nrpe0XWRg&list=PLq2Nv-Sh8EbbIjQgDzapOFeVfv5bGOoPE&index=3&t=0s), the [official proposal document](https://golang.org/design/24301-versioned-go), or the more detailed initial [vgo blog series](https://research.swtch.com/vgo).
These sections provide a high-level introduction to the main new concepts. For more details and rationale, please see this 40-minute introductory [video by Russ Cox describing the philosophy behind the design](https://www.youtube.com/watch?v=F8nrpe0XWRg&list=PLq2Nv-Sh8EbbIjQgDzapOFeVfv5bGOoPE&index=3&t=0s), the [official proposal document](https://go.dev/design/24301-versioned-go), or the more detailed initial [vgo blog series](https://research.swtch.com/vgo).
### Modules
@ -290,7 +290,7 @@ As a result of Semantic Import Versioning, code opting in to Go modules **must c
In general, packages with different import paths are different packages. For example, `math/rand` is a different package than `crypto/rand`. This is also true if different import paths are due to different major versions appearing in the import path. Thus `example.com/my/mod/mypkg` is a different package than `example.com/my/mod/v2/mypkg`, and both may be imported in a single build, which among other benefits helps with diamond dependency problems and also allows a v1 module to be implemented in terms of its v2 replacement or vice versa.
See the ["Module compatibility and semantic versioning"](https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning) section of the `go` command documentation for more details on Semantic Import Versioning, and see https://semver.org for more about semantic versioning.
See the ["Module compatibility and semantic versioning"](https://pkg.go.dev/cmd/go/#hdr-Module_compatibility_and_semantic_versioning) section of the `go` command documentation for more details on Semantic Import Versioning, and see https://semver.org for more about semantic versioning.
This section so far has been focused on code that has opted in to modules and imports other modules. However, putting major versions in import paths for v2+ modules could create incompatibilities with older versions of Go, or with code that has not yet opted in to modules. To help with this, there are three important transitional special cases or exceptions to the behavior and rules described above. These transitional exceptions will become less important over time as more packages opt in to modules.
@ -315,8 +315,8 @@ For the exact mechanics required to release a v2+ module, please see the ["Relea
### How to Install and Activate Module Support
To use modules, two install options are:
* [Install the latest Go 1.11 release](https://golang.org/dl/).
* [Install the Go toolchain from source](https://golang.org/doc/install/source) on the `master` branch.
* [Install the latest Go 1.11 release](https://go.dev/dl/).
* [Install the Go toolchain from source](https://go.dev/doc/install/source) on the `master` branch.
Once installed, you can then activate module support in one of two ways:
* Invoke the `go` command in a directory outside of the `$GOPATH/src` tree, with a valid `go.mod` file in the current directory or any parent of it and the environment variable `GO111MODULE` unset (or explicitly set to `auto`).
@ -374,7 +374,7 @@ To create a `go.mod` for an existing project:
Prior to tagging a release, see the ["How to Prepare for a Release"](https://github.com/golang/go/wiki/Modules#how-to-prepare-for-a-release) section below.
For more information on all of these topics, the primary entry point to the official modules documentation is [available on golang.org](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more).
For more information on all of these topics, the primary entry point to the official modules documentation is [available on golang.org](https://pkg.go.dev/cmd/go/#hdr-Modules__module_versions__and_more).
## How to Upgrade and Downgrade Dependencies
@ -409,17 +409,17 @@ To upgrade to the latest version for all direct and indirect dependencies of the
`go get foo` updates to the latest version of `foo`. `go get foo` is equivalent to `go get foo@latest` — in other words, `@latest` is the default if no `@` version is specified.
In this section, "latest" is the latest version with a [semver](https://semver.org/) tag, or the latest known commit if there are no semver tags. Prerelease tags are not selected as "latest" unless there are no other semver tags on the repository ([details](https://golang.org/cmd/go/#hdr-Module_aware_go_get)).
In this section, "latest" is the latest version with a [semver](https://semver.org/) tag, or the latest known commit if there are no semver tags. Prerelease tags are not selected as "latest" unless there are no other semver tags on the repository ([details](https://pkg.go.dev/cmd/go/#hdr-Module_aware_go_get)).
A common mistake is thinking `go get -u foo` solely gets the latest version of `foo`. In actuality, the `-u` in `go get -u foo` or `go get -u foo@latest` means to _also_ get the latest versions for _all_ of the direct and indirect dependencies of `foo`. A common starting point when upgrading `foo` is instead to do `go get foo` or `go get foo@latest` without a `-u` (and after things are working, consider `go get -u=patch foo`, `go get -u=patch`, `go get -u foo`, or `go get -u`).
To upgrade or downgrade to a more specific version, 'go get' allows version selection to be overridden by adding an @version suffix or ["module query"](https://golang.org/cmd/go/#hdr-Module_queries) to the package argument, such as `go get foo@v1.6.2`, `go get foo@e3702bed2`, or `go get foo@'<v1.6.2'`.
To upgrade or downgrade to a more specific version, 'go get' allows version selection to be overridden by adding an @version suffix or ["module query"](https://pkg.go.dev/cmd/go/#hdr-Module_queries) to the package argument, such as `go get foo@v1.6.2`, `go get foo@e3702bed2`, or `go get foo@'<v1.6.2'`.
Using a branch name such as `go get foo@master` (`foo@default` with mercurial) is one way to obtain the latest commit regardless of whether or not it has a semver tag.
In general, module queries that do not resolve to a semver tag will be recorded as [pseudo-versions](https://tip.golang.org/cmd/go/#hdr-Pseudo_versions) in the `go.mod` file.
See the ["Module-aware go get"](https://golang.org/cmd/go/#hdr-Module_aware_go_get) and ["Module queries"](https://golang.org/cmd/go/#hdr-Module_queries) sections of the `go` command documentation for more information on the topics here.
See the ["Module-aware go get"](https://pkg.go.dev/cmd/go/#hdr-Module_aware_go_get) and ["Module queries"](https://pkg.go.dev/cmd/go/#hdr-Module_queries) sections of the `go` command documentation for more information on the topics here.
Modules are capable of consuming packages that have not yet opted into modules, including recording any available semver tags in `go.mod` and using those semver tags to upgrade or downgrade. Modules can also consume packages that do not yet have any proper semver tags (in which case they will be recorded using pseudo-versions in `go.mod`).
@ -463,7 +463,7 @@ There are two alternative mechanisms to release a v2 or higher module. Note that
2. **Major subdirectory**: Create a new `v3` subdirectory (e.g., `my/module/v3`) and place a new `go.mod` file in that subdirectory. The module path must end with `/v3`. Copy or move the code into the `v3` subdirectory. Update import statements within the module to also use `/v3` (e.g., `import "github.com/my/module/v3/mypkg"`). Tag the release with `v3.0.0`.
* This provides greater backwards-compatibility. In particular, Go versions older than 1.9.7 and 1.10.3 are also able to properly consume and build a v2+ module created using this approach.
* A more sophisticated approach here could exploit type aliases (introduced in Go 1.9) and forwarding shims between major versions residing in different subdirectories. This can provide additional compatibility and allow one major version to be implemented in terms of another major version but would entail more work for a module author. An in-progress tool to automate this is `goforward`. Please see [here](https://golang.org/cl/137076) for more details and rationale, along with a functioning initial version of `goforward`.
* A more sophisticated approach here could exploit type aliases (introduced in Go 1.9) and forwarding shims between major versions residing in different subdirectories. This can provide additional compatibility and allow one major version to be implemented in terms of another major version but would entail more work for a module author. An in-progress tool to automate this is `goforward`. Please see [here](https://go.dev/cl/137076) for more details and rationale, along with a functioning initial version of `goforward`.
* Pre-existing dependency management solutions such as `dep` should be able to consume a v2+ module created in this way.
See https://research.swtch.com/vgo-module for a more in-depth discussion of these alternatives.
@ -528,7 +528,7 @@ Note that module paths and import paths are case-sensitive. Changing a module fr
After you have adopted modules, changing your module path in your `go.mod` is a breaking change.
Overall, this is similar to the pre-modules enforcement of a canonical import path via ["import path comments"](https://golang.org/cmd/go/#hdr-Import_path_checking), which are also sometimes called "import pragmas" or "import path enforcement". As an example, the package `go.uber.org/zap` is currently hosted at `github.com/uber-go/zap`, but uses an import path comment [next to the package declaration]((https://github.com/uber-go/zap/blob/8a2ee5670ced5d94154bf385dc6a362722945daf/doc.go#L113)) that triggers an error for any pre-modules consumer using the wrong github-based import path:
Overall, this is similar to the pre-modules enforcement of a canonical import path via ["import path comments"](https://pkg.go.dev/cmd/go/#hdr-Import_path_checking), which are also sometimes called "import pragmas" or "import path enforcement". As an example, the package `go.uber.org/zap` is currently hosted at `github.com/uber-go/zap`, but uses an import path comment [next to the package declaration]((https://github.com/uber-go/zap/blob/8a2ee5670ced5d94154bf385dc6a362722945daf/doc.go#L113)) that triggers an error for any pre-modules consumer using the wrong github-based import path:
`package zap // import "go.uber.org/zap"`
@ -583,15 +583,15 @@ For authors of pre-existing v2+ packages considering opting in to modules, one w
### Documentation and Proposal
* Official documentation:
* Latest [HTML documentation for modules on golang.org](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more)
* Latest [HTML documentation for modules on golang.org](https://pkg.go.dev/cmd/go/#hdr-Modules__module_versions__and_more)
* Run `go help modules` for more about modules. (This is the main entry point for modules topics via `go help`)
* Run `go help mod` for more about the `go mod` command.
* Run `go help module-get` for more about the behavior of `go get` when in module-aware mode.
* Run `go help goproxy` for more about the module proxy, including a pure file-based option via a `file:///` URL.
* The initial ["Go & Versioning"](https://research.swtch.com/vgo) series of blog posts on `vgo` by Russ Cox (first posted February 20, 2018)
* Official [golang.org blog post introducing the proposal](https://blog.golang.org/versioning-proposal) (March 26, 2018)
* Official [golang.org blog post introducing the proposal](https://go.dev/blog/versioning-proposal) (March 26, 2018)
* This provides a more succinct overview of the proposal than the full `vgo` blog series, along with some of the history and process behind the proposal
* Official [Versioned Go Modules Proposal](https://golang.org/design/24301-versioned-go) (last updated March 20, 2018)
* Official [Versioned Go Modules Proposal](https://go.dev/design/24301-versioned-go) (last updated March 20, 2018)
### Introductory Material
@ -617,7 +617,7 @@ As part of the proposal, prototype, and beta processes, there have been over 400
Here is a partial list of some of the larger changes and improvements, almost all of which were primarily based on feedback from the community:
* Top-level vendor support was retained rather than vgo-based builds ignoring vendor directories entirely ([discussion](https://groups.google.com/d/msg/golang-dev/FTMScX1fsYk/uEUSjBAHAwAJ), [CL](https://go-review.googlesource.com/c/vgo/+/118316))
* Backported minimal module-awareness to allow older Go versions 1.9.7+ and 1.10.3+ to more easily consume modules for v2+ projects ([discussion](https://github.com/golang/go/issues/24301#issuecomment-371228742), [CL](https://golang.org/cl/109340))
* Backported minimal module-awareness to allow older Go versions 1.9.7+ and 1.10.3+ to more easily consume modules for v2+ projects ([discussion](https://github.com/golang/go/issues/24301#issuecomment-371228742), [CL](https://go.dev/cl/109340))
* Allowed vgo to use v2+ tags by default for pre-existing packages did not yet have a go.mod (recent update in related behavior described [here](https://github.com/golang/go/issues/25967#issuecomment-407567904))
* Added support via command `go get -u=patch` to update all transitive dependencies to the latest available patch-level versions on the same minor version ([discussion](https://research.swtch.com/vgo-cmd), [documentation](https://tip.golang.org/cmd/go/#hdr-Module_aware_go_get))
* Additional control via environmental variables (e.g., GOFLAGS in [#26585](https://github.com/golang/go/issues/26585), [CL](https://go-review.googlesource.com/c/go/+/126656))
@ -630,7 +630,7 @@ Here is a partial list of some of the larger changes and improvements, almost al
## GitHub Issues
* [Currently open module issues](https://golang.org/issues?q=is%3Aopen+is%3Aissue+label:modules)
* [Currently open module issues](https://go.dev/issues?q=is%3Aopen+is%3Aissue+label:modules)
* [Closed module issues](https://github.com/golang/go/issues?q=is%3Aclosed+is%3Aissue+label%3Amodules+sort%3Aupdated-desc)
* [Closed vgo issues](https://github.com/golang/go/issues?q=-label%3Amodules+vgo+is%3Aclosed+sort%3Aupdated-desc)
* Submit a [new module issue](https://github.com/golang/go/issues/new?title=cmd%2Fgo%3A%20%3Cfill%20this%20in%3E) using 'cmd/go:' as the prefix
@ -786,7 +786,7 @@ A `require` directive is needed for each `replace` directive of a direct depende
You can confirm you are getting your expected versions by running `go list -m all`, which shows you the actual final versions that will be used in your build including taking into account `replace` statements.
See the ['go mod edit' documentation](https://golang.org/cmd/go/#hdr-Edit_go_mod_from_tools_or_scripts) for more details.
See the ['go mod edit' documentation](https://pkg.go.dev/cmd/go/#hdr-Edit_go_mod_from_tools_or_scripts) for more details.
[github.com/rogpeppe/gohack](https://github.com/rogpeppe/gohack) makes these types of workflows much easier, especially if your goal is to have mutable checkouts of dependencies of a module. See the [repository](https://github.com/rogpeppe/gohack) or the immediately prior FAQ for an overview.
@ -923,7 +923,7 @@ Yes. This supports working outside of GOPATH, helps communicate to the ecosystem
### Why must major version numbers appear in import paths?
Please see the discussion on the Semantic Import Versioning and the import compatibility rule in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) concepts section above. See also the [blog post announcing the proposal](https://blog.golang.org/versioning-proposal), which talks more about the motivation and justification for the import compatibility rule.
Please see the discussion on the Semantic Import Versioning and the import compatibility rule in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) concepts section above. See also the [blog post announcing the proposal](https://go.dev/blog/versioning-proposal), which talks more about the motivation and justification for the import compatibility rule.
### Why are major versions v0, v1 omitted from import paths?"
@ -945,7 +945,7 @@ On a related note, Kubernetes has some atypical build approaches (currently incl
Yes.
If a repository has not opted in to modules but has been tagged with valid [semver](https://semver.org) tags (including the required leading `v`), then those semver tags can be used in a `go get`, and a corresponding semver version will be record in the importing module's `go.mod` file. If the repository does not have any valid semver tags, then the repository's version will be recorded with a ["pseudo-version"](https://golang.org/cmd/go/#hdr-Pseudo_versions) such as ` v0.0.0-20171006230638-a6e239ea1c69` (which includes a timestamp and a commit hash, and which are designed to allow a total ordering across versions recorded in `go.mod` and to make it easier to reason about which recorded versions are "later" than another recorded version).
If a repository has not opted in to modules but has been tagged with valid [semver](https://semver.org) tags (including the required leading `v`), then those semver tags can be used in a `go get`, and a corresponding semver version will be record in the importing module's `go.mod` file. If the repository does not have any valid semver tags, then the repository's version will be recorded with a ["pseudo-version"](https://pkg.go.dev/cmd/go/#hdr-Pseudo_versions) such as ` v0.0.0-20171006230638-a6e239ea1c69` (which includes a timestamp and a commit hash, and which are designed to allow a total ordering across versions recorded in `go.mod` and to make it easier to reason about which recorded versions are "later" than another recorded version).
For example, if the latest version of package `foo` is tagged `v1.2.3` but `foo` has not itself opted in to modules, then running `go get foo` or `go get foo@v1.2.3` from inside module M will be recorded in module M's `go.mod` file as:

@ -2,13 +2,13 @@
One of Go's mottos is _"Share memory by communicating, don't communicate by sharing memory."_
That said, Go does provide traditional locking mechanisms in the <a href='http://golang.org/pkg/sync/'>sync package</a>. Most locking issues can be solved using either channels or traditional locks.
That said, Go does provide traditional locking mechanisms in the <a href='https://pkg.go.dev/sync/'>sync package</a>. Most locking issues can be solved using either channels or traditional locks.
So which should you use?
Use whichever is most expressive and/or most simple.
A common Go newbie mistake is to over-use channels and goroutines just because it's possible, and/or because it's fun. Don't be afraid to use a <a href='http://golang.org/pkg/sync/#Mutex'><code>sync.Mutex</code></a> if that fits your problem best. Go is pragmatic in letting you use the tools that solve your problem best and not forcing you into one style of code.
A common Go newbie mistake is to over-use channels and goroutines just because it's possible, and/or because it's fun. Don't be afraid to use a <a href='https://pkg.go.dev/sync/#Mutex'><code>sync.Mutex</code></a> if that fits your problem best. Go is pragmatic in letting you use the tools that solve your problem best and not forcing you into one style of code.
As a general guide, though:
@ -30,5 +30,5 @@ Channel communication, mutexes and wait-groups are complementary and can be comb
### More Info
* Channels in Effective Go: http://golang.org/doc/effective_go.html#channels
* The sync package: http://golang.org/pkg/sync/
* Channels in Effective Go: https://go.dev/doc/effective_go#channels
* The sync package: https://pkg.go.dev/sync/

@ -1,4 +1,4 @@
**Note: NaCl support [was dropped in Go 1.14](https://golang.org/doc/go1.14#nacl).**
**Note: NaCl support [was dropped in Go 1.14](https://go.dev/doc/go1.14#nacl).**
Go 1.3 includes support for generating x86-32 and x86-64 binaries for Google Native Client (NaCl).
@ -17,4 +17,4 @@ There is ongoing work exploring support for the IRT and PPAPI (3 and 4 in the li
There are no concrete plans to support PNaCl (5 and 6 in the list).
The Go 1.3-generated NaCl binaries can be run using the NaCl SDK sel\_ldr\_x86\_32 and sel\_ldr\_x86\_64 programs. They cannot be run directly in Google Chrome. As such, the NaCl support in Go 1.3 is useful only for running sandboxed environments like the [Go Playground](http://play.golang.org/). The file [misc/nacl/README](http://golang.org/misc/nacl/README) in the Go distribution explains how to configure your machine so that you can run and NaCl-sandboxed binaries using the go command.
The Go 1.3-generated NaCl binaries can be run using the NaCl SDK sel\_ldr\_x86\_32 and sel\_ldr\_x86\_64 programs. They cannot be run directly in Google Chrome. As such, the NaCl support in Go 1.3 is useful only for running sandboxed environments like the [Go Playground](https://go.dev/play/). The file [misc/nacl/README](http://golang.org/misc/nacl/README) in the Go distribution explains how to configure your machine so that you can run and NaCl-sandboxed binaries using the go command.

@ -11,7 +11,7 @@ Go on NetBSD is fairly stable on the architectures below. However, some bugs rem
_*_ Go 1.5 or above is recommended.
Support for the arm64 architecture is a work in progress, see https://golang.org/issue/30824.
Support for the arm64 architecture is a work in progress, see https://go.dev/issue/30824.
# Go packages in pkgsrc

@ -17,7 +17,7 @@ Some of this documentation may be out of date.
## Czech - Čeština
* [Pravidla reflexe](http://www.abclinuxu.cz/clanky/google-go-pravidla-reflexe) - a translation of [The Laws of Reflection](http://blog.golang.org/2011/09/laws-of-reflection.html).
* [Pravidla reflexe](http://www.abclinuxu.cz/clanky/google-go-pravidla-reflexe) - a translation of [The Laws of Reflection](https://go.dev/blog/2011/09/laws-of-reflection.html).
## French - Français

@ -1,5 +1,5 @@
# Introduction
Now that you've spent many hours writing your package and debugging it and testing it (you did [[test it|TableDrivenTests]], didn't you?), you want to publish it so other people can [go get](http://golang.org/cmd/go/) your package.
Now that you've spent many hours writing your package and debugging it and testing it (you did [[test it|TableDrivenTests]], didn't you?), you want to publish it so other people can [go get](https://pkg.go.dev/cmd/go/) your package.
First, you will need to host it online somewhere. Three major code hosting sites are [bitbucket](http://bitbucket.org/) (hg/git), [GitHub](http://github.com/) (git) and [launchpad](http://launchpad.net) (bzr). I recommend choosing whichever version control system you are familiar with or which your code is versioned locally on your machine. Git (git) is the version control system used by the central Go repository, so it is the closest to a guarantee as you can get that a developer wanting to use your project will have the right software. If you have never used version control before, these websites have some nice HOWTOs and you can find many great tutorials by searching Google for "{name} tutorial" where {name} is the name of the version control system you would like to learn.
@ -78,7 +78,7 @@ It will typically not be necessary to maintain weekly tags or branches, but it c
## Commands vs Packages
Since go get does not use your project's Makefiles, it is important to understand how it will actually build your project.
All files in the same directory should always share the same package name. Any files named with a ` _test ` or an ` _os ` and/or ` _arch ` suffix will be ignored (unless the os/arch match). If the package name is "main", go get will build an executable from the source files and name it according to the directory name (using the last path segment only). If the package name is anything else, go get will build it as a package and the import path will be the web-accessible URL for your project's root followed by the subdirectory. See [the go get documentation](http://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies) for how to make import paths for code hosting sites other than the main four.
All files in the same directory should always share the same package name. Any files named with a ` _test ` or an ` _os ` and/or ` _arch ` suffix will be ignored (unless the os/arch match). If the package name is "main", go get will build an executable from the source files and name it according to the directory name (using the last path segment only). If the package name is anything else, go get will build it as a package and the import path will be the web-accessible URL for your project's root followed by the subdirectory. See [the go get documentation](https://pkg.go.dev/cmd/go/#hdr-Download_and_install_packages_and_dependencies) for how to make import paths for code hosting sites other than the main four.
Dependencies between packages in the same project are common. In the case where one package or command in your project depends upon another, you must use the full import path in order for go get to recognize the dependency and make sure it is built. Third-party packages which are imported from source files in your project will also be automatically downloaded and installed by go get if it is not already present.
@ -127,4 +127,4 @@ The Go Dashboard will use the first line of your package-level comment (also usi
package epub
```
For more information on godoc, see the [Documenting Go Code](http://blog.golang.org/2011/03/godoc-documenting-go-code.html) blog post.
For more information on godoc, see the [Documenting Go Code](https://go.dev/blog/2011/03/godoc-documenting-go-code.html) blog post.

@ -82,8 +82,8 @@ func main() {
```
# References
[Defer, Panic and Recover](https://blog.golang.org/defer-panic-and-recover)
[Defer, Panic and Recover](https://go.dev/blog/defer-panic-and-recover)
https://golang.org/ref/spec#Handling_panics
https://go.dev/ref/spec#Handling_panics
https://golang.org/ref/spec#Run_time_panics
https://go.dev/ref/spec#Run_time_panics

@ -30,7 +30,7 @@ Go runtime contains built-in CPU profiler, which shows what functions consume
what percent of CPU time. There are 3 ways you can get access to it:
1. The simplest one is -cpuprofile flag of 'go test'
(http://golang.org/cmd/go/#hdr-Description_of_testing_flags) command. For
(https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags) command. For
example, the following command:
$ go test -run=none -bench=ClientServerParallel4 -cpuprofile=cprof net/http
@ -46,14 +46,14 @@ what percent of CPU time. There are 3 ways you can get access to it:
`--text`, `--web` and `--list`. Run `go tool pprof` to get the complete
list. The obvious drawback of this option is that it works only for tests.
2. [net/http/pprof](http://golang.org/pkg/net/http/pprof): This is the ideal
2. [net/http/pprof](https://pkg.go.dev/net/http/pprof): This is the ideal
solution for network servers. You merely need to import `net/http/pprof`,
and collect profiles with:
$ go tool pprof --text mybin http://myserver:6060:/debug/pprof/profile
3. Manual profile collection. You need to import
[runtime/pprof](http://golang.org/pkg/runtime/pprof/) and add the following
[runtime/pprof](https://pkg.go.dev/runtime/pprof/) and add the following
code to main function:
if *flagCpuprofile != "" {
@ -131,10 +131,10 @@ svg/web profiles.
Memory profiler shows what functions allocate heap memory. You can collect it in
similar ways as CPU profile: with `go test --memprofile`
(http://golang.org/cmd/go/#hdr-Description_of_testing_flags), with
[net/http/pprof](http://golang.org/pkg/net/http/pprof) via
(https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags), with
[net/http/pprof](https://pkg.go.dev/net/http/pprof) via
http://myserver:6060:/debug/pprof/heap or by calling
[runtime/pprof.WriteHeapProfile](http://golang.org/pkg/runtime/pprof/#WriteHeapProfile).
[runtime/pprof.WriteHeapProfile](https://pkg.go.dev/runtime/pprof/#WriteHeapProfile).
You can visualize only allocations live at the time of profile collection
(`--inuse_space flag to pprof`, default), or all allocations happened since
@ -295,16 +295,16 @@ need to execute 2 or 3 GCs before the collection."
The blocking profiler shows where goroutine block waiting on synchronization
primitives (including timer channels). You can collect it in similar ways as CPU
profile: with `go test --blockprofile`
(http://golang.org/cmd/go/#hdr-Description_of_testing_flags), with
[net/http/pprof](http://golang.org/pkg/net/http/pprof) via
(https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags), with
[net/http/pprof](https://pkg.go.dev/net/http/pprof) via
http://myserver:6060:/debug/pprof/block or by calling
[runtime/pprof.Lookup("block").WriteTo](http://golang.org/pkg/runtime/pprof/#Profile.WriteTo).
[runtime/pprof.Lookup("block").WriteTo](https://pkg.go.dev/runtime/pprof/#Profile.WriteTo).
But there is significant caveat -- the blocking profiler is not enabled by
default. `go test --blockprofile` will enable it for you automatically. However,
if you use `net/http/pprof` or `runtime/pprof`, you need to enable it manually
(otherwise the profile will be empty). To enable the blocking profiler call
[runtime.SetBlockProfileRate](http://golang.org/pkg/runtime/#SetBlockProfileRate).
[runtime.SetBlockProfileRate](https://pkg.go.dev/runtime/#SetBlockProfileRate).
SetBlockProfileRate controls the fraction of goroutine blocking events that are
reported in the blocking profile. The profiler aims to sample an average of one
blocking event per the specified amount of nanoseconds spent blocked. To include
@ -431,10 +431,10 @@ The goroutine profiler simply gives you current stacks of all live goroutines in
the process. It can be handy to debug load balancing issues (see Scheduler Trace
section below), or to debug deadlocks. The profile makes sense only for a
running app, so go test does not expose it. You can collect the profile with
[net/http/pprof](http://golang.org/pkg/net/http/pprof) via
[net/http/pprof](https://pkg.go.dev/net/http/pprof) via
http://myserver:6060:/debug/pprof/goroutine, and visualize it to svg/pdf or by
calling
[runtime/pprof.Lookup("goroutine").WriteTo](http://golang.org/pkg/runtime/pprof/#Profile.WriteTo).
[runtime/pprof.Lookup("goroutine").WriteTo](https://pkg.go.dev/runtime/pprof/#Profile.WriteTo).
But the most useful way is to type
http://myserver:6060:/debug/pprof/goroutine?debug=2 in your browser, which will
give you symbolized stacks similar to what you see when a program crashes. Note
@ -614,10 +614,10 @@ overheads.
## Memory Statistics
Go runtime exposes coarse-grained memory statistics via
[runtime.ReadMemStats](http://golang.org/pkg/runtime/#ReadMemStats) function.
[runtime.ReadMemStats](https://pkg.go.dev/runtime/#ReadMemStats) function.
The statistics are also exposed via net/http/pprof at the bottom of
http://myserver:6060/debug/pprof/heap?debug=1. The statistics are described
[here](http://golang.org/pkg/runtime/#MemStats). Some of the interesting fields
[here](https://pkg.go.dev/runtime/#MemStats). Some of the interesting fields
are:
1. HeapAlloc - current heap size.
@ -673,5 +673,5 @@ Optimization is an open problem, there are simple recipes that you can use to
improve performance. Sometimes optimization requires complete re-architecture of
the program. But we hope that the tools will be a valuable addition to your
toolbox, that you can use to at least analyze and understand what happens.
[Profiling Go Programs](http://blog.golang.org/profiling-go-programs) is a good
[Profiling Go Programs](https://go.dev/blog/profiling-go-programs) is a good
tutorial on usage of CPU and memory profilers to optimize a simple program.

@ -90,7 +90,7 @@ Go is now ready to use.
## Bootstrapping from another operating system
First, you must have installed Go on this operating system, following the [Go installation instructions](https://golang.org/doc/install).
First, you must have installed Go on this operating system, following the [Go installation instructions](https://go.dev/doc/install).
Then, you can cross-compile a Go toolchain for Plan 9:
@ -143,7 +143,7 @@ Other binary packages are available [here](http://9legacy.org/download.html) and
# Git
Git is not available on Plan 9. However a [Git wrapper](http://9legacy.org/9legacy/tools/git) is available as a simple rc script. It includes everything you need to use the [go](https://golang.org/cmd/go) tool.
Git is not available on Plan 9. However a [Git wrapper](http://9legacy.org/9legacy/tools/git) is available as a simple rc script. It includes everything you need to use the [go](https://pkg.go.dev/cmd/go) tool.
# Builders
@ -155,11 +155,11 @@ Three Plan 9 builders are currently running and reporting the results to the [Go
# Status
The Plan 9 port of Go is considered experimental and is still a work-in-progress. There is a number of known issues available on the [Go issue tracker](https://golang.org/issues).
The Plan 9 port of Go is considered experimental and is still a work-in-progress. There is a number of known issues available on the [Go issue tracker](https://go.dev/issues).
# Issues
Many issues are currently open on the [Go issue tracker](https://golang.org/issues) with the [OS-Plan9](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3AOS-Plan9) label.
Many issues are currently open on the [Go issue tracker](https://go.dev/issues) with the [OS-Plan9](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3AOS-Plan9) label.
# Help
@ -172,7 +172,7 @@ Many people have contributed to the Plan 9 port of Go. Since December 2013, the
# Trivia
Many parts of Go are directly influenced by the Plan 9 system, as two of its three main designers worked on Plan 9 at Bell labs. Some of these connections are:
* The [Gopher](https://golang.org/doc/faq#gopher) is designed by Renée French, who also designed Glenda, the Plan 9 bunny.
* The Gc compiler hosted in this repository uses a [Plan 9-style loader](https://golang.org/doc/faq#What_compiler_technology_is_used_to_build_the_compilers).
* [Go's Assembler](https://golang.org/doc/asm) is based on Plan 9's syntax. The Go 1.x stack-based ABI is borrowed from Plan 9.
* The [Gopher](https://go.dev/doc/faq#gopher) is designed by Renée French, who also designed Glenda, the Plan 9 bunny.
* The Gc compiler hosted in this repository uses a [Plan 9-style loader](https://go.dev/doc/faq#What_compiler_technology_is_used_to_build_the_compilers).
* [Go's Assembler](https://go.dev/doc/asm) is based on Plan 9's syntax. The Go 1.x stack-based ABI is borrowed from Plan 9.
* Although not recommended, there was also some support for [[Plan 9 C|GcToolchainTricks]], with the original standard library being descended from Plan 9's libc.

@ -36,7 +36,7 @@ A first class port has these properties:
* All contributors are effectively responsible for these ports (You break it, you fix it, or find someone who can.)
* Official binaries are provided
* Requires Google's Go team to own the builder machine
* Installation is documented at https://golang.org/doc/install
* Installation is documented at https://go.dev/doc/install
Graduating a port to "first class" is at the discretion of the Go team at Google.

@ -4,7 +4,7 @@
This page links to prior discussion on various topics.
The page complements the [official FAQ](https://golang.org/doc/faq). While the official FAQ contains things which are frequently asked and contains answers, this page contains things that have been repeatedly asked, but maybe not frequently, and only needs to link to one or more previous threads. Over time, these entries may graduate to entries in the official FAQ.
The page complements the [official FAQ](https://go.dev/doc/faq). While the official FAQ contains things which are frequently asked and contains answers, this page contains things that have been repeatedly asked, but maybe not frequently, and only needs to link to one or more previous threads. Over time, these entries may graduate to entries in the official FAQ.
**Editors:** When editing this page, please don't change the titles of sections, as that breaks the #anchors in URLs. You can rearrange, though. Feel free to add entries at will. There is no requirement for code or English review here.
@ -53,7 +53,7 @@ Rejected.
### Add warnings to the Go compiler
Experience in large projects has shown that warnings pile up until people ignore all warnings, so warnings only add noise and no value (or are actively harmful in that they hide bugs). See https://golang.org/doc/faq#unused_variables_and_imports
Experience in large projects has shown that warnings pile up until people ignore all warnings, so warnings only add noise and no value (or are actively harmful in that they hide bugs). See https://go.dev/doc/faq#unused_variables_and_imports
### Weak references

@ -693,7 +693,7 @@ See also [[SQLDrivers page|SQLDrivers]].
* [godev](https://github.com/kdar/godev) - Recompiles and runs your Go code on source change. Also watches all your imports for changes.
* [godiff](https://github.com/spcau/godiff) - diff file comparison tool with colour html output
* [gonew](https://github.com/bmatsuo/gonew) - A tool to create new Go projects
* [go-play](https://code.google.com/p/go-play) - A HTML5 web interface for experimenting with Go code. Like http://golang.org/doc/play but runs on your computer
* [go-play](https://code.google.com/p/go-play) - A HTML5 web interface for experimenting with Go code. Like https://go.dev/doc/play but runs on your computer
* [gore](https://github.com/motemen/gore) - A Go REPL. Featured with line editing, code completion, and more
* [gorun](https://wiki.ubuntu.com/gorun) - Enables Go source files to be used as scripts.
* [go-spew](https://github.com/davecgh/go-spew) - Implements a deep pretty printer for Go data structures to aid in debugging
@ -1578,7 +1578,7 @@ See also [[SQLDrivers page|SQLDrivers]].
* [Black Friday](https://github.com/russross/blackfriday) - A markdown processor
* [codename-generator](https://github.com/jgautheron/codename-generator) - A codename generator meant for naming software releases
* [columnize](https://code.google.com/p/go-columnize/) - format slice or array into aligned columns
* [csvplus](https://github.com/maxim2266/csvplus) - Extends the standard Go [encoding/csv](https://golang.org/pkg/encoding/csv/) package with fluent interface, lazy stream operations, indices and joins.
* [csvplus](https://github.com/maxim2266/csvplus) - Extends the standard Go [encoding/csv](https://pkg.go.dev/encoding/csv/) package with fluent interface, lazy stream operations, indices and joins.
* [csvutil](https://github.com/bmatsuo/csvutil) - A heavy duty CSV reading and writing library.
* [dgohash](https://github.com/dgryski/dgohash) - Collection of string hashing functions, including Murmur3 and others
* [douceur](https://github.com/aymerick/douceur) - A simple CSS parser and inliner in Go.

@ -1,6 +1,6 @@
# Asking Questions
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and [proposals](https://golang.org/s/proposal-process) only.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and [proposals](https://go.dev/s/proposal-process) only.
For asking questions, see:

@ -1,6 +1,6 @@
# Range Clauses
Spec: http://golang.org/doc/go_spec.html#For_statements
Spec: https://go.dev/ref/spec#For_statements
## Summary

@ -1,6 +1,6 @@
# Rate Limiting
To limit the rate of operations per unit time, use a [time.Ticker](http://golang.org/pkg/time/#NewTicker).
To limit the rate of operations per unit time, use a [time.Ticker](https://pkg.go.dev/time/#NewTicker).
This works well for rates up to tens of operations per second.
For higher rates, prefer a token bucket rate limiter such as [golang.org/x/time/rate.Limiter](https://pkg.go.dev/golang.org/x/time/rate) (also search pkg.go.dev for
[rate limit](http://pkg.go.dev/search?q=rate+limit)).

@ -1,19 +1,19 @@
# Introduction
The `database/sql` package provides a generic interface around SQL (or SQL-like) databases. See the [official documentation](https://golang.org/pkg/database/sql/) for details.
The `database/sql` package provides a generic interface around SQL (or SQL-like) databases. See the [official documentation](https://pkg.go.dev/database/sql/) for details.
This page provides example usage patterns.
# Database driver
The `database/sql` package must be used in conjunction with a database driver.
See http://golang.org/s/sqldrivers for a list of drivers.
See https://go.dev/s/sqldrivers for a list of drivers.
The documentation below assumes a driver has been imported.
# Connecting to a database
[`Open`](https://golang.org/pkg/database/sql/#Open)
[`Open`](https://pkg.go.dev/database/sql/#Open)
is used to create a database handle:
```go
@ -27,7 +27,7 @@ such as database name and authentication credentials.
Note that `Open` does not directly open a database connection: this is deferred
until a query is made. To verify that a connection can be made
before making a query, use the
[`PingContext`](https://golang.org/pkg/database/sql/#DB.PingContext)
[`PingContext`](https://pkg.go.dev/database/sql/#DB.PingContext)
method:
```go
@ -36,11 +36,11 @@ if err := db.PingContext(ctx); err != nil {
}
```
After use, the database is closed using [`Close`](https://golang.org/pkg/database/sql/#DB.Close).
After use, the database is closed using [`Close`](https://pkg.go.dev/database/sql/#DB.Close).
# Executing queries
[`ExecContext`](https://golang.org/pkg/database/sql/#DB.ExecContext)
[`ExecContext`](https://pkg.go.dev/database/sql/#DB.ExecContext)
is used for queries where no rows are returned:
```go
@ -55,7 +55,7 @@ Where result contains the last insert ID and number of
rows affected. The availability of these values is dependent on
the database driver.
[`QueryContext`](https://golang.org/pkg/database/sql/#DB.QueryContext)
[`QueryContext`](https://pkg.go.dev/database/sql/#DB.QueryContext)
is used for retrieval:
```go
@ -76,7 +76,7 @@ if err := rows.Err(); err != nil {
}
```
[`QueryRowContext`](https://golang.org/pkg/database/sql/#DB.QueryRowContext)
[`QueryRowContext`](https://pkg.go.dev/database/sql/#DB.QueryRowContext)
is used where only a single row is expected:
```go
@ -84,7 +84,7 @@ var age int64
err := db.QueryRowContext(ctx, "SELECT age FROM users WHERE name = $1", name).Scan(&age)
```
Prepared statements can be created with [`PrepareContext`](https://golang.org/pkg/database/sql/#DB.PrepareContext):
Prepared statements can be created with [`PrepareContext`](https://pkg.go.dev/database/sql/#DB.PrepareContext):
```go
age := 27
@ -96,12 +96,12 @@ rows, err := stmt.Query(age)
// process rows
```
[`ExecContext`](https://golang.org/pkg/database/sql/#Stmt.ExecContext), [`QueryContext`](https://golang.org/pkg/database/sql/#Stmt.QueryContext) and [`QueryRowContext`](https://golang.org/pkg/database/sql/#Stmt.QueryContext) can be called on statements. After use, a
statement should be closed with [`Close`](https://golang.org/pkg/database/sql/#Stmt.Close).
[`ExecContext`](https://pkg.go.dev/database/sql/#Stmt.ExecContext), [`QueryContext`](https://pkg.go.dev/database/sql/#Stmt.QueryContext) and [`QueryRowContext`](https://pkg.go.dev/database/sql/#Stmt.QueryContext) can be called on statements. After use, a
statement should be closed with [`Close`](https://pkg.go.dev/database/sql/#Stmt.Close).
# Transactions
Transactions are started with [`BeginTx`](https://golang.org/pkg/database/sql/#DB.BeginTx):
Transactions are started with [`BeginTx`](https://pkg.go.dev/database/sql/#DB.BeginTx):
```go
tx, err := db.BeginTx(ctx, nil)
@ -110,10 +110,10 @@ if err != nil {
}
```
The [`ExecContext`](https://golang.org/pkg/database/sql/#Tx.ExecContext), [`QueryContext`](https://golang.org/pkg/database/sql/#Tx.QueryContext), [`QueryRowContext`](https://golang.org/pkg/database/sql/#Tx.QueryRowContext) and [`PrepareContext`](https://golang.org/pkg/database/sql/#Tx.PrepareContext) methods already covered can be
The [`ExecContext`](https://pkg.go.dev/database/sql/#Tx.ExecContext), [`QueryContext`](https://pkg.go.dev/database/sql/#Tx.QueryContext), [`QueryRowContext`](https://pkg.go.dev/database/sql/#Tx.QueryRowContext) and [`PrepareContext`](https://pkg.go.dev/database/sql/#Tx.PrepareContext) methods already covered can be
used in a transaction.
A transaction must end with a call to [`Commit`](https://golang.org/pkg/database/sql/#Tx.Commit) or [`Rollback`](https://golang.org/pkg/database/sql/#Tx.Rollback).
A transaction must end with a call to [`Commit`](https://pkg.go.dev/database/sql/#Tx.Commit) or [`Rollback`](https://pkg.go.dev/database/sql/#Tx.Rollback).
# Dealing with NULL
@ -132,6 +132,6 @@ if name.Valid {
}
```
Only [`NullByte`](https://golang.org/pkg/database/sql/#NullByte), [`NullBool`](https://golang.org/pkg/database/sql/#NullBool), [`NullFloat64`](https://golang.org/pkg/database/sql/#NullFloat64), [`NullInt64`](https://golang.org/pkg/database/sql/#NullInt64), [`NullInt32`](https://golang.org/pkg/database/sql/#NullInt32) [`NullInt16`](https://golang.org/pkg/database/sql/#NullInt16), [`NullString`](https://golang.org/pkg/database/sql/#NullString) and [`NullTime`](https://golang.org/pkg/database/sql/#NullTime) are implemented in
Only [`NullByte`](https://pkg.go.dev/database/sql/#NullByte), [`NullBool`](https://pkg.go.dev/database/sql/#NullBool), [`NullFloat64`](https://pkg.go.dev/database/sql/#NullFloat64), [`NullInt64`](https://pkg.go.dev/database/sql/#NullInt64), [`NullInt32`](https://pkg.go.dev/database/sql/#NullInt32) [`NullInt16`](https://pkg.go.dev/database/sql/#NullInt16), [`NullString`](https://pkg.go.dev/database/sql/#NullString) and [`NullTime`](https://pkg.go.dev/database/sql/#NullTime) are implemented in
`database/sql`. Implementations of database-specific null types are left
to the database driver. User types supporting `NULL` can be created by implementing interfaces [`database/sql/driver.Valuer`](https://golang.org/pkg/database/sql/driver/#Valuer) and [`database/sql.Scanner`](https://golang.org/pkg/database/sql/#Scanner).
to the database driver. User types supporting `NULL` can be created by implementing interfaces [`database/sql/driver.Valuer`](https://pkg.go.dev/database/sql/driver/#Valuer) and [`database/sql.Scanner`](https://pkg.go.dev/database/sql/#Scanner).

@ -15,4 +15,4 @@ Swapping two values is also made simple using simultaneous assignment:
i, j = j, i
```
http://golang.org/ref/spec#Assignments
https://go.dev/ref/spec#Assignments

@ -38,8 +38,8 @@ When running TryBots again later, the most recent `TRY=` comment on the current
* If TryBots are already running, deleting the `Run-TryBot+1` vote and re-doing it won't re-start the TryBot set, so it won't look at your TRY= line, until the next run when it's done. (But you'll need to delete the TryBot-Result somehow: manually, rebasing, uploading new version)
* If you select a builder that's offline, it'll currently just wait forever for it to show up. There's no timeout yet.
* If you specify an unknown `TRY=` token, it'll just ignore it and won't report an error.
* There's no `all` alias. That's kinda intentional, to prevent overuse that might cause the SlowBots to get even slower for everybody. But we might add it later anyway. See [golang.org/issue/34501#issuecomment-544585711](https://golang.org/issue/34501#issuecomment-544585711).
* There's no `all` alias. That's kinda intentional, to prevent overuse that might cause the SlowBots to get even slower for everybody. But we might add it later anyway. See [golang.org/issue/34501#issuecomment-544585711](https://go.dev/issue/34501#issuecomment-544585711).
## TODO
The usability of SlowBots will be improved over time. It needs to report things better, make it easier to configure (both CLI and probably a web GUI picker UI), and support restarting things, or modifying in-progress TryBot runs to change the set of builders. Feedback welcome at [golang.org/issue/34501](https://golang.org/issue/34501).
The usability of SlowBots will be improved over time. It needs to report things better, make it easier to configure (both CLI and probably a web GUI picker UI), and support restarting things, or modifying in-progress TryBot runs to change the set of builders. Feedback welcome at [golang.org/issue/34501](https://go.dev/issue/34501).

@ -7,7 +7,7 @@ Policy:
* American spellings over British spellings
* **iff** means "if and only if" (https://en.wiktionary.org/wiki/iff), but don't use it in public-facing docs (don't use in comments on exported identifiers that would show up in godoc)
* avoid Latin abbreviations in godoc
* use **cancellation** (two ells), not cancelation. See https://golang.org/cl/170060
* use **cancellation** (two ells), not cancelation. See https://go.dev/cl/170060
* use **canceled** (one ell), not cancelled.
* use **canceling** (one ell), not cancelling.
* use **marshaling**, **marshaled** etc (single ell). See https://golang.org/cl/33017
* use **marshaling**, **marshaled** etc (single ell). See https://go.dev/cl/33017

@ -31,11 +31,11 @@
* [Go at the BBC](http://www.quora.com/Go-programming-language/Is-Google-Go-ready-for-production-use/answer/Kunal-Anand)
* [Go at SoundCloud](http://backstage.soundcloud.com/2012/07/go-at-soundcloud/)
* [Go at Moovweb](https://groups.google.com/forum/#!topic/golang-nuts/MeiTNnGhLg8/discussion)
* [Building StatHat with Go](http://blog.golang.org/2011/12/building-stathat-with-go.html)
* [Building StatHat with Go](https://go.dev/blog/2011/12/building-stathat-with-go.html)
* [Go at CloudFlare](http://blog.cloudflare.com/go-at-cloudflare)
* [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/)
* [I/O BootCamp 2011: Real World Go](http://www.youtube.com/watch?v=7QDVRowyUQA)
* [Go at Heroku](http://blog.golang.org/2011/04/go-at-heroku.html)
* [Go at Heroku](https://go.dev/blog/2011/04/go-at-heroku.html)
* [Go at Basecamp](https://signalvnoise.com/posts/3897-go-at-basecamp)
* [Go at Streetspotr](https://thcyron.de/2015/go-at-streetspotr.html)
* [Confession From A Go Programer](https://zeta.si/page/Confession-From-A-Go-Programer)

@ -1,6 +1,6 @@
# Switch
Spec: https://golang.org/ref/spec#Switch_statements
Spec: https://go.dev/ref/spec#Switch_statements
Go's ` switch ` statements are pretty neat. For one thing, you don't need to break at the end of each case.

@ -7,7 +7,7 @@ Table driven testing is not a tool, package or anything else, it's just a way an
## Example of a table driven test
Here is a good example from the testing code for the ` fmt ` package ( http://golang.org/pkg/fmt/ ):
Here is a good example from the testing code for the ` fmt ` package ( https://pkg.go.dev/fmt/ ):
```go
var flagtests = []struct {
@ -78,7 +78,7 @@ func TestTLog(t *testing.T) {
## References
* https://golang.org/doc/code.html#Testing
* https://golang.org/doc/faq#assertions
* https://golang.org/doc/faq#testing_framework
* https://golang.org/pkg/testing/
* https://go.dev/doc/code#Testing
* https://go.dev/doc/faq#assertions
* https://go.dev/doc/faq#testing_framework
* https://pkg.go.dev/testing/

@ -4,7 +4,7 @@ This page is a supplement to
[Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments),
but is targeted specifically to test code.
**Please [discuss changes](https://golang.org/issue/new?title=wiki%3A+CodeReviewComments+change&body=&labels=Documentation)
**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+CodeReviewComments+change&body=&labels=Documentation)
before editing this page**, even _minor_ ones. Many people have opinions and
this is not the place for edit wars.
@ -65,7 +65,7 @@ equality (e.g. if one of the fields is an `io.Reader`), tweaking a
[`cmp.Equal`](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal) comparison
with [cmpopts](https://pkg.go.dev/github.com/google/go-cmp/cmp/cmpopts) options
such as [`cmpopts.IgnoreInterfaces`](https://pkg.go.dev/github.com/google/go-cmp/cmp/cmpopts#IgnoreInterfaces)
may meet your needs ([example](https://play.golang.org/p/vrCUNVfxsvF));
may meet your needs ([example](https://go.dev/play/p/vrCUNVfxsvF));
otherwise, this technique just won't work, so do whatever works.
If your function returns multiple return values, you don't need to wrap those in
@ -80,7 +80,7 @@ semantically relevant information that is stable and resistent to changes in
your dependencies. For functionality that returns a formatted string or
serialized bytes, it is generally not safe to assume that the output is stable.
For example, [`json.Marshal`](https://golang.org/pkg/encoding/json/#Marshal)
For example, [`json.Marshal`](https://pkg.go.dev/encoding/json/#Marshal)
makes no guarantee about the exact bytes that it may emit. It has the freedom to
change (and has changed in the past) the output. Tests that perform string
equality on the exact JSON string may break if the `json` package changes how it
@ -92,7 +92,7 @@ data structure.
## Equality Comparison and Diffs
The `==` operator evaluates equality using the
[language-defined comparisons](http://golang.org/ref/spec#Comparison_operators).
[language-defined comparisons](https://go.dev/ref/spec#Comparison_operators).
Values it can compare include numeric, string, and pointer values and structs
with fields of those values. In particular, it determines two pointers to be
equal only if they point to the same variable.

@ -18,8 +18,8 @@ Note that the channel ` c ` has a buffer size of 1. If it were an unbuffered ch
## References
time.After: http://golang.org/pkg/time/#After
time.After: https://pkg.go.dev/time/#After
select: http://golang.org/doc/go_spec.html#Select_statements
select: https://go.dev/ref/spec#Select_statements
blog post: http://blog.golang.org/2010/09/go-concurrency-patterns-timing-out-and.html
blog post: https://go.dev/blog/2010/09/go-concurrency-patterns-timing-out-and.html

@ -1,6 +1,6 @@
> The Go project's official download page is at [https://golang.org/dl](https://golang.org/dl/).
> The Go project's official download page is at [https://go.dev/dl](https://go.dev/dl/).
>
> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://golang.org/doc/install](https://golang.org/doc/install#install).
> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://go.dev/doc/install](https://go.dev/doc/install#install).
There are some other options for Debian based systems like Ubuntu. These packages were not created by the Go project, and we don't support them, but they may be useful for you.

@ -98,7 +98,7 @@ $ goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`.`)))'
Or use your own https://play.golang.org/p/pZ1f5pICVbV[basic HTTP server command].
Note: for the `goexec` command to work on Unix-like systems, you must https://golang.org/doc/install#tarball[add the path environment variable] for Go to your shell's `profile`. Go's getting started guide explains this:
Note: for the `goexec` command to work on Unix-like systems, you must https://go.dev/doc/install#tarball[add the path environment variable] for Go to your shell's `profile`. Go's getting started guide explains this:
> Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:
@ -205,7 +205,7 @@ is in development.
# Configuring fetch options while using net/http
You can use the net/http library to make HTTP requests from Go, and they will be converted to https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API[fetch] calls. However, there isn't a direct mapping between the fetch https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters[options] and the http https://golang.org/pkg/net/http/#Client[client] options. To achieve this, we have some special header values that are recognized as fetch options. They are -
You can use the net/http library to make HTTP requests from Go, and they will be converted to https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API[fetch] calls. However, there isn't a direct mapping between the fetch https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters[options] and the http https://pkg.go.dev/net/http/#Client[client] options. To achieve this, we have some special header values that are recognized as fetch options. They are -
- `js.fetch:mode`: An option to the Fetch API mode setting. Valid values are: "cors", "no-cors", "same-origin", navigate". The default is "same-origin".

@ -1,12 +1,12 @@
# Well-known struct tags
## Background
Go offers [struct tags](https://golang.org/ref/spec#Tag) which are discoverable via reflection. These enjoy a wide range of use in the standard library in the JSON/XML and other encoding packages.
Go offers [struct tags](https://go.dev/ref/spec#Tag) which are discoverable via reflection. These enjoy a wide range of use in the standard library in the JSON/XML and other encoding packages.
The community welcomed them and has built ORMs, further encodings, flag parsers and much more around them since, especially for these tasks, single-sourcing is beneficial for data structures.
## Problem description
Due to increased usage of Go and thus Go [struct tags](https://golang.org/ref/spec#Tag), clashes become inevitable.
Due to increased usage of Go and thus Go [struct tags](https://go.dev/ref/spec#Tag), clashes become inevitable.
## Solution
The list below is a best effort to document well-known struct tags used by packages which are available to the public.

@ -32,21 +32,21 @@ Here's why: a list of people/organizations explaining why they use Go. This is p
- [Go at the BBC](http://www.quora.com/Go-programming-language/Is-Google-Go-ready-for-production-use/answer/Kunal-Anand)
- [Go at SoundCloud](https://developers.soundcloud.com/blog/go-at-soundcloud)
- [Go at Moovweb](https://groups.google.com/forum/#!topic/golang-nuts/MeiTNnGhLg8/discussion)
- [Building StatHat with Go](http://blog.golang.org/2011/12/building-stathat-with-go.html)
- [Building StatHat with Go](https://go.dev/blog/2011/12/building-stathat-with-go.html)
- [Go at CloudFlare](http://blog.cloudflare.com/go-at-cloudflare)
- [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/)
- [I/O BootCamp 2011: Real World Go](http://www.youtube.com/watch?v=7QDVRowyUQA)
- [Go at Heroku](http://blog.golang.org/2011/04/go-at-heroku.html)
- [Go at Heroku](https://go.dev/blog/2011/04/go-at-heroku.html)
- [**The Business Benefits of Building Your Next Project With Go** by Tom Maiaroto](https://medium.com/@shift8creative/the-business-benefits-of-building-your-next-project-with-go-ebed4bbc3ed7)
- [**TweetQureet: a full Golang technology stack** by Qureet](http://www.qureet.com/blog/golang-technology-stack/)
- [**Where and why we use Go** by Jeremey Bingham, Raintank.io](https://blog.raintank.io/where-and-why-we-use-go/)
- [*Half a decade with Go* by golang.org blog](http://blog.golang.org/5years)
- [*Half a decade with Go* by golang.org blog](https://go.dev/blog/5years)
- [**Why Learn Go** by Rob Pike (YouTube)](https://www.youtube.com/watch?v=FTl0tl9BGdc)
- [**Go at Google** by Rob Pike (YouTube)](http://www.infoq.com/presentations/Go-Google)
- [**Go at Google** by Rob Pike (Article)](http://talks.golang.org/2012/splash.article)
- [**5 things I love** by Andrew Gerrand (dotGo 2014)](https://www.youtube.com/watch?v=fsTOOPB1TBY)
- [**dl.google.com powered by Go** by Brad Fitzpatrick](http://talks.golang.org/2013/oscon-dl.slide#1)
- [*Is Google using Go internally?* by golang.org](https://golang.org/doc/faq#Is_Google_using_go_internally)
- [*Is Google using Go internally?* by golang.org](https://go.dev/doc/faq#Is_Google_using_go_internally)
- [**The State of the Gopher** by Brad Fitzpatrick (dotGo 2014)](https://www.youtube.com/watch?v=4KFTacxqkcQ)
- [*Software I'm excited about* by Brad Fitzpatrick (dotScale 2013)](https://www.youtube.com/watch?v=sYukPc0y_Ro)
- [*I came for the easy concurrency I stayed for the easy composition* by John Graham-Cumming (dotGo 2014)](https://www.youtube.com/watch?v=4KFTacxqkcQ)

@ -1,7 +1,7 @@
> The Go project's official download page is at [https://golang.org/dl](https://golang.org/dl/).
> The Go project's official download page is at [https://go.dev/dl](https://go.dev/dl/).
>
> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://golang.org/doc/install](https://golang.org/doc/install#install).
> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://go.dev/doc/install](https://go.dev/doc/install#install).
# Go for Microsoft Windows
@ -16,4 +16,4 @@ The Windows port is stable and officially supported.
| Windows Vista, Windows Server 2008 | amd64, 386 | Go 1 _*_ | Go 1.10.8 |
| Windows XP, Windows Server 2003 | amd64, 386 | Go 1 _*_ | Go 1.10.8 |
_*_ Go 1.5 or above is recommended.
_*_ Go 1.5 or above is recommended.

@ -1,6 +1,6 @@
# Building Windows Go programs on Linux
See [here](https://golang.org/doc/install/source#environment) for available `GOOS` and `GOARCH` values.
See [here](https://go.dev/doc/install/source#environment) for available `GOOS` and `GOARCH` values.
## Go version >= 1.5

@ -1,6 +1,6 @@
The `golang.org/x/...` repositories are part of the Go Project but outside the main Go tree.
They are developed under looser [compatibility requirements](http://golang.org/doc/go1compat.html) than the Go core. In general, they will support the previous two releases and tip.
They are developed under looser [compatibility requirements](https://go.dev/doc/go1compat) than the Go core. In general, they will support the previous two releases and tip.
These repositories should have no third-party dependencies apart from other golang.org/x/... repositories. The only exceptions are [golang.org/x/tools/gopls](https://pkg.go.dev/golang.org/x/tools/gopls), [golang.org/x/vscode-go](https://go.googlesource.com/vscode-go), and [golang.org/x/pkgsite](https://pkg.go.dev/golang.org/x/pkgsite). If you would like to add a new dependency to an x repository, please [file an issue](https://github.com/golang/go/issues/new) and cc [@rsc](http://github.com/rsc) and [@andybons](https://github.com/andybons).
@ -15,7 +15,7 @@ Install them with "go get".
* [[docs](https://pkg.go.dev/golang.org/x/sys)] [[source](https://go.googlesource.com/sys)] ` golang.org/x/sys ` — for low-level interactions with the operating system.
* [[docs](https://pkg.go.dev/golang.org/x/text)] [[source](https://go.googlesource.com/text)] ` golang.org/x/text ` — packages for working with text.
* [[docs](https://pkg.go.dev/golang.org/x/blog)] [[source](https://go.googlesource.com/blog)] ` golang.org/x/blog ` — the content and server program for [blog.golang.org](http://blog.golang.org).
* [[docs](https://pkg.go.dev/golang.org/x/blog)] [[source](https://go.googlesource.com/blog)] ` golang.org/x/blog ` — the content and server program for [blog.golang.org](https://go.dev/blog).
* [[docs](https://pkg.go.dev/golang.org/x/review)] [[source](https://go.googlesource.com/review)] ` golang.org/x/review ` — tools for code review.

@ -1,3 +1,3 @@
<!-- STOP. PRESS THE BACK BUTTON. DO NOT EDIT. DO NOT CLICK "SAVE PAGE". -->
<!-- If you have a question, see https://golang.org/wiki/Questions -->
<!-- If you have a question, see https://go.dev/wiki/Questions -->
<!-- This is a wiki. We trust you to be a good person. -->

12
cgo.md

@ -1,8 +1,8 @@
# Introduction
First, http://golang.org/cmd/cgo is the primary cgo documentation.
First, https://pkg.go.dev/cmd/cgo is the primary cgo documentation.
There is also a good introduction article at http://golang.org/doc/articles/c_go_cgo.html.
There is also a good introduction article at https://go.dev/blog/cgo
## The basics
@ -74,12 +74,12 @@ foo.c contains:
void ACFunction() {
printf("ACFunction()\n");
AGoFunction();
}
}
```
### Function variables
The following code shows an example of invoking a Go callback from C code. Because of the [pointer passing rules](https://golang.org/cmd/cgo/#hdr-Passing_pointers) Go code can not pass a function value directly to C. Instead it is necessary to use an indirection. This example uses a registry with a mutex, but there are many other ways to map from a value that can be passed to C to a Go function.
The following code shows an example of invoking a Go callback from C code. Because of the [pointer passing rules](https://pkg.go.dev/cmd/cgo/#hdr-Passing_pointers) Go code can not pass a function value directly to C. Instead it is necessary to use an indirection. This example uses a registry with a mutex, but there are many other ways to map from a value that can be passed to C to a Go function.
```go
package gocallback
@ -309,7 +309,7 @@ C arrays are typically either null-terminated or have a length kept elsewhere.
Go provides the following function to make a new Go byte slice from a C array:
* ` func C.GoBytes(cArray unsafe.Pointer, length C.int) []byte `
To create a Go slice backed by a C array (without copying the original data), one needs to acquire this length at runtime and use a type conversion to a pointer to a very big array and then slice it to the length that you want (also remember to set the cap if you're using Go 1.2 or later), for example (see http://play.golang.org/p/XuC0xqtAIC for a runnable example):
To create a Go slice backed by a C array (without copying the original data), one needs to acquire this length at runtime and use a type conversion to a pointer to a very big array and then slice it to the length that you want (also remember to set the cap if you're using Go 1.2 or later), for example (see https://go.dev/play/p/XuC0xqtAIC for a runnable example):
```go
import "C"
@ -379,4 +379,4 @@ Go os.Getenv() doesn't see variables set by C.setenv()
### tests
_test.go files can't use cgo.
_test.go files can't use cgo.

@ -8,7 +8,7 @@ The golang-tools working group is useful for:
* experimenting with a group of "trusted testers"
* external proof-reading of proposals, blog posts etc
A key goal of the golang-tools group is that all forums of communication, but especially the regular calls, are friendly and welcoming. We want to create an environment in which everyone feels both supported and able to share their opinions and experience, frankly, freely, and openly. The wider [Go Code of Conduct](https://golang.org/conduct), which we observe just like all other Go forums, summarises this well.
A key goal of the golang-tools group is that all forums of communication, but especially the regular calls, are friendly and welcoming. We want to create an environment in which everyone feels both supported and able to share their opinions and experience, frankly, freely, and openly. The wider [Go Code of Conduct](https://go.dev/conduct), which we observe just like all other Go forums, summarises this well.
# Community spaces
@ -30,7 +30,7 @@ Like the other discussion spaces these calls are open to anyone and people new t
### Shared Calendar
As of October 2020, all calls/events will be added to the [shared calendar](https://calendar.google.com/calendar/u/0?cid=Y19vNjYyZXR1YTZlNTdsNW9kdDI0M2w5ZmxiOEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t).
As of October 2020, all calls/events will be added to the [shared calendar](https://calendar.google.com/calendar/u/0?cid=Y19vNjYyZXR1YTZlNTdsNW9kdDI0M2w5ZmxiOEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t).
### Upcoming calls
@ -86,4 +86,4 @@ We try to share the load of organizing and running the calls between Gophers ins
3. Update this wiki, archiving the previous call and linking the new upcoming call.
4. Update the [shared calendar](https://calendar.google.com/calendar/u/0?cid=Y19vNjYyZXR1YTZlNTdsNW9kdDI0M2w5ZmxiOEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t) with the new event. By convention calls run from 16:30-17:30 London.
5. Send reminders 1-2 weeks before the call date to the [mailing list](https://groups.google.com/forum/#!forum/golang-tools) and #tools slack channel.
6. On the day of the call, remember to ask a Googler to start recording, and then run through the agenda.
6. On the day of the call, remember to ask a Googler to start recording, and then run through the agenda.

@ -30,7 +30,7 @@ As always, patches are welcome!
## Backporting issues
gopherbot is capable of opening backport issues according to [MinorReleases](https://golang.org/wiki/MinorReleases) in response to comments like the following on the main issue.
gopherbot is capable of opening backport issues according to [MinorReleases](https://go.dev/wiki/MinorReleases) in response to comments like the following on the main issue.
> @gopherbot please consider this for backport to 1.10, it's a regression.
@ -38,4 +38,4 @@ gopherbot is capable of opening backport issues according to [MinorReleases](htt
The keywords are `@gopherbot`, `backport`, `please` and optionally the release. They can be anywhere in the comment. If no release is mentioned issues are opened for the two past releases. The entire message is quoted in the new issue, so please include a rationale.
(Note that currently only the first backport command on an issue is executed. https://golang.org/issues/25574)
(Note that currently only the first backport command on an issue is executed. https://go.dev/issues/25574)

@ -131,7 +131,7 @@ This finalizer has been registered with the runtime system, but the object to wh
# memstats
Dumps the first 26 fields of [MemStats](http://golang.org/pkg/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints.
Dumps the first 26 fields of [MemStats](https://pkg.go.dev/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints.
# queuedfinalizer
* uvarint: address of object that has a finalizer

@ -126,7 +126,7 @@ This finalizer has been registered with the runtime system, but the object to wh
# memstats
Dumps the first 26 fields of [MemStats](http://golang.org/pkg/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints.
Dumps the first 26 fields of [MemStats](https://pkg.go.dev/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints.
# queuedfinalizer
* uvarint: address of object that has a finalizer

@ -128,7 +128,7 @@ This finalizer has been registered with the runtime system, but the object to wh
# memstats
Records the following fields of [runtime.MemStats](http://golang.org/pkg/runtime/#MemStats):
Records the following fields of [runtime.MemStats](https://pkg.go.dev/runtime/#MemStats):
* uvarint: Alloc
* uvarint: TotalAlloc
* uvarint: Sys