content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
<!--{
|
2022-09-21 19:10:59 +03:00
|
|
|
"Title": "Return a random greeting",
|
|
|
|
"Breadcrumb": true
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
}-->
|
|
|
|
|
|
|
|
<p>
|
|
|
|
In this section, you'll change your code so that instead of returning a single
|
|
|
|
greeting every time, it returns one of several predefined greeting messages.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<aside class="Note">
|
|
|
|
<strong>Note:</strong> This topic is part of a multi-part tutorial that begins
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
with <a href="/doc/tutorial/create-module.html">Create a Go module</a>.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</aside>
|
|
|
|
|
|
|
|
<p>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
To do this, you'll use a Go slice. A slice is like an array, except that its
|
|
|
|
size changes dynamically as you add and remove items. The slice is one of Go's
|
|
|
|
most useful types.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
You'll add a small slice to contain three greeting messages, then have your
|
|
|
|
code return one of the messages randomly. For more on slices,
|
|
|
|
see <a href="https://blog.golang.org/slices-intro">Go slices</a> in the Go
|
|
|
|
blog.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<ol>
|
|
|
|
<li>
|
|
|
|
In greetings/greetings.go, change your code so it looks like the following.
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
package greetings
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
<ins>"math/rand"
|
|
|
|
"time"</ins>
|
|
|
|
)
|
|
|
|
|
|
|
|
// Hello returns a greeting for the named person.
|
|
|
|
func Hello(name string) (string, error) {
|
|
|
|
// If no name was given, return an error with a message.
|
|
|
|
if name == "" {
|
|
|
|
return name, errors.New("empty name")
|
|
|
|
}
|
|
|
|
// Create a message using a random format.
|
|
|
|
message := fmt.Sprintf(<ins>randomFormat()</ins>, name)
|
|
|
|
return message, nil
|
|
|
|
}
|
|
|
|
|
2023-03-10 10:39:44 +03:00
|
|
|
<ins>// randomFormat returns one of a set of greeting messages. The returned
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
// message is selected at random.
|
|
|
|
func randomFormat() string {
|
|
|
|
// A slice of message formats.
|
|
|
|
formats := []string{
|
|
|
|
"Hi, %v. Welcome!",
|
|
|
|
"Great to see you, %v!",
|
|
|
|
"Hail, %v! Well met!",
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return a randomly selected message format by specifying
|
|
|
|
// a random index for the slice of formats.
|
|
|
|
return formats[rand.Intn(len(formats))]
|
|
|
|
}</ins>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
In this code, you:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
Add a <code>randomFormat</code> function that returns a randomly
|
|
|
|
selected format for a greeting message. Note that
|
|
|
|
<code>randomFormat</code> starts with a lowercase letter, making it
|
|
|
|
accessible only to code in its own package (in other words, it's not
|
|
|
|
exported).
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
In <code>randomFormat</code>, declare a <code>formats</code> slice with
|
|
|
|
three message formats. When declaring a slice, you omit its size in the
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
brackets, like this: <code>[]string</code>. This tells Go that the size
|
|
|
|
of the array underlying the slice can be dynamically changed.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
Use the
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
<a href="https://pkg.go.dev/math/rand/"
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
><code>math/rand</code> package</a
|
|
|
|
>
|
|
|
|
to generate a random number for selecting an item from the slice.
|
|
|
|
</li>
|
|
|
|
<li>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
Add an <code>init</code> function to seed the <code>rand</code> package
|
|
|
|
with the current time. Go executes <code>init</code> functions
|
|
|
|
automatically at program startup, after global variables have been
|
|
|
|
initialized. For more about <code>init</code> functions, see
|
|
|
|
<a href="/doc/effective_go.html#init">Effective Go</a>.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
In <code>Hello</code>, call the <code>randomFormat</code> function to
|
|
|
|
get a format for the message you'll return, then use the format and
|
|
|
|
<code>name</code> value together to create the message.
|
|
|
|
</li>
|
|
|
|
<li>Return the message (or an error) as you did before.</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
In hello/hello.go, change your code so it looks like the following.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
<p>You're just adding Gladys's name (or a different name, if you like)
|
|
|
|
as an argument to the <code>Hello</code> function call in hello.go.</p>
|
|
|
|
|
|
|
|
<pre>package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"example.com/greetings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Set properties of the predefined Logger, including
|
|
|
|
// the log entry prefix and a flag to disable printing
|
|
|
|
// the time, source file, and line number.
|
|
|
|
log.SetPrefix("greetings: ")
|
|
|
|
log.SetFlags(0)
|
|
|
|
|
|
|
|
// Request a greeting message.
|
|
|
|
<ins>message, err := greetings.Hello("Gladys")</ins>
|
|
|
|
// If an error was returned, print it to the console and
|
|
|
|
// exit the program.
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// If no error was returned, print the returned message
|
|
|
|
// to the console.
|
|
|
|
fmt.Println(message)
|
|
|
|
}</pre>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
At the command line, in the hello directory, run hello.go to confirm that
|
|
|
|
the code works. Run it multiple times, noticing that the greeting changes.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
|
|
|
|
<pre>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
$ go run .
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
Great to see you, Gladys!
|
|
|
|
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
$ go run .
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
Hi, Gladys. Welcome!
|
|
|
|
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
$ go run .
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
Hail, Gladys! Well met!
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
</pre>
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
<p>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
Next, you'll use a slice to greet multiple people.
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="Navigation">
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
<a class="Navigation-prev" href="/doc/tutorial/handle-errors.html"
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
>< Return and handle an error</a
|
|
|
|
>
|
_content/doc: fix module and tutorial bugs and clean up flow
For golang/go#44241
- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241
Other changes in multiple topics:
- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
paths. Hopefully, this will reinforce the idea that the module
path should typically include a domain. Docs will use
something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
packages and commands.
- Rewrite a few links so that they include the topic title,
rather than simply inline text. Left those links whose
destinations are references -- the item's name seems to
suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.
Changes in the module tutorial:
- Add text to help clarify that there should be a hello and
greetings directory as siblings in their directory hierarchy.
Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
code is added. This is intended to reinforce the importance of
the module's presence.
- In require/replace steps, have the user use `go mod edit`
rather than editing the go.mod file in an editor. The tools
are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
rather than `go build` or `go run <filename>`. This removes
the impedance of explanation and more commands, while
moving the explanation of `go build` and `go install` to
a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
rather abruptly before.
- Minor edits to remove some redundant language.
Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-03-01 18:42:43 +03:00
|
|
|
<a class="Navigation-next" href="/doc/tutorial/greetings-multiple-people.html"
|
content/static/doc: improve getting started docs with install topic and tutorials
The existing install topic includes content that is likely not needed by
most new users, including system requirements, content on installing
multiple versions, and so on. This change separates the most common install
case content into its own topic and moves some of the less commonly used
content into a separate topic.
This change also includes an introductory tutorial that might be useful for
new users, particularly those coming from a different language. A second
multi-part tutorial continues the introduction with fundamental programming
topics connected by a narrative thread and featuring links to other related
parts of the docs.
This change includes:
- A simpler "Download and install" topic that replaces Getting started.
Topic is designed to help users focus on what they need for a given OS.
- A new "Managing Go installations" topic that holds content about
installing that is likely not in the most common workflow (including
uninstall, multiple versions).
- A minor change that adds a link to the install-source topic.
- A single-page Hello World tutorial.
- A multi-part tutorial that introduces fundamental programming concepts
from a Go perspective (functions, loops, errors, slices, maps, and so on).
- An index file that lists the tutorials.
- CSS to style "Note" sections, tabbed sections, table, and highlighted
code.
- A JavaScript file with code for the install page.
This change also creates on golang/website a version of install.html and
install-source.html, which would be deleted from the golang/go repository
(effectively moving the files).
For golang/go#40496
Change-Id: I2af6f5fbbcfcf887c8698919666155cc40ce0d03
Reviewed-on: https://go-review.googlesource.com/c/website/+/246499
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 21:34:38 +03:00
|
|
|
>Return greetings for multiple people ></a
|
|
|
|
>
|
|
|
|
</p>
|