From 99763cba2e5b53679a96f69725f917feb319b799 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 15 Nov 2019 15:27:00 -0500 Subject: [PATCH] static/doc: copy Code of Conduct, static/doc/conduct.html, from Go repo The Code of Conduct is copied from Go master as of Nov 15 2019 (9b68ef81e606) with a change to update the Project Stewards (now Carmen Andoh and Van Riper), and no other changes. This CL also updates static/gen.go to include this file and regenerated static/static.go. Change-Id: Ic639b821031f2ad41727728b3dc3b5b69e6d5265 Reviewed-on: https://go-review.googlesource.com/c/website/+/207437 Run-TryBot: Russ Cox Reviewed-by: Dmitri Shuralyov --- cmd/golangorg/regtest_test.go | 4 + content/static/doc/conduct.html | 211 ++++++++++++++++++++++++++++++++ content/static/gen.go | 1 + content/static/static.go | 2 + 4 files changed, 218 insertions(+) create mode 100644 content/static/doc/conduct.html diff --git a/cmd/golangorg/regtest_test.go b/cmd/golangorg/regtest_test.go index 63f5ab6990..c6a5e11dbb 100644 --- a/cmd/golangorg/regtest_test.go +++ b/cmd/golangorg/regtest_test.go @@ -38,6 +38,10 @@ func TestLiveServer(t *testing.T) { Path: "/doc/", Substring: "an introduction to using modules in a simple project", }, + { + Path: "/conduct", + Substring: "Project Stewards", + }, { Path: "/doc/faq", Substring: "What is the purpose of the project", diff --git a/content/static/doc/conduct.html b/content/static/doc/conduct.html new file mode 100644 index 0000000000..076560d413 --- /dev/null +++ b/content/static/doc/conduct.html @@ -0,0 +1,211 @@ + + + + +

About

+ +

+Online communities include people from many different backgrounds. +The Go contributors are committed to providing a friendly, safe and welcoming +environment for all, regardless of gender identity and expression, sexual orientation, +disabilities, neurodiversity, physical appearance, body size, ethnicity, nationality, +race, age, religion, or similar personal characteristics. +

+ +

+The first goal of the Code of Conduct is to specify a baseline standard +of behavior so that people with different social values and communication +styles can talk about Go effectively, productively, and respectfully. +

+ +

+The second goal is to provide a mechanism for resolving conflicts in the +community when they arise. +

+ +

+The third goal of the Code of Conduct is to make our community welcoming to +people from different backgrounds. +Diversity is critical to the project; for Go to be successful, it needs +contributors and users from all backgrounds. +(See Go, Open Source, Community.) +

+ +

+We believe that healthy debate and disagreement are essential to a healthy project and community. +However, it is never ok to be disrespectful. +We value diverse opinions, but we value respectful behavior more. +

+ +

Gopher values

+ +

+These are the values to which people in the Go community (“Gophers”) should aspire. +

+ +
    +
  • Be friendly and welcoming +
  • Be patient +
      +
    • Remember that people have varying communication styles and that not + everyone is using their native language. + (Meaning and tone can be lost in translation.) +
    +
  • Be thoughtful +
      +
    • Productive communication requires effort. + Think about how your words will be interpreted. +
    • Remember that sometimes it is best to refrain entirely from commenting. +
    +
  • Be respectful +
      +
    • In particular, respect differences of opinion. +
    +
  • Be charitable +
      +
    • Interpret the arguments of others in good faith, do not seek to disagree. +
    • When we do disagree, try to understand why. +
    +
  • Avoid destructive behavior: +
      +
    • Derailing: stay on topic; if you want to talk about something else, + start a new conversation. +
    • Unconstructive criticism: don't merely decry the current state of affairs; + offer—or at least solicit—suggestions as to how things may be improved. +
    • Snarking (pithy, unproductive, sniping comments) +
    • Discussing potentially offensive or sensitive issues; + this all too often leads to unnecessary conflict. +
    • Microaggressions: brief and commonplace verbal, behavioral and + environmental indignities that communicate hostile, derogatory or negative + slights and insults to a person or group. +
    +
+ +

+People are complicated. +You should expect to be misunderstood and to misunderstand others; +when this inevitably occurs, resist the urge to be defensive or assign blame. +Try not to take offense where no offense was intended. +Give people the benefit of the doubt. +Even if the intent was to provoke, do not rise to it. +It is the responsibility of all parties to de-escalate conflict when it arises. +

+ +

Code of Conduct

+ +

Our Pledge

+ +

In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation.

+ +

Our Standards

+ +

Examples of behavior that contributes to creating a positive environment +include:

+ +
    +
  • Using welcoming and inclusive language
  • +
  • Being respectful of differing viewpoints and experiences
  • +
  • Gracefully accepting constructive criticism
  • +
  • Focusing on what is best for the community
  • +
  • Showing empathy towards other community members
  • +
+ +

Examples of unacceptable behavior by participants include:

+ +
    +
  • The use of sexualized language or imagery and unwelcome sexual attention or +advances
  • +
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • +
  • Public or private harassment
  • +
  • Publishing others’ private information, such as a physical or electronic +address, without explicit permission
  • +
  • Other conduct which could reasonably be considered inappropriate in a +professional setting
  • +
+ +

Our Responsibilities

+ +

Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior.

+ +

Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful.

+ +

Scope

+ +

This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers.

+ +

This Code of Conduct also applies outside the project spaces when the Project +Stewards have a reasonable belief that an individual’s behavior may have a +negative impact on the project or its community.

+ +

Conflict Resolution

+ +

We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct.

+ +

If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe.

+ +

Reports should be directed to Carmen Andoh and Van Riper, the +Go Project Stewards, at conduct@golang.org. +It is the Project Stewards’ duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out the Project Stewards, please email +the Google Open Source Programs Office at opensource@google.com.

+ +

We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone’s safety, we may take action without notice.

+ +

Attribution

+ +

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

+ +

Summary

+ +
    +
  • Treat everyone with respect and kindness. +
  • Be thoughtful in how you communicate. +
  • Don’t be destructive or inflammatory. +
  • If you encounter an issue, please mail conduct@golang.org. +
