GO and Packages

GO and Packages

By Frédéric Schmidt
June 09, 2020
1 min read

This basic concept, which happens to be at the heart of the structuring, construction of programs written in GO language. If we look closer we can see that the whole code of the standard library is in the form of package. More globally all programs are packages and are related or not together. For example, we could group under a package a functional unit concerning invoice editing. Another on customer management. One could have this reasoning at a more technical level like the standard GO library.

The Basic Concept: Packages, is fundamental to having a sound and easily scalable and clear software architecture. I will present a demonstration on the creation and use of a package later.

We find this concept in many other languages, with different names, as in CSharp, Java, C++, etc…


package main

import (

func main() {
    fmt.Println("Hello, playground")

If we go back to our basic example, we notice that the first line is the declaration of the name of the package to which the code belongs here in our case main.

We will see later that the main function is important. It is theenter point of your application, program.



Allows the definition of a set of functions, constants, variables, declarations in the same scope.
Writing a package can be done on several source files. Go will only reason at the package level.




math package


The package name should not have a space in its name. This is the first instruction found in a GO source file.


Frédéric Schmidt

Frédéric Schmidt

Software Architect

I'm Software Developer & Architect. I'm more than 20 years experiences in differents IT service companies and software editors. I like studies some new technologies and share this passion altroughts my technical blog.


Technical writer

Social Media


Related Posts

GO and Package importation
Programming Languages
GO and Package importation
June 09, 2020
2 min
© 2022, All Rights Reserved.

Quick Links

Contact Us

About me

Social Media