content/static/doc/tutorial: don't "go run" individual files

Go packages are implicitly made of all the files in a directory,
filtered by build tags. This is a core mechanic of using Go and of
contributing to Go projects. It's also different from many other
languages, including C and Rust, where code in different compilation
units can coexist in the same directory.

The only exception is when Go files are specified on the command line,
in which case a synthetic command-line-arguments package is composed
from them, ignoring build tags.

I don't think it helps beginners to expose them to this exception which
they would otherwise probably never make any use of.

This CL was motivated by hearing of a beginner being confused trying to
contribute to an existing project, because they were trying to "go run"
an individual file, which was failing with a wall of error because of
all the missing symbols from the other files in the package.

Change-Id: Iec0ef73df1c5ada2299d059dd468dc2095c367a8
Reviewed-on: https://go-review.googlesource.com/c/website/+/283635
Trust: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
2 files changed
tree: 9617e26ebcede97c68d05e7c4b57a3607e88cb06
  1. cmd/
  2. content/
  3. internal/
  4. .prettierrc
  5. AUTHORS
  6. codereview.cfg
  7. CONTRIBUTING.md
  8. CONTRIBUTORS
  9. favicon.ico
  10. go.mod
  11. go.sum
  12. LICENSE
  13. PATENTS
  14. README.md
  15. robots.txt
README.md

Go website

Go Reference

This repository holds the Go website server code and content.

Checkout and Run

To download and run the golang.org web server locally:

  • git clone https://go.googlesource.com/website
  • cd website
  • go run ./cmd/golangorg
  • Open http://localhost:6060/ in your browser.

See cmd/golangorg/README.md for more details.

Changing Content

To make basic changes to the golang.org website content:

  • Make the changes you want in the content/static directory.
  • Stop any running go run ./cmd/golangorg.
  • go generate ./content/static
  • go run ./cmd/golangorg
  • Open http://localhost:6060/ in your browser.

See content/README.md for more sophisticated instructions.

JS/CSS Formatting

This repository uses prettier to format JS and CSS files.

The version of prettier used is 1.18.2.

It is encouraged that all JS and CSS code be run through this before submitting a change. However, it is not a strict requirement enforced by CI.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the website repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/website:” in the subject line, so it is easy to find.