Go/Basics: Difference between revisions
From charlesreid1
(Created page with "=How to write Go code= How to write Go code: https://golang.org/doc/code.html * Use a single workspace * Each workspace contains many repositories * Each repository contains...") |
No edit summary |
||
| Line 33: | Line 33: | ||
... (many more repositories and packages omitted) ... | ... (many more repositories and packages omitted) ... | ||
</pre> | </pre> | ||
=Resources= | |||
https://www.calhoun.io/ | |||
Latest revision as of 04:18, 21 December 2018
How to write Go code
How to write Go code: https://golang.org/doc/code.html
- Use a single workspace
- Each workspace contains many repositories
- Each repository contains one or more packages
- Each package consists of one or more Go source files in a single directory
- The path to a package's directory determines its import path
How to organize your workspace
bin/
hello # command executable
outyet # command executable
src/
github.com/golang/example/
.git/ # Git repository metadata
hello/
hello.go # command source
outyet/
main.go # command source
main_test.go # test source
stringutil/
reverse.go # package source
reverse_test.go # test source
golang.org/x/image/
.git/ # Git repository metadata
bmp/
reader.go # package source
writer.go # package source
... (many more repositories and packages omitted) ...