From the course: Go for Developers: Practical Techniques for Effective Coding

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Packages

Packages

- So what is a package? Well, a package is a collection of GO files that share the same import path. These files are always in the same directory as each other, and the directory name is almost always the same as the package name. Consider this folder structure that has two folders, SMTP and Sound. Each of these folders contains GO source files and are therefore considered packages. Code within each package can reference any identifier such as a function, variable or type within that package, whether or not that identifier has been exported. Any exported identifier can be used by any other package. We'll be discussing exporting identifiers a little later in this video. Naming packages properly is very important. The package of the fundamental unit of code organization in GO and therefore naming packages properly is key. There are naming rules and conventions for naming packages in GO. Packages should be lower-cased. Package names should only contain letters and numbers. Packages are…

Contents