If you're making a change to the main Go repository:

$ git clone https://go.googlesource.com/go
$ cd go/src
$ ./all.bash                                # compile and test
If you're making a change to one of the golang.org/x/... repositories (golang.org/x/tools, in this example):

$ git clone https://go.googlesource.com/tools
$ cd tools
$ go test ./...                             # compile and test
In a golang.org/x/... repository:

$ go test ./... # recompile and test
In the main Go repository:

$ ./all.bash    # recompile and test

$ git checkout -b mybranch
$ [edit files...]
$ git add [files...]
$ git codereview change   # create commit in the branch
$ [edit again...]
$ git add [files...]
$ git codereview change   # amend the existing commit with new changes
$ [etc.]

Recommend

Go Contribution Guide Becoming a contributor Step 4: Install the git-codereview command

Contribution Guide Becoming a contributor Step 0: Select a Google Account

Go Contribution Guide Becoming a contributor Overview

Go Diagnostics Debugging

Go Diagnostics Profiling

How to Write Go Code Testing

How to Write Go Code Your first program Importing packages from remote modules

How to Write Go Code Your first program Importing packages from your module

How to Write Go Code Your first program

The Go Programming Language Specification System considerations Size and alignment guarantees

The Go Programming Language Specification System considerations Package unsafe

The Go Programming Language Specification Run-time panics

The Go Programming Language Specification Errors

The Go Programming Language Specification Program initialization and execution Program execution

The Go Programming Language Specification Program initialization and execution Package initialization

The Go Programming Language Specification Program initialization and execution The zero value

The Go Programming Language Specification Packages An example package

The Go Programming Language Specification Packages Import declarations

The Go Programming Language Specification Packages Package clause

The Go Programming Language Specification Packages Source file organization

The Go Programming Language Specification Built-in functions Bootstrapping

The Go Programming Language Specification Built-in functions Handling panics

The Go Programming Language Specification Built-in functions Manipulating complex numbers

The Go Programming Language Specification Built-in functions Deletion of map elements

The Go Programming Language Specification Built-in functions Appending to and copying slices

The Go Programming Language Specification Built-in functions Making slices, maps and channels

The Go Programming Language Specification Built-in functions Allocation

The Go Programming Language Specification Built-in functions Length and capacity

The Go Programming Language Specification Statements Defer statements

The Go Programming Language Specification Statements Fallthrough statements

The Go Programming Language Specification Statements Goto statements

The Go Programming Language Specification Statements Continue statements

The Go Programming Language Specification Statements Break statements

The Go Programming Language Specification Statements Return statements

The Go Programming Language Specification Statements Select statements

The Go Programming Language Specification Statements Go statements

The Go Programming Language Specification Statements For statements For statements with range clause

The Go Programming Language Specification Statements For statements For statements with for clause

The Go Programming Language Specification Statements For statements For statements with single condition

The Go Programming Language Specification Statements For statements

The Go Programming Language Specification Statements Switch statements Type switches