From charlesreid1

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) ...


Resources

https://www.calhoun.io/