You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Go comes with a comprehensive built-in toolchain that handles formatting, testing, vetting, building, and dependency management. This lesson covers the package system, the testing framework, and the essential Go tools every developer should know.
Every Go file belongs to a package:
package math // this file belongs to the "math" package
| Concept | Description |
|---|---|
| Package | A directory of Go files compiled together |
| main package | Special — defines an executable program |
| Exported names | Start with an uppercase letter (e.g., Println) |
| Unexported names | Start with a lowercase letter (e.g., helper) — private to the package |
myproject/
├── go.mod
├── main.go # package main
├── server/
│ ├── server.go # package server
│ └── server_test.go # tests for package server
├── model/
│ └── user.go # package model
├── handler/
│ ├── user.go # package handler
│ └── user_test.go
└── internal/
└── auth/
└── auth.go # package auth (only importable within myproject)
The internal directory restricts package visibility:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.