diff --git a/content/static/gen.go b/content/static/gen.go index bea4feb9e3..1ad726ea03 100644 --- a/content/static/gen.go +++ b/content/static/gen.go @@ -36,6 +36,7 @@ var files = []string{ "codewalkdir.html", "dirlist.html", "doc/code.html", + "doc/conduct.html", "doc/copyright.html", "doc/docs.html", "doc/root.html", diff --git a/content/static/static.go b/content/static/static.go index 3ab05017cb..2d277e8697 100644 --- a/content/static/static.go +++ b/content/static/static.go @@ -47,6 +47,8 @@ var Files = map[string]string{ "doc/code.html": "\x0a\x0aIntroduction\x0a\x0a

\x0aThis\x20document\x20demonstrates\x20the\x20development\x20of\x20a\x20simple\x20Go\x20package\x20and\x0aintroduces\x20the\x20go\x20tool,\x20the\x20standard\x20way\x20to\x20fetch,\x0abuild,\x20and\x20install\x20Go\x20packages\x20and\x20commands.\x0a

\x0a\x0a

\x0aThe\x20go\x20tool\x20requires\x20you\x20to\x20organize\x20your\x20code\x20in\x20a\x20specific\x0away.\x20Please\x20read\x20this\x20document\x20carefully.\x0aIt\x20explains\x20the\x20simplest\x20way\x20to\x20get\x20up\x20and\x20running\x20with\x20your\x20Go\x20installation.\x0a

\x0a\x0a

\x0aA\x20similar\x20explanation\x20is\x20available\x20as\x20a\x0ascreencast.\x0a

\x0a\x0a\x0aCode\x20organization\x0a\x0aOverview\x0a\x0a
    \x0a\x09
  • Go\x20programmers\x20typically\x20keep\x20all\x20their\x20Go\x20code\x20in\x20a\x20single\x20workspace.
  • \x0a\x09
  • A\x20workspace\x20contains\x20many\x20version\x20control\x20repositories\x0a\x09\x20\x20\x20\x20(managed\x20by\x20Git,\x20for\x20example).
  • \x0a\x09
  • Each\x20repository\x20contains\x20one\x20or\x20more\x20packages.
  • \x0a\x09
  • Each\x20package\x20consists\x20of\x20one\x20or\x20more\x20Go\x20source\x20files\x20in\x20a\x20single\x20directory.
  • \x0a\x09
  • The\x20path\x20to\x20a\x20package's\x20directory\x20determines\x20its\x20import\x20path.
  • \x0a
\x0a\x0a

\x0aNote\x20that\x20this\x20differs\x20from\x20other\x20programming\x20environments\x20in\x20which\x20every\x0aproject\x20has\x20a\x20separate\x20workspace\x20and\x20workspaces\x20are\x20closely\x20tied\x20to\x20version\x0acontrol\x20repositories.\x0a

\x0a\x0aWorkspaces\x0a\x0a

\x0aA\x20workspace\x20is\x20a\x20directory\x20hierarchy\x20with\x20two\x20directories\x20at\x20its\x20root:\x0a

\x0a\x0a
    \x0a
  • src\x20contains\x20Go\x20source\x20files,\x20and\x0a
  • bin\x20contains\x20executable\x20commands.\x0a
\x0a\x0a

\x0aThe\x20go\x20tool\x20builds\x20and\x20installs\x20binaries\x20to\x20the\x20bin\x20directory.\x0a

\x0a\x0a

\x0aThe\x20src\x20subdirectory\x20typically\x20contains\x20multiple\x20version\x20control\x0arepositories\x20(such\x20as\x20for\x20Git\x20or\x20Mercurial)\x20that\x20track\x20the\x20development\x20of\x20one\x0aor\x20more\x20source\x20packages.\x0a

\x0a\x0a

\x0aTo\x20give\x20you\x20an\x20idea\x20of\x20how\x20a\x20workspace\x20looks\x20in\x20practice,\x20here's\x20an\x20example:\x0a

\x0a\x0a
\x0abin/\x0a\x20\x20\x20\x20hello\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20executable\x0a\x20\x20\x20\x20outyet\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20executable\x0asrc/\x0a\x20\x20\x20\x20github.com/golang/example/\x0a\x20\x20\x20\x20\x20\x20\x20\x20.git/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Git\x20repository\x20metadata\x0a\x09hello/\x0a\x09\x20\x20\x20\x20hello.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20source\x0a\x09outyet/\x0a\x09\x20\x20\x20\x20main.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20source\x0a\x09\x20\x20\x20\x20main_test.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20test\x20source\x0a\x09stringutil/\x0a\x09\x20\x20\x20\x20reverse.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20package\x20source\x0a\x09\x20\x20\x20\x20reverse_test.go\x20\x20\x20\x20\x20\x20\x20\x20#\x20test\x20source\x0a\x20\x20\x20\x20golang.org/x/image/\x0a\x20\x20\x20\x20\x20\x20\x20\x20.git/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Git\x20repository\x20metadata\x0a\x09bmp/\x0a\x09\x20\x20\x20\x20reader.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20package\x20source\x0a\x09\x20\x20\x20\x20writer.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20package\x20source\x0a\x20\x20\x20\x20...\x20(many\x20more\x20repositories\x20and\x20packages\x20omitted)\x20...\x0a
\x0a\x0a

\x0aThe\x20tree\x20above\x20shows\x20a\x20workspace\x20containing\x20two\x20repositories\x0a(example\x20and\x20image).\x0aThe\x20example\x20repository\x20contains\x20two\x20commands\x20(hello\x0aand\x20outyet)\x20and\x20one\x20library\x20(stringutil).\x0aThe\x20image\x20repository\x20contains\x20the\x20bmp\x20package\x0aand\x20several\x20others.\x0a

\x0a\x0a

\x0aA\x20typical\x20workspace\x20contains\x20many\x20source\x20repositories\x20containing\x20many\x0apackages\x20and\x20commands.\x20Most\x20Go\x20programmers\x20keep\x20all\x20their\x20Go\x20source\x20code\x0aand\x20dependencies\x20in\x20a\x20single\x20workspace.\x0a

\x0a\x0a

\x0aNote\x20that\x20symbolic\x20links\x20should\x20not\x20be\x20used\x20to\x20link\x20files\x20or\x20directories\x20into\x20your\x20workspace.\x0a

\x0a\x0a

\x0aCommands\x20and\x20libraries\x20are\x20built\x20from\x20different\x20kinds\x20of\x20source\x20packages.\x0aWe\x20will\x20discuss\x20the\x20distinction\x20later.\x0a

\x0a\x0a\x0aThe\x20GOPATH\x20environment\x20variable\x0a\x0a

\x0aThe\x20GOPATH\x20environment\x20variable\x20specifies\x20the\x20location\x20of\x20your\x0aworkspace.\x20It\x20defaults\x20to\x20a\x20directory\x20named\x20go\x20inside\x20your\x20home\x20directory,\x0aso\x20$HOME/go\x20on\x20Unix,\x0a$home/go\x20on\x20Plan\x209,\x0aand\x20%USERPROFILE%\\go\x20(usually\x20C:\\Users\\YourName\\go)\x20on\x20Windows.\x0a

\x0a\x0a

\x0aIf\x20you\x20would\x20like\x20to\x20work\x20in\x20a\x20different\x20location,\x20you\x20will\x20need\x20to\x0aset\x20GOPATH\x0ato\x20the\x20path\x20to\x20that\x20directory.\x0a(Another\x20common\x20setup\x20is\x20to\x20set\x20GOPATH=$HOME.)\x0aNote\x20that\x20GOPATH\x20must\x20not\x20be\x20the\x0asame\x20path\x20as\x20your\x20Go\x20installation.\x0a

\x0a\x0a

\x0aThe\x20command\x20go\x20env\x20GOPATH\x0aprints\x20the\x20effective\x20current\x20GOPATH;\x0ait\x20prints\x20the\x20default\x20location\x20if\x20the\x20environment\x20variable\x20is\x20unset.\x0a

\x0a\x0a

\x0aFor\x20convenience,\x20add\x20the\x20workspace's\x20bin\x20subdirectory\x0ato\x20your\x20PATH:\x0a

\x0a\x0a
\x0a$\x20export\x20PATH=$PATH:$(go\x20env\x20GOPATH)/bin\x0a
\x0a\x0a

\x0aThe\x20scripts\x20in\x20the\x20rest\x20of\x20this\x20document\x20use\x20$GOPATH\x0ainstead\x20of\x20$(go\x20env\x20GOPATH)\x20for\x20brevity.\x0aTo\x20make\x20the\x20scripts\x20run\x20as\x20written\x0aif\x20you\x20have\x20not\x20set\x20GOPATH,\x0ayou\x20can\x20substitute\x20$HOME/go\x20in\x20those\x20commands\x0aor\x20else\x20run:\x0a

\x0a\x0a
\x0a$\x20export\x20GOPATH=$(go\x20env\x20GOPATH)\x0a
\x0a\x0a

\x0aTo\x20learn\x20more\x20about\x20the\x20GOPATH\x20environment\x20variable,\x20see\x0a'go\x20help\x20gopath'.\x0a

\x0a\x0aImport\x20paths\x0a\x0a

\x0aAn\x20import\x20path\x20is\x20a\x20string\x20that\x20uniquely\x20identifies\x20a\x20package.\x0aA\x20package's\x20import\x20path\x20corresponds\x20to\x20its\x20location\x20inside\x20a\x20workspace\x0aor\x20in\x20a\x20remote\x20repository\x20(explained\x20below).\x0a

\x0a\x0a

\x0aThe\x20packages\x20from\x20the\x20standard\x20library\x20are\x20given\x20short\x20import\x20paths\x20such\x20as\x0a\"fmt\"\x20and\x20\"net/http\".\x0aFor\x20your\x20own\x20packages,\x20you\x20must\x20choose\x20a\x20base\x20path\x20that\x20is\x20unlikely\x20to\x0acollide\x20with\x20future\x20additions\x20to\x20the\x20standard\x20library\x20or\x20other\x20external\x0alibraries.\x0a

\x0a\x0a

\x0aIf\x20you\x20keep\x20your\x20code\x20in\x20a\x20source\x20repository\x20somewhere,\x20then\x20you\x20should\x20use\x20the\x0aroot\x20of\x20that\x20source\x20repository\x20as\x20your\x20base\x20path.\x0aFor\x20instance,\x20if\x20you\x20have\x20a\x20GitHub\x20account\x20at\x0agithub.com/user,\x20that\x20should\x20be\x20your\x20base\x20path.\x0a

\x0a\x0a

\x0aNote\x20that\x20you\x20don't\x20need\x20to\x20publish\x20your\x20code\x20to\x20a\x20remote\x20repository\x20before\x20you\x0acan\x20build\x20it.\x20It's\x20just\x20a\x20good\x20habit\x20to\x20organize\x20your\x20code\x20as\x20if\x20you\x20will\x0apublish\x20it\x20someday.\x20In\x20practice\x20you\x20can\x20choose\x20any\x20arbitrary\x20path\x20name,\x0aas\x20long\x20as\x20it\x20is\x20unique\x20to\x20the\x20standard\x20library\x20and\x20greater\x20Go\x20ecosystem.\x0a

\x0a\x0a

\x0aWe'll\x20use\x20github.com/user\x20as\x20our\x20base\x20path.\x20Create\x20a\x20directory\x0ainside\x20your\x20workspace\x20in\x20which\x20to\x20keep\x20source\x20code:\x0a

\x0a\x0a
\x0a$\x20mkdir\x20-p\x20$GOPATH/src/github.com/user\x0a
\x0a\x0a\x0aYour\x20first\x20program\x0a\x0a

\x0aTo\x20compile\x20and\x20run\x20a\x20simple\x20program,\x20first\x20choose\x20a\x20package\x20path\x20(we'll\x20use\x0agithub.com/user/hello)\x20and\x20create\x20a\x20corresponding\x20package\x20directory\x0ainside\x20your\x20workspace:\x0a

\x0a\x0a
\x0a$\x20mkdir\x20$GOPATH/src/github.com/user/hello\x0a
\x0a\x0a

\x0aNext,\x20create\x20a\x20file\x20named\x20hello.go\x20inside\x20that\x20directory,\x0acontaining\x20the\x20following\x20Go\x20code.\x0a

\x0a\x0a
\x0apackage\x20main\x0a\x0aimport\x20\"fmt\"\x0a\x0afunc\x20main()\x20{\x0a\x09fmt.Println(\"Hello,\x20world.\")\x0a}\x0a
\x0a\x0a

\x0aNow\x20you\x20can\x20build\x20and\x20install\x20that\x20program\x20with\x20the\x20go\x20tool:\x0a

\x0a\x0a
\x0a$\x20go\x20install\x20github.com/user/hello\x0a
\x0a\x0a

\x0aNote\x20that\x20you\x20can\x20run\x20this\x20command\x20from\x20anywhere\x20on\x20your\x20system.\x20The\x0ago\x20tool\x20finds\x20the\x20source\x20code\x20by\x20looking\x20for\x20the\x0agithub.com/user/hello\x20package\x20inside\x20the\x20workspace\x20specified\x20by\x0aGOPATH.\x0a

\x0a\x0a

\x0aYou\x20can\x20also\x20omit\x20the\x20package\x20path\x20if\x20you\x20run\x20go\x20install\x20from\x20the\x0apackage\x20directory:\x0a

\x0a\x0a
\x0a$\x20cd\x20$GOPATH/src/github.com/user/hello\x0a$\x20go\x20install\x0a
\x0a\x0a

\x0aThis\x20command\x20builds\x20the\x20hello\x20command,\x20producing\x20an\x20executable\x0abinary.\x20It\x20then\x20installs\x20that\x20binary\x20to\x20the\x20workspace's\x20bin\x0adirectory\x20as\x20hello\x20(or,\x20under\x20Windows,\x20hello.exe).\x0aIn\x20our\x20example,\x20that\x20will\x20be\x20$GOPATH/bin/hello,\x20which\x20is\x0a$HOME/go/bin/hello.\x0a

\x0a\x0a

\x0aThe\x20go\x20tool\x20will\x20only\x20print\x20output\x20when\x20an\x20error\x20occurs,\x20so\x20if\x0athese\x20commands\x20produce\x20no\x20output\x20they\x20have\x20executed\x20successfully.\x0a

\x0a\x0a

\x0aYou\x20can\x20now\x20run\x20the\x20program\x20by\x20typing\x20its\x20full\x20path\x20at\x20the\x20command\x20line:\x0a

\x0a\x0a
\x0a$\x20$GOPATH/bin/hello\x0aHello,\x20world.\x0a
\x0a\x0a

\x0aOr,\x20as\x20you\x20have\x20added\x20$GOPATH/bin\x20to\x20your\x20PATH,\x0ajust\x20type\x20the\x20binary\x20name:\x0a

\x0a\x0a
\x0a$\x20hello\x0aHello,\x20world.\x0a
\x0a\x0a

\x0aIf\x20you're\x20using\x20a\x20source\x20control\x20system,\x20now\x20would\x20be\x20a\x20good\x20time\x20to\x20initialize\x0aa\x20repository,\x20add\x20the\x20files,\x20and\x20commit\x20your\x20first\x20change.\x20Again,\x20this\x20step\x20is\x0aoptional:\x20you\x20do\x20not\x20need\x20to\x20use\x20source\x20control\x20to\x20write\x20Go\x20code.\x0a

\x0a\x0a
\x0a$\x20cd\x20$GOPATH/src/github.com/user/hello\x0a$\x20git\x20init\x0aInitialized\x20empty\x20Git\x20repository\x20in\x20/home/user/go/src/github.com/user/hello/.git/\x0a$\x20git\x20add\x20hello.go\x0a$\x20git\x20commit\x20-m\x20\"initial\x20commit\"\x0a[master\x20(root-commit)\x200b4507d]\x20initial\x20commit\x0a\x201\x20file\x20changed,\x207\x20insertion(+)\x0a\x20create\x20mode\x20100644\x20hello.go\x0a
\x0a\x0a

\x0aPushing\x20the\x20code\x20to\x20a\x20remote\x20repository\x20is\x20left\x20as\x20an\x20exercise\x20for\x20the\x20reader.\x0a

\x0a\x0a\x0aYour\x20first\x20library\x0a\x0a

\x0aLet's\x20write\x20a\x20library\x20and\x20use\x20it\x20from\x20the\x20hello\x20program.\x0a

\x0a\x0a

\x0aAgain,\x20the\x20first\x20step\x20is\x20to\x20choose\x20a\x20package\x20path\x20(we'll\x20use\x0agithub.com/user/stringutil)\x20and\x20create\x20the\x20package\x20directory:\x0a

\x0a\x0a
\x0a$\x20mkdir\x20$GOPATH/src/github.com/user/stringutil\x0a
\x0a\x0a

\x0aNext,\x20create\x20a\x20file\x20named\x20reverse.go\x20in\x20that\x20directory\x20with\x20the\x0afollowing\x20contents.\x0a

\x0a\x0a
\x0a//\x20Package\x20stringutil\x20contains\x20utility\x20functions\x20for\x20working\x20with\x20strings.\x0apackage\x20stringutil\x0a\x0a//\x20Reverse\x20returns\x20its\x20argument\x20string\x20reversed\x20rune-wise\x20left\x20to\x20right.\x0afunc\x20Reverse(s\x20string)\x20string\x20{\x0a\x09r\x20:=\x20[]rune(s)\x0a\x09for\x20i,\x20j\x20:=\x200,\x20len(r)-1;\x20i\x20<\x20len(r)/2;\x20i,\x20j\x20=\x20i+1,\x20j-1\x20{\x0a\x09\x09r[i],\x20r[j]\x20=\x20r[j],\x20r[i]\x0a\x09}\x0a\x09return\x20string(r)\x0a}\x0a
\x0a\x0a

\x0aNow,\x20test\x20that\x20the\x20package\x20compiles\x20with\x20go\x20build:\x0a

\x0a\x0a
\x0a$\x20go\x20build\x20github.com/user/stringutil\x0a
\x0a\x0a

\x0aOr,\x20if\x20you\x20are\x20working\x20in\x20the\x20package's\x20source\x20directory,\x20just:\x0a

\x0a\x0a
\x0a$\x20go\x20build\x0a
\x0a\x0a

\x0aThis\x20won't\x20produce\x20an\x20output\x20file.\x0aInstead\x20it\x20saves\x20the\x20compiled\x20package\x20in\x20the\x20local\x20build\x20cache.\x0a

\x0a\x0a

\x0aAfter\x20confirming\x20that\x20the\x20stringutil\x20package\x20builds,\x0amodify\x20your\x20original\x20hello.go\x20(which\x20is\x20in\x0a$GOPATH/src/github.com/user/hello)\x20to\x20use\x20it:\x0a

\x0a\x0a
\x0apackage\x20main\x0a\x0aimport\x20(\x0a\x09\"fmt\"\x0a\x0a\x09\"github.com/user/stringutil\"\x0a)\x0a\x0afunc\x20main()\x20{\x0a\x09fmt.Println(stringutil.Reverse(\"!oG\x20,olleH\"))\x0a}\x0a
\x0a\x0a

\x0aInstall\x20the\x20hello\x20program:\x0a

\x0a\x0a
\x0a$\x20go\x20install\x20github.com/user/hello\x0a
\x0a\x0a

\x0aRunning\x20the\x20new\x20version\x20of\x20the\x20program,\x20you\x20should\x20see\x20a\x20new,\x20reversed\x20message:\x0a

\x0a\x0a
\x0a$\x20hello\x0aHello,\x20Go!\x0a
\x0a\x0a

\x0aAfter\x20the\x20steps\x20above,\x20your\x20workspace\x20should\x20look\x20like\x20this:\x0a

\x0a\x0a
\x0abin/\x0a\x20\x20\x20\x20hello\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20executable\x0asrc/\x0a\x20\x20\x20\x20github.com/user/\x0a\x20\x20\x20\x20\x20\x20\x20\x20hello/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20hello.go\x20\x20\x20\x20\x20\x20#\x20command\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20stringutil/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reverse.go\x20\x20\x20\x20#\x20package\x20source\x0a
\x0a\x0aPackage\x20names\x0a\x0a

\x0aThe\x20first\x20statement\x20in\x20a\x20Go\x20source\x20file\x20must\x20be\x0a

\x0a\x0a
\x0apackage\x20name\x0a
\x0a\x0a

\x0awhere\x20name\x20is\x20the\x20package's\x20default\x20name\x20for\x20imports.\x0a(All\x20files\x20in\x20a\x20package\x20must\x20use\x20the\x20same\x20name.)\x0a

\x0a\x0a

\x0aGo's\x20convention\x20is\x20that\x20the\x20package\x20name\x20is\x20the\x20last\x20element\x20of\x20the\x0aimport\x20path:\x20the\x20package\x20imported\x20as\x20\"crypto/rot13\"\x0ashould\x20be\x20named\x20rot13.\x0a

\x0a\x0a

\x0aExecutable\x20commands\x20must\x20always\x20use\x20package\x20main.\x0a

\x0a\x0a

\x0aThere\x20is\x20no\x20requirement\x20that\x20package\x20names\x20be\x20unique\x0aacross\x20all\x20packages\x20linked\x20into\x20a\x20single\x20binary,\x0aonly\x20that\x20the\x20import\x20paths\x20(their\x20full\x20file\x20names)\x20be\x20unique.\x0a

\x0a\x0a

\x0aSee\x20Effective\x20Go\x20to\x20learn\x20more\x20about\x0aGo's\x20naming\x20conventions.\x0a

\x0a\x0a\x0aTesting\x0a\x0a

\x0aGo\x20has\x20a\x20lightweight\x20test\x20framework\x20composed\x20of\x20the\x20go\x20test\x0acommand\x20and\x20the\x20testing\x20package.\x0a

\x0a\x0a

\x0aYou\x20write\x20a\x20test\x20by\x20creating\x20a\x20file\x20with\x20a\x20name\x20ending\x20in\x20_test.go\x0athat\x20contains\x20functions\x20named\x20TestXXX\x20with\x20signature\x0afunc\x20(t\x20*testing.T).\x0aThe\x20test\x20framework\x20runs\x20each\x20such\x20function;\x0aif\x20the\x20function\x20calls\x20a\x20failure\x20function\x20such\x20as\x20t.Error\x20or\x0at.Fail,\x20the\x20test\x20is\x20considered\x20to\x20have\x20failed.\x0a

\x0a\x0a

\x0aAdd\x20a\x20test\x20to\x20the\x20stringutil\x20package\x20by\x20creating\x20the\x20file\x0a$GOPATH/src/github.com/user/stringutil/reverse_test.go\x20containing\x0athe\x20following\x20Go\x20code.\x0a

\x0a\x0a
\x0apackage\x20stringutil\x0a\x0aimport\x20\"testing\"\x0a\x0afunc\x20TestReverse(t\x20*testing.T)\x20{\x0a\x09cases\x20:=\x20[]struct\x20{\x0a\x09\x09in,\x20want\x20string\x0a\x09}{\x0a\x09\x09{\"Hello,\x20world\",\x20\"dlrow\x20,olleH\"},\x0a\x09\x09{\"Hello,\x20\xe4\xb8\x96\xe7\x95\x8c\",\x20\"\xe7\x95\x8c\xe4\xb8\x96\x20,olleH\"},\x0a\x09\x09{\"\",\x20\"\"},\x0a\x09}\x0a\x09for\x20_,\x20c\x20:=\x20range\x20cases\x20{\x0a\x09\x09got\x20:=\x20Reverse(c.in)\x0a\x09\x09if\x20got\x20!=\x20c.want\x20{\x0a\x09\x09\x09t.Errorf(\"Reverse(%q)\x20==\x20%q,\x20want\x20%q\",\x20c.in,\x20got,\x20c.want)\x0a\x09\x09}\x0a\x09}\x0a}\x0a
\x0a\x0a

\x0aThen\x20run\x20the\x20test\x20with\x20go\x20test:\x0a

\x0a\x0a
\x0a$\x20go\x20test\x20github.com/user/stringutil\x0aok\x20\x20\x09github.com/user/stringutil\x200.165s\x0a
\x0a\x0a

\x0aAs\x20always,\x20if\x20you\x20are\x20running\x20the\x20go\x20tool\x20from\x20the\x20package\x0adirectory,\x20you\x20can\x20omit\x20the\x20package\x20path:\x0a

\x0a\x0a
\x0a$\x20go\x20test\x0aok\x20\x20\x09github.com/user/stringutil\x200.165s\x0a
\x0a\x0a

\x0aRun\x20go\x20help\x20test\x20and\x20see\x20the\x0atesting\x20package\x20documentation\x20for\x20more\x20detail.\x0a

\x0a\x0a\x0aRemote\x20packages\x0a\x0a

\x0aAn\x20import\x20path\x20can\x20describe\x20how\x20to\x20obtain\x20the\x20package\x20source\x20code\x20using\x20a\x0arevision\x20control\x20system\x20such\x20as\x20Git\x20or\x20Mercurial.\x20The\x20go\x20tool\x20uses\x0athis\x20property\x20to\x20automatically\x20fetch\x20packages\x20from\x20remote\x20repositories.\x0aFor\x20instance,\x20the\x20examples\x20described\x20in\x20this\x20document\x20are\x20also\x20kept\x20in\x20a\x0aGit\x20repository\x20hosted\x20at\x20GitHub\x0agithub.com/golang/example.\x0aIf\x20you\x20include\x20the\x20repository\x20URL\x20in\x20the\x20package's\x20import\x20path,\x0ago\x20get\x20will\x20fetch,\x20build,\x20and\x20install\x20it\x20automatically:\x0a

\x0a\x0a
\x0a$\x20go\x20get\x20github.com/golang/example/hello\x0a$\x20$GOPATH/bin/hello\x0aHello,\x20Go\x20examples!\x0a
\x0a\x0a

\x0aIf\x20the\x20specified\x20package\x20is\x20not\x20present\x20in\x20a\x20workspace,\x20go\x20get\x0awill\x20place\x20it\x20inside\x20the\x20first\x20workspace\x20specified\x20by\x20GOPATH.\x0a(If\x20the\x20package\x20does\x20already\x20exist,\x20go\x20get\x20skips\x20the\x20remote\x0afetch\x20and\x20behaves\x20the\x20same\x20as\x20go\x20install.)\x0a

\x0a\x0a

\x0aAfter\x20issuing\x20the\x20above\x20go\x20get\x20command,\x20the\x20workspace\x20directory\x0atree\x20should\x20now\x20look\x20like\x20this:\x0a

\x0a\x0a
\x0abin/\x0a\x20\x20\x20\x20hello\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20executable\x0asrc/\x0a\x20\x20\x20\x20github.com/golang/example/\x0a\x09.git/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Git\x20repository\x20metadata\x0a\x20\x20\x20\x20\x20\x20\x20\x20hello/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20hello.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20stringutil/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reverse.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20package\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reverse_test.go\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20test\x20source\x0a\x20\x20\x20\x20github.com/user/\x0a\x20\x20\x20\x20\x20\x20\x20\x20hello/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20hello.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20command\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20stringutil/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reverse.go\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20package\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reverse_test.go\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20test\x20source\x0a
\x0a\x0a

\x0aThe\x20hello\x20command\x20hosted\x20at\x20GitHub\x20depends\x20on\x20the\x0astringutil\x20package\x20within\x20the\x20same\x20repository.\x20The\x20imports\x20in\x0ahello.go\x20file\x20use\x20the\x20same\x20import\x20path\x20convention,\x20so\x20the\x0ago\x20get\x20command\x20is\x20able\x20to\x20locate\x20and\x20install\x20the\x20dependent\x0apackage,\x20too.\x0a

\x0a\x0a
\x0aimport\x20\"github.com/golang/example/stringutil\"\x0a
\x0a\x0a

\x0aThis\x20convention\x20is\x20the\x20easiest\x20way\x20to\x20make\x20your\x20Go\x20packages\x20available\x20for\x0aothers\x20to\x20use.\x0aThe\x20Go\x20Wiki\x0aand\x20godoc.org\x0aprovide\x20lists\x20of\x20external\x20Go\x20projects.\x0a

\x0a\x0a

\x0aFor\x20more\x20information\x20on\x20using\x20remote\x20repositories\x20with\x20the\x20go\x20tool,\x20see\x0ago\x20help\x20importpath.\x0a

\x0a\x0a\x0aWhat's\x20next\x0a\x0a

\x0aSubscribe\x20to\x20the\x0agolang-announce\x0amailing\x20list\x20to\x20be\x20notified\x20when\x20a\x20new\x20stable\x20version\x20of\x20Go\x20is\x20released.\x0a

\x0a\x0a

\x0aSee\x20Effective\x20Go\x20for\x20tips\x20on\x20writing\x0aclear,\x20idiomatic\x20Go\x20code.\x0a

\x0a\x0a

\x0aTake\x20A\x20Tour\x20of\x20Go\x20to\x20learn\x20the\x20language\x0aproper.\x0a

\x0a\x0a

\x0aVisit\x20the\x20documentation\x20page\x20for\x20a\x20set\x20of\x20in-depth\x0aarticles\x20about\x20the\x20Go\x20language\x20and\x20its\x20libraries\x20and\x20tools.\x0a

\x0a\x0a\x0aGetting\x20help\x0a\x0a

\x0aFor\x20real-time\x20help,\x20ask\x20the\x20helpful\x20gophers\x20in\x20#go-nuts\x20on\x20the\x0aFreenode\x20IRC\x20server.\x0a

\x0a\x0a

\x0aThe\x20official\x20mailing\x20list\x20for\x20discussion\x20of\x20the\x20Go\x20language\x20is\x0aGo\x20Nuts.\x0a

\x0a\x0a

\x0aReport\x20bugs\x20using\x20the\x0aGo\x20issue\x20tracker.\x0a

\x0a", + "doc/conduct.html": "\x0a\x0a\x0a\x0aAbout\x0a\x0a

\x0aOnline\x20communities\x20include\x20people\x20from\x20many\x20different\x20backgrounds.\x0aThe\x20Go\x20contributors\x20are\x20committed\x20to\x20providing\x20a\x20friendly,\x20safe\x20and\x20welcoming\x0aenvironment\x20for\x20all,\x20regardless\x20of\x20gender\x20identity\x20and\x20expression,\x20sexual\x20orientation,\x0adisabilities,\x20neurodiversity,\x20physical\x20appearance,\x20body\x20size,\x20ethnicity,\x20nationality,\x0arace,\x20age,\x20religion,\x20or\x20similar\x20personal\x20characteristics.\x0a

\x0a\x0a

\x0aThe\x20first\x20goal\x20of\x20the\x20Code\x20of\x20Conduct\x20is\x20to\x20specify\x20a\x20baseline\x20standard\x0aof\x20behavior\x20so\x20that\x20people\x20with\x20different\x20social\x20values\x20and\x20communication\x0astyles\x20can\x20talk\x20about\x20Go\x20effectively,\x20productively,\x20and\x20respectfully.\x0a

\x0a\x0a

\x0aThe\x20second\x20goal\x20is\x20to\x20provide\x20a\x20mechanism\x20for\x20resolving\x20conflicts\x20in\x20the\x0acommunity\x20when\x20they\x20arise.\x0a

\x0a\x0a

\x0aThe\x20third\x20goal\x20of\x20the\x20Code\x20of\x20Conduct\x20is\x20to\x20make\x20our\x20community\x20welcoming\x20to\x0apeople\x20from\x20different\x20backgrounds.\x0aDiversity\x20is\x20critical\x20to\x20the\x20project;\x20for\x20Go\x20to\x20be\x20successful,\x20it\x20needs\x0acontributors\x20and\x20users\x20from\x20all\x20backgrounds.\x0a(See\x20Go,\x20Open\x20Source,\x20Community.)\x0a

\x0a\x0a

\x0aWe\x20believe\x20that\x20healthy\x20debate\x20and\x20disagreement\x20are\x20essential\x20to\x20a\x20healthy\x20project\x20and\x20community.\x0aHowever,\x20it\x20is\x20never\x20ok\x20to\x20be\x20disrespectful.\x0aWe\x20value\x20diverse\x20opinions,\x20but\x20we\x20value\x20respectful\x20behavior\x20more.\x0a

\x0a\x0aGopher\x20values\x0a\x0a

\x0aThese\x20are\x20the\x20values\x20to\x20which\x20people\x20in\x20the\x20Go\x20community\x20(\xe2\x80\x9cGophers\xe2\x80\x9d)\x20should\x20aspire.\x0a

\x0a\x0a
    \x0a
  • Be\x20friendly\x20and\x20welcoming\x0a
  • Be\x20patient\x0a\x20\x20\x20\x20
      \x0a\x20\x20\x20\x20
    • Remember\x20that\x20people\x20have\x20varying\x20communication\x20styles\x20and\x20that\x20not\x0a\x20\x20\x20\x20\x20\x20\x20\x20everyone\x20is\x20using\x20their\x20native\x20language.\x0a\x20\x20\x20\x20\x20\x20\x20\x20(Meaning\x20and\x20tone\x20can\x20be\x20lost\x20in\x20translation.)\x0a\x20\x20\x20\x20
    \x0a
  • Be\x20thoughtful\x0a\x20\x20\x20\x20
      \x0a\x20\x20\x20\x20
    • Productive\x20communication\x20requires\x20effort.\x0a\x20\x20\x20\x20\x20\x20\x20\x20Think\x20about\x20how\x20your\x20words\x20will\x20be\x20interpreted.\x0a\x20\x20\x20\x20
    • Remember\x20that\x20sometimes\x20it\x20is\x20best\x20to\x20refrain\x20entirely\x20from\x20commenting.\x0a\x20\x20\x20\x20
    \x0a
  • Be\x20respectful\x0a\x20\x20\x20\x20
      \x0a\x20\x20\x20\x20
    • In\x20particular,\x20respect\x20differences\x20of\x20opinion.\x0a\x20\x20\x20\x20
    \x0a
  • Be\x20charitable\x0a\x20\x20\x20\x20
      \x0a\x20\x20\x20\x20
    • Interpret\x20the\x20arguments\x20of\x20others\x20in\x20good\x20faith,\x20do\x20not\x20seek\x20to\x20disagree.\x0a\x20\x20\x20\x20
    • When\x20we\x20do\x20disagree,\x20try\x20to\x20understand\x20why.\x0a\x20\x20\x20\x20
    \x0a
  • Avoid\x20destructive\x20behavior:\x0a\x20\x20\x20\x20
      \x0a\x20\x20\x20\x20
    • Derailing:\x20stay\x20on\x20topic;\x20if\x20you\x20want\x20to\x20talk\x20about\x20something\x20else,\x0a\x20\x20\x20\x20\x20\x20\x20\x20start\x20a\x20new\x20conversation.\x0a\x20\x20\x20\x20
    • Unconstructive\x20criticism:\x20don't\x20merely\x20decry\x20the\x20current\x20state\x20of\x20affairs;\x0a\x20\x20\x20\x20\x20\x20\x20\x20offer\xe2\x80\x94or\x20at\x20least\x20solicit\xe2\x80\x94suggestions\x20as\x20to\x20how\x20things\x20may\x20be\x20improved.\x0a\x20\x20\x20\x20
    • Snarking\x20(pithy,\x20unproductive,\x20sniping\x20comments)\x0a\x20\x20\x20\x20
    • Discussing\x20potentially\x20offensive\x20or\x20sensitive\x20issues;\x0a\x20\x20\x20\x20\x20\x20\x20\x20this\x20all\x20too\x20often\x20leads\x20to\x20unnecessary\x20conflict.\x0a\x20\x20\x20\x20
    • Microaggressions:\x20brief\x20and\x20commonplace\x20verbal,\x20behavioral\x20and\x0a\x20\x20\x20\x20\x20\x20\x20\x20environmental\x20indignities\x20that\x20communicate\x20hostile,\x20derogatory\x20or\x20negative\x0a\x20\x20\x20\x20\x20\x20\x20\x20slights\x20and\x20insults\x20to\x20a\x20person\x20or\x20group.\x0a\x20\x20\x20\x20
    \x0a
\x0a\x0a

\x0aPeople\x20are\x20complicated.\x0aYou\x20should\x20expect\x20to\x20be\x20misunderstood\x20and\x20to\x20misunderstand\x20others;\x0awhen\x20this\x20inevitably\x20occurs,\x20resist\x20the\x20urge\x20to\x20be\x20defensive\x20or\x20assign\x20blame.\x0aTry\x20not\x20to\x20take\x20offense\x20where\x20no\x20offense\x20was\x20intended.\x0aGive\x20people\x20the\x20benefit\x20of\x20the\x20doubt.\x0aEven\x20if\x20the\x20intent\x20was\x20to\x20provoke,\x20do\x20not\x20rise\x20to\x20it.\x0aIt\x20is\x20the\x20responsibility\x20of\x20all\x20parties\x20to\x20de-escalate\x20conflict\x20when\x20it\x20arises.\x0a

\x0a\x0aCode\x20of\x20Conduct\x0a\x0aOur\x20Pledge\x0a\x0a

In\x20the\x20interest\x20of\x20fostering\x20an\x20open\x20and\x20welcoming\x20environment,\x20we\x20as\x0acontributors\x20and\x20maintainers\x20pledge\x20to\x20making\x20participation\x20in\x20our\x20project\x20and\x0aour\x20community\x20a\x20harassment-free\x20experience\x20for\x20everyone,\x20regardless\x20of\x20age,\x20body\x0asize,\x20disability,\x20ethnicity,\x20gender\x20identity\x20and\x20expression,\x20level\x20of\x0aexperience,\x20education,\x20socio-economic\x20status,\x20nationality,\x20personal\x20appearance,\x0arace,\x20religion,\x20or\x20sexual\x20identity\x20and\x20orientation.

\x0a\x0aOur\x20Standards\x0a\x0a

Examples\x20of\x20behavior\x20that\x20contributes\x20to\x20creating\x20a\x20positive\x20environment\x0ainclude:

\x0a\x0a
    \x0a
  • Using\x20welcoming\x20and\x20inclusive\x20language
  • \x0a
  • Being\x20respectful\x20of\x20differing\x20viewpoints\x20and\x20experiences
  • \x0a
  • Gracefully\x20accepting\x20constructive\x20criticism
  • \x0a
  • Focusing\x20on\x20what\x20is\x20best\x20for\x20the\x20community
  • \x0a
  • Showing\x20empathy\x20towards\x20other\x20community\x20members
  • \x0a
\x0a\x0a

Examples\x20of\x20unacceptable\x20behavior\x20by\x20participants\x20include:

\x0a\x0a
    \x0a
  • The\x20use\x20of\x20sexualized\x20language\x20or\x20imagery\x20and\x20unwelcome\x20sexual\x20attention\x20or\x0aadvances
  • \x0a
  • Trolling,\x20insulting/derogatory\x20comments,\x20and\x20personal\x20or\x20political\x20attacks
  • \x0a
  • Public\x20or\x20private\x20harassment
  • \x0a
  • Publishing\x20others’\x20private\x20information,\x20such\x20as\x20a\x20physical\x20or\x20electronic\x0aaddress,\x20without\x20explicit\x20permission
  • \x0a
  • Other\x20conduct\x20which\x20could\x20reasonably\x20be\x20considered\x20inappropriate\x20in\x20a\x0aprofessional\x20setting
  • \x0a
\x0a\x0aOur\x20Responsibilities\x0a\x0a

Project\x20maintainers\x20are\x20responsible\x20for\x20clarifying\x20the\x20standards\x20of\x20acceptable\x0abehavior\x20and\x20are\x20expected\x20to\x20take\x20appropriate\x20and\x20fair\x20corrective\x20action\x20in\x0aresponse\x20to\x20any\x20instances\x20of\x20unacceptable\x20behavior.

\x0a\x0a

Project\x20maintainers\x20have\x20the\x20right\x20and\x20responsibility\x20to\x20remove,\x20edit,\x20or\x20reject\x0acomments,\x20commits,\x20code,\x20wiki\x20edits,\x20issues,\x20and\x20other\x20contributions\x20that\x20are\x0anot\x20aligned\x20to\x20this\x20Code\x20of\x20Conduct,\x20or\x20to\x20ban\x20temporarily\x20or\x20permanently\x20any\x0acontributor\x20for\x20other\x20behaviors\x20that\x20they\x20deem\x20inappropriate,\x20threatening,\x0aoffensive,\x20or\x20harmful.

\x0a\x0aScope\x0a\x0a

This\x20Code\x20of\x20Conduct\x20applies\x20both\x20within\x20project\x20spaces\x20and\x20in\x20public\x20spaces\x0awhen\x20an\x20individual\x20is\x20representing\x20the\x20project\x20or\x20its\x20community.\x20Examples\x20of\x0arepresenting\x20a\x20project\x20or\x20community\x20include\x20using\x20an\x20official\x20project\x20e-mail\x0aaddress,\x20posting\x20via\x20an\x20official\x20social\x20media\x20account,\x20or\x20acting\x20as\x20an\x20appointed\x0arepresentative\x20at\x20an\x20online\x20or\x20offline\x20event.\x20Representation\x20of\x20a\x20project\x20may\x20be\x0afurther\x20defined\x20and\x20clarified\x20by\x20project\x20maintainers.

\x0a\x0a

This\x20Code\x20of\x20Conduct\x20also\x20applies\x20outside\x20the\x20project\x20spaces\x20when\x20the\x20Project\x0aStewards\x20have\x20a\x20reasonable\x20belief\x20that\x20an\x20individual’s\x20behavior\x20may\x20have\x20a\x0anegative\x20impact\x20on\x20the\x20project\x20or\x20its\x20community.

\x0a\x0aConflict\x20Resolution\x0a\x0a

We\x20do\x20not\x20believe\x20that\x20all\x20conflict\x20is\x20bad;\x20healthy\x20debate\x20and\x20disagreement\x0aoften\x20yield\x20positive\x20results.\x20However,\x20it\x20is\x20never\x20okay\x20to\x20be\x20disrespectful\x20or\x0ato\x20engage\x20in\x20behavior\x20that\x20violates\x20the\x20project\xe2\x80\x99s\x20code\x20of\x20conduct.

\x0a\x0a

If\x20you\x20see\x20someone\x20violating\x20the\x20code\x20of\x20conduct,\x20you\x20are\x20encouraged\x20to\x20address\x0athe\x20behavior\x20directly\x20with\x20those\x20involved.\x20Many\x20issues\x20can\x20be\x20resolved\x20quickly\x0aand\x20easily,\x20and\x20this\x20gives\x20people\x20more\x20control\x20over\x20the\x20outcome\x20of\x20their\x0adispute.\x20If\x20you\x20are\x20unable\x20to\x20resolve\x20the\x20matter\x20for\x20any\x20reason,\x20or\x20if\x20the\x0abehavior\x20is\x20threatening\x20or\x20harassing,\x20report\x20it.\x20We\x20are\x20dedicated\x20to\x20providing\x0aan\x20environment\x20where\x20participants\x20feel\x20welcome\x20and\x20safe.

\x0a\x0aReports\x20should\x20be\x20directed\x20to\x20Carmen\x20Andoh\x20and\x20Van\x20Riper,\x20the\x0aGo\x20Project\x20Stewards,\x20at\x20conduct@golang.org.\x0aIt\x20is\x20the\x20Project\x20Stewards\xe2\x80\x99\x20duty\x20to\x0areceive\x20and\x20address\x20reported\x20violations\x20of\x20the\x20code\x20of\x20conduct.\x20They\x20will\x20then\x0awork\x20with\x20a\x20committee\x20consisting\x20of\x20representatives\x20from\x20the\x20Open\x20Source\x0aPrograms\x20Office\x20and\x20the\x20Google\x20Open\x20Source\x20Strategy\x20team.\x20If\x20for\x20any\x20reason\x20you\x0aare\x20uncomfortable\x20reaching\x20out\x20the\x20Project\x20Stewards,\x20please\x20email\x0athe\x20Google\x20Open\x20Source\x20Programs\x20Office\x20at\x20opensource@google.com.

\x0a\x0a

We\x20will\x20investigate\x20every\x20complaint,\x20but\x20you\x20may\x20not\x20receive\x20a\x20direct\x20response.\x0aWe\x20will\x20use\x20our\x20discretion\x20in\x20determining\x20when\x20and\x20how\x20to\x20follow\x20up\x20on\x20reported\x0aincidents,\x20which\x20may\x20range\x20from\x20not\x20taking\x20action\x20to\x20permanent\x20expulsion\x20from\x0athe\x20project\x20and\x20project-sponsored\x20spaces.\x20We\x20will\x20notify\x20the\x20accused\x20of\x20the\x0areport\x20and\x20provide\x20them\x20an\x20opportunity\x20to\x20discuss\x20it\x20before\x20any\x20action\x20is\x20taken.\x0aThe\x20identity\x20of\x20the\x20reporter\x20will\x20be\x20omitted\x20from\x20the\x20details\x20of\x20the\x20report\x0asupplied\x20to\x20the\x20accused.\x20In\x20potentially\x20harmful\x20situations,\x20such\x20as\x20ongoing\x0aharassment\x20or\x20threats\x20to\x20anyone’s\x20safety,\x20we\x20may\x20take\x20action\x20without\x20notice.

\x0a\x0aAttribution\x0a\x0a

This\x20Code\x20of\x20Conduct\x20is\x20adapted\x20from\x20the\x20Contributor\x20Covenant,\x20version\x201.4,\x0aavailable\x20at\x0ahttps://www.contributor-covenant.org/version/1/4/code-of-conduct.html

\x0a\x0aSummary\x0a\x0a
    \x0a
  • Treat\x20everyone\x20with\x20respect\x20and\x20kindness.\x0a
  • Be\x20thoughtful\x20in\x20how\x20you\x20communicate.\x0a
  • Don\xe2\x80\x99t\x20be\x20destructive\x20or\x20inflammatory.\x0a
  • If\x20you\x20encounter\x20an\x20issue,\x20please\x20mail\x20conduct@golang.org.\x0a
\x0a", + "doc/copyright.html": "\x0a\x0a

\x0a\x20\x20Except\x20as\x0a\x20\x20noted,\x20the\x20contents\x20of\x20this\x0a\x20\x20site\x20are\x20licensed\x20under\x20the\x0a\x20\x20Creative\x20Commons\x20Attribution\x203.0\x20License,\x0a\x20\x20and\x20code\x20is\x20licensed\x20under\x20a\x20BSD\x20license.\x0a

\x0a", "doc/docs.html": "\x0a\x0a

\x0aThe\x20Go\x20programming\x20language\x20is\x20an\x20open\x20source\x20project\x20to\x20make\x20programmers\x20more\x0aproductive.\x0a

\x0a\x0a

\x0aGo\x20is\x20expressive,\x20concise,\x20clean,\x20and\x20efficient.\x20Its\x20concurrency\x0amechanisms\x20make\x20it\x20easy\x20to\x20write\x20programs\x20that\x20get\x20the\x20most\x20out\x20of\x20multicore\x0aand\x20networked\x20machines,\x20while\x20its\x20novel\x20type\x20system\x20enables\x20flexible\x20and\x0amodular\x20program\x20construction.\x20Go\x20compiles\x20quickly\x20to\x20machine\x20code\x20yet\x20has\x20the\x0aconvenience\x20of\x20garbage\x20collection\x20and\x20the\x20power\x20of\x20run-time\x20reflection.\x20It's\x20a\x0afast,\x20statically\x20typed,\x20compiled\x20language\x20that\x20feels\x20like\x20a\x20dynamically\x20typed,\x0ainterpreted\x20language.\x0a

\x0a\x0a\x0a\x0a

Installing\x20Go

\x0a\x0a

Getting\x20Started

\x0a

\x0aInstructions\x20for\x20downloading\x20and\x20installing\x20the\x20Go\x20compilers,\x20tools,\x20and\x0alibraries.\x0a

\x0a\x0a\x0aLearning\x20Go\x0a\x0a\x0a\x0a\x0a\x09{{if\x20$.GoogleCN}}\x0a\x09\x20\x20A\x20Tour\x20of\x20Go\x0a\x09{{else}}\x0a\x09\x20\x20A\x20Tour\x20of\x20Go\x0a\x09{{end}}\x0a\x0a

\x0aAn\x20interactive\x20introduction\x20to\x20Go\x20in\x20three\x20sections.\x0aThe\x20first\x20section\x20covers\x20basic\x20syntax\x20and\x20data\x20structures;\x20the\x20second\x20discusses\x0amethods\x20and\x20interfaces;\x20and\x20the\x20third\x20introduces\x20Go's\x20concurrency\x20primitives.\x0aEach\x20section\x20concludes\x20with\x20a\x20few\x20exercises\x20so\x20you\x20can\x20practice\x20what\x20you've\x0alearned.\x20You\x20can\x20{{if\x20not\x20$.GoogleCN}}take\x20the\x20tour\x0aonline\x20or{{end}}\x20install\x20it\x20locally\x20with:\x0a

\x0a
\x0a$\x20go\x20get\x20golang.org/x/tour\x0a
\x0a

\x0aThis\x20will\x20place\x20the\x20tour\x20binary\x20in\x20your\x20workspace's\x20bin\x20directory.\x0a

\x0a\x0aHow\x20to\x20write\x20Go\x20code\x0a

\x0a{{if\x20not\x20$.GoogleCN}}\x0aAlso\x20available\x20as\x20a\x20screencast,\x20this\x0a{{else}}\x0aThis\x0a{{end}}\x0adoc\x20explains\x20how\x20to\x20use\x20the\x20go\x20command\x0ato\x20fetch,\x20build,\x20and\x20install\x20packages,\x20commands,\x20and\x20run\x20tests.\x0a

\x0a\x0aEditor\x20plugins\x20and\x20IDEs\x0a

\x0aA\x20document\x20that\x20summarizes\x20commonly\x20used\x20editor\x20plugins\x20and\x20IDEs\x20with\x0aGo\x20support.\x0a

\x0a\x0aEffective\x20Go\x0a

\x0aA\x20document\x20that\x20gives\x20tips\x20for\x20writing\x20clear,\x20idiomatic\x20Go\x20code.\x0aA\x20must\x20read\x20for\x20any\x20new\x20Go\x20programmer.\x20It\x20augments\x20the\x20tour\x20and\x0athe\x20language\x20specification,\x20both\x20of\x20which\x20should\x20be\x20read\x20first.\x0a

\x0a\x0aDiagnostics\x0a

\x0aSummarizes\x20tools\x20and\x20methodologies\x20to\x20diagnose\x20problems\x20in\x20Go\x20programs.\x0a

\x0a\x0aFrequently\x20Asked\x20Questions\x20(FAQ)\x0a

\x0aAnswers\x20to\x20common\x20questions\x20about\x20Go.\x0a

\x0a\x0aThe\x20Go\x20Wiki\x0a

A\x20wiki\x20maintained\x20by\x20the\x20Go\x20community.

\x0a\x0aMore\x0a

\x0aSee\x20the\x20Learn\x20page\x20at\x20the\x20Wiki\x0afor\x20more\x20Go\x20learning\x20resources.\x0a

\x0a\x0a\x0aReferences\x0a\x0aPackage\x20Documentation\x0a

\x0aThe\x20documentation\x20for\x20the\x20Go\x20standard\x20library.\x0a

\x0a\x0aCommand\x20Documentation\x0a

\x0aThe\x20documentation\x20for\x20the\x20Go\x20tools.\x0a

\x0a\x0aLanguage\x20Specification\x0a

\x0aThe\x20official\x20Go\x20Language\x20specification.\x0a

\x0a\x0aThe\x20Go\x20Memory\x20Model\x0a

\x0aA\x20document\x20that\x20specifies\x20the\x20conditions\x20under\x20which\x20reads\x20of\x20a\x20variable\x20in\x0aone\x20goroutine\x20can\x20be\x20guaranteed\x20to\x20observe\x20values\x20produced\x20by\x20writes\x20to\x20the\x0asame\x20variable\x20in\x20a\x20different\x20goroutine.\x0a

\x0a\x0aRelease\x20History\x0a

A\x20summary\x20of\x20the\x20changes\x20between\x20Go\x20releases.

\x0a\x0a\x0aArticles\x0a\x0a{{if\x20not\x20$.GoogleCN}}\x0aThe\x20Go\x20Blog\x0a

The\x20official\x20blog\x20of\x20the\x20Go\x20project,\x20featuring\x20news\x20and\x20in-depth\x20articles\x20by\x0athe\x20Go\x20team\x20and\x20guests.

\x0a{{end}}\x0a\x0a

Codewalks

\x0a

\x0aGuided\x20tours\x20of\x20Go\x20programs.\x0a

\x0a
    \x0a
  • First-Class\x20Functions\x20in\x20Go
  • \x0a
  • Generating\x20arbitrary\x20text:\x20a\x20Markov\x20chain\x20algorithm
  • \x0a
  • Share\x20Memory\x20by\x20Communicating
  • \x0a
  • Writing\x20Web\x20Applications\x20-\x20building\x20a\x20simple\x20web\x20application.
  • \x0a
\x0a\x0a{{if\x20not\x20$.GoogleCN}}\x0a

Language

\x0a
    \x0a
  • JSON-RPC:\x20a\x20tale\x20of\x20interfaces
  • \x0a
  • Go's\x20Declaration\x20Syntax
  • \x0a
  • Defer,\x20Panic,\x20and\x20Recover
  • \x0a
  • Go\x20Concurrency\x20Patterns:\x20Timing\x20out,\x20moving\x20on
  • \x0a
  • Go\x20Slices:\x20usage\x20and\x20internals
  • \x0a
  • A\x20GIF\x20decoder:\x20an\x20exercise\x20in\x20Go\x20interfaces
  • \x0a
  • Error\x20Handling\x20and\x20Go
  • \x0a
  • Organizing\x20Go\x20code
  • \x0a
\x0a\x0a

Packages

\x0a
    \x0a
  • JSON\x20and\x20Go\x20-\x20using\x20the\x20json\x20package.
  • \x0a
  • Gobs\x20of\x20data\x20-\x20the\x20design\x20and\x20use\x20of\x20the\x20gob\x20package.
  • \x0a
  • The\x20Laws\x20of\x20Reflection\x20-\x20the\x20fundamentals\x20of\x20the\x20reflect\x20package.
  • \x0a
  • The\x20Go\x20image\x20package\x20-\x20the\x20fundamentals\x20of\x20the\x20image\x20package.
  • \x0a
  • The\x20Go\x20image/draw\x20package\x20-\x20the\x20fundamentals\x20of\x20the\x20image/draw\x20package.
  • \x0a
\x0a\x0a

Modules

\x0a
    \x0a
  • Using\x20Go\x20Modules\x20-\x20an\x20introduction\x20to\x20using\x20modules\x20in\x20a\x20simple\x20project.
  • \x0a
  • Migrating\x20to\x20Go\x20Modules\x20-\x20converting\x20an\x20existing\x20project\x20to\x20use\x20modules.
  • \x0a
  • Publishing\x20Go\x20Modules\x20-\x20how\x20to\x20make\x20new\x20versions\x20of\x20modules\x20available\x20to\x20others.
  • \x0a
\x0a{{end}}\x0a\x0a

Tools

\x0a
    \x0a
  • About\x20the\x20Go\x20command\x20-\x20why\x20we\x20wrote\x20it,\x20what\x20it\x20is,\x20what\x20it's\x20not,\x20and\x20how\x20to\x20use\x20it.
  • \x0a
  • Debugging\x20Go\x20Code\x20with\x20GDB
  • \x0a
  • Data\x20Race\x20Detector\x20-\x20a\x20manual\x20for\x20the\x20data\x20race\x20detector.
  • \x0a
  • A\x20Quick\x20Guide\x20to\x20Go's\x20Assembler\x20-\x20an\x20introduction\x20to\x20the\x20assembler\x20used\x20by\x20Go.
  • \x0a{{if\x20not\x20$.GoogleCN}}\x0a
  • C?\x20Go?\x20Cgo!\x20-\x20linking\x20against\x20C\x20code\x20with\x20cgo.
  • \x0a
  • Godoc:\x20documenting\x20Go\x20code\x20-\x20writing\x20good\x20documentation\x20for\x20godoc.
  • \x0a
  • Profiling\x20Go\x20Programs
  • \x0a
  • Introducing\x20the\x20Go\x20Race\x20Detector\x20-\x20an\x20introduction\x20to\x20the\x20race\x20detector.
  • \x0a{{end}}\x0a
\x0a\x0aMore\x0a

\x0aSee\x20the\x20Articles\x20page\x20at\x20the\x0aWiki\x20for\x20more\x20Go\x20articles.\x0a

\x0a\x0a{{if\x20not\x20$.GoogleCN}}\x0aTalks\x0a\x0a\x0a\x0aA\x20Video\x20Tour\x20of\x20Go\x0a

\x0aThree\x20things\x20that\x20make\x20Go\x20fast,\x20fun,\x20and\x20productive:\x0ainterfaces,\x20reflection,\x20and\x20concurrency.\x20Builds\x20a\x20toy\x20web\x20crawler\x20to\x0ademonstrate\x20these.\x0a

\x0a\x0aCode\x20that\x20grows\x20with\x20grace\x0a

\x0aOne\x20of\x20Go's\x20key\x20design\x20goals\x20is\x20code\x20adaptability;\x20that\x20it\x20should\x20be\x20easy\x20to\x20take\x20a\x20simple\x20design\x20and\x20build\x20upon\x20it\x20in\x20a\x20clean\x20and\x20natural\x20way.\x20In\x20this\x20talk\x20Andrew\x20Gerrand\x20describes\x20a\x20simple\x20\"chat\x20roulette\"\x20server\x20that\x20matches\x20pairs\x20of\x20incoming\x20TCP\x20connections,\x20and\x20then\x20use\x20Go's\x20concurrency\x20mechanisms,\x20interfaces,\x20and\x20standard\x20library\x20to\x20extend\x20it\x20with\x20a\x20web\x20interface\x20and\x20other\x20features.\x20While\x20the\x20function\x20of\x20the\x20program\x20changes\x20dramatically,\x20Go's\x20flexibility\x20preserves\x20the\x20original\x20design\x20as\x20it\x20grows.\x0a

\x0a\x0aGo\x20Concurrency\x20Patterns\x0a

\x0aConcurrency\x20is\x20the\x20key\x20to\x20designing\x20high\x20performance\x20network\x20services.\x20Go's\x20concurrency\x20primitives\x20(goroutines\x20and\x20channels)\x20provide\x20a\x20simple\x20and\x20efficient\x20means\x20of\x20expressing\x20concurrent\x20execution.\x20In\x20this\x20talk\x20we\x20see\x20how\x20tricky\x20concurrency\x20problems\x20can\x20be\x20solved\x20gracefully\x20with\x20simple\x20Go\x20code.\x0a

\x0a\x0aAdvanced\x20Go\x20Concurrency\x20Patterns\x0a

\x0aThis\x20talk\x20expands\x20on\x20the\x20Go\x20Concurrency\x20Patterns\x20talk\x20to\x20dive\x20deeper\x20into\x20Go's\x20concurrency\x20primitives.\x0a

\x0a\x0aMore\x0a

\x0aSee\x20the\x20Go\x20Talks\x20site\x20and\x20wiki\x20page\x20for\x20more\x20Go\x20talks.\x0a

\x0a{{end}}\x0a\x0aNon-English\x20Documentation\x0a\x0a

\x0aSee\x20the\x20NonEnglish\x20page\x0aat\x20the\x20Wiki\x20for\x20localized\x0adocumentation.\x0a

\x0a",