• Kirill Smelkov's avatar
    golang: Infrastructure to build Go workspaces / projects · 1b540151
    Kirill Smelkov authored
    In Go world development workflow is organized around so-called workspace
    where multiple packages can be installed / worked on etc. The following
    page describes Go workspaces:
    A new [gowork] section and infrastructure around it is introduced.
    Quoting code:
        # gowork is a top-level section representing workspace
        # users should add `install` field to [gowork] to describe packages they want to
        # be installed (+ automatically their dependencies are installed too). e.g.
        #   [gowork]
        #   install =
        #       lab.nexedi.com/kirr/neo/go/...  \
        #       github.com/pkg/profile          \
        #       golang.org/x/perf/cmd/benchstat
    The way it all works inside is:
    - gowork organizes to create go.work/ directory in buildout root
    - inside it creates env.sh which when sources in shell adjusts all paths
      so that appropriate go compiler is in path, GOPATH is also set
      appropriately, etc - in other words everything needs for using/working
      on this workspace is setup in the environment.
    - in actual user software profile the list of Go projects which needs to
      be installed by SlapOS has to be listed. The [gowork] machinery takes
      care about git-cloning these projects and `go install`s them after.
    - by SlapOS design builds have to be reproducible and so every component
      state/version has to be fixed.
      A convenient helper (gowork-snapshot) to get snapshot of git go
      packages installed with their exact revisions is added. This should be
      used to automatically (re-)generate list of go git repositories &
      their pinning for a workspace.
    For a new Go project that needs to be slaposified the workflow should be:
    - first get a project into working state via any convenient way (`go get`, etc.)
    - generate list of go packages & their pinning with gowork-snapshot
    - extend golang/buildout.cfg and in project software profile add
      	install = your-top-level-packages
      as it was outlined above.
    [golang] is removed because
    1. it is not used anywhere in slapos.git tree, and
    2. the canonical way to work on go projects from now on will be to use
       [gowork]. There latest go version is preconfigured, but users can
       override it to some particular other version in their projects as they
    /reviewed-on	 !242
    /also-needed-for !243
Last commit
Last update
component Loading commit data...
slapos Loading commit data...
software Loading commit data...
stack Loading commit data...
.gitignore Loading commit data...
CHANGES.rst Loading commit data...
MANIFEST.in Loading commit data...
README.rst Loading commit data...
README.software.rst Loading commit data...
schema.json Loading commit data...
setup.py Loading commit data...
sla.schema.json Loading commit data...
update-hash Loading commit data...
validate-schema Loading commit data...