Module vs Package

763 views
Skip to first unread message

Nikhilesh Susarla

unread,
Apr 1, 2024, 2:43:31 AM4/1/24
to golang-nuts
Packages are inside modules. 
Package is nothing but collection of go files under a folder of that package name

But without modules also we can import packages. 

Can someone point out the exact and main difference between package vs modules in golang. 

Thank you

Axel Wagner

unread,
Apr 1, 2024, 2:58:42 AM4/1/24
to Nikhilesh Susarla, golang-nuts
A package is the unit of compilation - the entire package is compiled in a step and it's also where unexported names are scoped to.
A module is the unit of versioning - it's a bunch of packages versioned and distributed together.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e2f07639-d2a2-4a72-bec5-8cbcb2927200n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages