


They get imported in the same way as a third party package from GitHub or elsewhere. Your Go program can have many packages within the code-base.For example, you can have a package called "imaging" with a sub-folder called "generators" and you can import "generators" separately and parallel to anything else found within the "imaging" package. Packages can span multiple files and folders and your package namespace can use these folders to divide things up into logical groups.A Go Package doesn't need to have a main package. There is a special package called main that every Go program implements once and it's where your program begins.
#Anyone been to godocs mod#
Modules appear to be referenced in the form of go mod which is a command line tool that does the actual importing and documenting of versions. Packages appear to be collections of Go files that can be imported into another Go program. I'm not entirely sure what the difference is between a "package" and a "module" in Go, or if there even is a difference.Packages in Go are a core concept to understand. It's really just an exercise to learn more about Go and about building and documenting packages, but also has been a fun way to remind myself of some of the interesting concepts I learned about many years ago while studying imaging in college. I also started building a package of my own to collect together some basic image processing functions. I think Go has taken a really smart approach to package and dependency management by simplifying things, removing the need for a complex package manager, and creating a global namespace by just piggybacking off the World Wide Web's global namespace. This seems to be a pretty important core concept, and something I've struggled with in other languages like Python and Node. I also spent a good deal of time learning what I could about packages in Go. It's been helpful because it does a good job at explaining why things are the way they are in Go, while working your way through each core principal. I started reading this excellent book called " The Go Programming Language" by Alan Donovan and Brian Kernighan. The past couple weeks have been pretty productive in terms of my mission to learn Go.
