5. First Local Program

1
cd ~/workspace
# Or wherever you keep your code
2

Create the directory

mkdir hellogo
cd hellogo
3

Initialize the module

Run one of the following depending on your remote provider.

go mod init github.com/yourusername/hellogo

Replace yourusername with your actual GitHub username.

(Alternatively, the module command can be written generically as go mod init {REMOTE}/{USERNAME}/hellogo where {REMOTE} is your preferred remote source providerβ€”e.g., github.comβ€”and {USERNAME} is your Git username.)

4

Verify the go.mod file

cat go.mod

Expected output (version may differ depending on your Go installation):

module github.com/yourusername/hellogo

go 1.25.1
5

Run Boot.dev CLI tests

Make sure you're in the hellogo directory, then run:

bootdev test

Boot.dev CLI: https://github.com/bootdotdev/bootdev

What you just did

  • Created a directory β€” hellogo is your project folder

  • Initialized a module β€” go mod init created the go.mod file

  • Declared the module path β€” tells Go where this module "lives"

  • Verified it worked β€” cat go.mod shows the file was created

Your project structure now

~/workspace/
└── hellogo/
    └── go.mod

Common issues

chevron-rightIssue: "go: cannot find main module"hashtag
  • Make sure you're inside the hellogo directory when running commands.

chevron-rightIssue: "command not found: go"hashtag
  • Go isn't installed or not in your PATH.

chevron-rightIssue: Wrong module pathhashtag
  • Make sure you replaced {REMOTE} and {USERNAME} with actual values.

  • Example: github.com/johnsmith/hellogo instead of {REMOTE}/{USERNAME}/hellogo.