Everything you need to know about Packages in Go

Everything you need to know about Packages in Go

6 years ago
Anonymous $hM_jrxqbr-

https://medium.com/rungo/everything-you-need-to-know-about-packages-in-go-b8bac62b74cc

If you are familiar to languages like Java or NodeJS, then you might be quite familiar with packages. A package is nothing but a directory with some code files, which exposes different variables (features) from a single point of reference. Let me explain, what that means.

Imagine you have more than a thousand functions which you need constantly while working on any project. Some of these functions have common behavior. For example, toUpperCase and toLowerCase function transforms case of a string, so you write them in a single file (probably case.go). There are other functions which does some other operations on string data type, so you write them in separate file as well.

Everything you need to know about Packages in Go

Jul 24, 2018, 8:38pm UTC
https://medium.com/rungo/everything-you-need-to-know-about-packages-in-go-b8bac62b74cc > If you are familiar to languages like Java or NodeJS, then you might be quite familiar with packages. A package is nothing but a directory with some code files, which exposes different variables (features) from a single point of reference. Let me explain, what that means. > Imagine you have more than a thousand functions which you need constantly while working on any project. Some of these functions have common behavior. For example, toUpperCase and toLowerCase function transforms case of a string, so you write them in a single file (probably case.go). There are other functions which does some other operations on string data type, so you write them in separate file as well.