kodos

package module
v0.0.0-...-5edbb1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2016 License: MIT Imports: 10 Imported by: 0

README

kodos

Kang of Regil VII

What is this?

Many folks are frustated with the $GOPATH single workspace model, it doesn't let them check out the source of a project in a directory of their choice and it does not let them have multiple copies of a project checked out at the same time. Similarly many folks are frustrated with the gb project model, which gives you the ability to check out a project anywhere you want, but has no solution for libraries, and gb projects are not go gettable.

kang is an experiment to try to provide a solution that:

  1. lets you checkout a project anywhere you want
  2. does not force you to give up interoperability with go get.

Kodos uses .git

The reason $GOPATH is required by the go tool is twofold

  1. all import statements are resolved by the go tool relative to a fixed absolute root; $GOPATH/src.
  2. a location to store dependencies fetched by go get.

gb showed that point 2 could be solved by writing a new build tool that did not wrap the go tool and thus was not forced to reorganise the world to fit into the $GOPATH model.

The problem with point 1 is whenever the go tool builds a package in a directory, it must answer the question of "what is the full import path of this package". The $GOPATH model answers this question by subtracting the prefix of $GOPATH/src from the path to the directory of the current package; the remainder is the package's fully qualified import path. This is why if you checkout a package outside a $GOPATH workspace, the go tool cannot figure out the packages' fully qualified import path and everything falls apart.

Installation

kodos requires Go 1.7.3 or later.

go get github.com/constabulary/kodos/...

Usage

note: not done, see roadmap and TODO.

kodos build will build all the source in a project, it can be issued anywhere in the project. kodos test will test all the packages in a project, ditto.

Both commands automatically cache as much as possible for fast incremental compilation.

Roadmap

Here are the big ticket items before kang is a working proof of concept.

  • kodos test support.
  • automatic dependency fetching.
  • cgo support.
  • cross compile support.

TODO

Lots to do.

  • unit tests
  • functional and integration tests
  • kang has forked a number of gb components, merge the changes required back into gb so both kang and gb use the same build and test primatives.

Contributing

Bug reports are most welcome.

Pull requests must include a fixes #NNN or updates #NNN comment.

Please discuss your design on the accompanying issue before submitting a pull request. If there is no suitable issue, please open one to discuss the feature before slinging code. Thank you.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPackages

func BuildPackages(pkgs ...*Package) (func() error, error)

Types

type Context

type Context struct {
	GOOS, GOARCH string
	Workdir      string
	Pkgdir       string
	Bindir       string
	// contains filtered or unexported fields
}

Context contains all build specific values.

func (*Context) Transform

func (ctx *Context) Transform(v ...*build.Package) []*Package

Transform takes a slice of go/build.Package and returns the corresponding slice of kodos.Packages.

type Package

type Package struct {
	*Context
	*build.Package
	Imports []*Package

	Main     bool // this is a command
	NotStale bool // this package _and_ all its dependencies are not stale
	// contains filtered or unexported fields
}

Package describes a set of Go files to be compiled.

func (*Package) Binfile

func (pkg *Package) Binfile() string

Binfile returns the destination of the compiled target of this command.

func (*Package) Compile

func (pkg *Package) Compile() error

func (*Package) IsStale

func (pkg *Package) IsStale() bool

IsStale returns true if the source pkg is considered to be stale with respect to its installed version.

func (pkg *Package) Link() error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL