On Wed, 11 Apr 2018, andrey mirtchovski wrote:

> >   ah, it's all (i think) clear now. so, based on what i see under
> > ${GOROOT}/src/hash, i could do any or all of the following:
> >
> >   import "hash"
> >   import "hash/adler32"
> >   import "hash/crc32"
> >   import "hash/crc64"
> >   import "hash/fnv"
> note that you don't need to import "hash" unless you are writing a
> hash yourself (i.e., you're implementing something that returns
> hash.Hash32 or hash.Hash64). in fact, if you look at adler32, the
> imported "hash" package is used only in function definitions. this
> means that you only import the packages you use, and the build
> system takes care to bring in all necessary dependencies or to build
> them from source where they're missing.

  actually, that's the very next thing i suspected, so i looked at
"hash" and realized it was just an interface and no one should import
it directly, as the underlying implementations already did that. so
that clears up my earlier confusion.

> from the faq:
> "Go provides a model for software construction that makes dependency
> analysis easy and avoids much of the overhead of C-style include files
> and libraries.
> https://golang.org/doc/faq#What_is_the_purpose_of_the_project
> > which all represent distinct imports. however, it would make no sense
> > to:
> >
> >   import "container"
> >
> correct. there is no package "container".

  yup, it's all falling into place, thanks to all for helping out.
perhaps someday i can return the favour and help out some other
puzzled newbie.


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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to