Go - Workspace

Card Puncher Data Processing


The workspace is the root directory of all work in go

A workspace is a directory hierarchy with three directories at its root:

  • src contains Go source files,
  • pkg contains package objects, and
  • bin contains executable commands.

Environment variable

echo $GOPATH
go help gopath



  • Two repositories (example and image).
    • The example repository (src/github.com/golang/example/) contains:
      • Two commands (hello and outyet)
      • one library (stringutil).
    • The image repository (src/golang.org/x/image/) contains the:
      • bmp package
      • and several others.
    hello                          # command executable
    outyet                         # command executable
            stringutil.a           # package object
        .git/                      # Git repository metadata
	    hello.go               # command source
	    main.go                # command source
	    main_test.go           # test source
	    reverse.go             # package source
	    reverse_test.go        # test source
        .git/                      # Git repository metadata
	    reader.go              # package source
	    writer.go              # package source
    ... (many more repositories and packages omitted) ...

Documentation / Reference

Discover More
Card Puncher Data Processing
Go - Getting Started (Hello World)

Installation: Create a base path below the src directory of the workspace Create below the base path, your package directory and it the below source file Source hello.go Compile it ...
Card Puncher Data Processing
Go - Installation

Install the go binary in the default location Create a directory workspace with the following subdirectory src (Go source files), pkg (Package objects) bin (Executable commands). Set up the...
Card Puncher Data Processing
Go - Package (Import)

Package in Go. Go treats files in a single directory as belonging to one package as long as they all have the same name in their package declarations. Go code is organized into packages (similar to libraries...
Card Puncher Data Processing
Go - go (The Go tool)

The go tool builds source packages and installs the resulting binaries to the pkg and bin directories of the workspace The go tool will only print output when an error occurs....

Share this page:
Follow us:
Task Runner