|
32 | 32 | - [(S) IIFE](#s-iife) |
33 | 33 | - [(S) Closures](#s-closures) |
34 | 34 | - [Concurrency](#concurrency) |
35 | | -- [Package Management](#package-management) |
| 35 | +- [Packages](#packages) |
| 36 | + - [Import system](#import-system) |
| 37 | + - [Management](#management) |
36 | 38 | - [Patterns](#patterns) |
37 | 39 | - [Quick Syntax Reminders](#quick-syntax-reminders) |
38 | 40 | - [(D) String literals](#d-string-literals) |
@@ -360,8 +362,23 @@ More on this subject: |
360 | 362 | - [Go Concurrency Patterns](https://talks.golang.org/2012/concurrency.slide#1) |
361 | 363 | - [Advanced Go Concurrency Patterns](https://talks.golang.org/2013/advconc.slide#1) |
362 | 364 |
|
363 | | -# Package Management |
| 365 | +# Packages |
| 366 | +## Import system |
| 367 | +Javascript has an official [import statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import), however the external specs of AMD & CommonJS are more popular since the language began to address this issue rather late. |
364 | 368 |
|
| 369 | +Go's import statement and package support were part of the spec from the beginning. As of Go 1.6 (or 1.5 + flag), there's better support for encapsulating dependent packages inside a project with the [vendor folder](https://blog.gopheracademy.com/advent-2015/vendor-folder/). However, it doesn't attempt so solve everything: |
| 370 | +> … this does not attempt to solve the problem of vendoring resulting in multiple copies of a package being linked into a single binary. Sometimes having multiple copies of a library is not a problem; sometimes it is. At least for now, it doesn’t seem that the go command should be in charge of policing or solving that problem. |
| 371 | +
|
| 372 | +## Management |
| 373 | +For Javascript development, NPM is the de-facto package manager for NodeJS, and may also be used for client side projects. Bower is also a popular for client side projects. |
| 374 | + |
| 375 | +The go tool will only get your as far as getting a dependency latest master code. This will not suffice if you need accurate dependency management with pinned versions. The Go community came up with several package managers, here's a partial list: |
| 376 | +- https://github.com/kovetskiy/manul |
| 377 | +- https://github.com/tools/godep |
| 378 | +- https://github.com/kardianos/govendor |
| 379 | +- https://github.com/FiloSottile/gvt |
| 380 | +- https://github.com/Masterminds/glide |
| 381 | +- https://github.com/mattn/gom |
365 | 382 |
|
366 | 383 | # Patterns |
367 | 384 |
|
|
0 commit comments