Experimental code generators for Crossplane controllers.
Go to file
Nic Cope 53ff22ad7b Support Go modules
Write the generated files alongside the first Go file of the module, rather than
to its presumed path under GOPATH. This change assumes:

* Packages always have at least one Go source file.
* The Go files of a package are always within a single directory.

I believe the above are always true.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-07 12:25:23 -07:00
.github Migrate angryjet to crossplane-tools 2019-10-03 19:19:14 -07:00
build@ff9fe7dd3d Migrate angryjet to crossplane-tools 2019-10-03 19:19:14 -07:00
cmd/angryjet Support Go modules 2019-10-07 12:25:23 -07:00
internal Bikeshed the angryjet API a little 2019-10-03 19:32:49 -07:00
.gitignore Migrate angryjet to crossplane-tools 2019-10-03 19:19:14 -07:00
.gitmodules Use HTTP rather than SSH for build git submodule 2019-10-03 20:45:18 -07:00
.golangci.yml Clean things up a little 2019-09-22 01:36:12 -07:00
Gopkg.lock Migrate angryjet to crossplane-tools 2019-10-03 19:19:14 -07:00
Gopkg.toml Clean things up a little 2019-09-22 01:36:12 -07:00
LICENSE Initial commit 2019-09-01 15:51:43 -07:00
Makefile Migrate angryjet to crossplane-tools 2019-10-03 19:19:14 -07:00
README.md Support Go modules 2019-10-07 12:25:23 -07:00

README.md

crossplane-tools Godoc

Experimental code generators for Crossplane controllers.

angryjet is the only extant tool within crossplane-tools. It will detect Go structs that appear to be capable of satisfying crossplane-runtime's interfaces (such as resource.Managed) and automatically generate the method set required to satisfy that interface. A struct is considered capable of satisfying crossplane-runtime's interfaces based on the heuristics described in the Crossplane Services Developer Guide, for example a managed resource must:

  • Embed a ResourceStatus struct in their Status struct.
  • Embed a ResourceSpec struct in their Spec struct.
  • Embed a Parameters struct in their Spec struct.

Methods are not written if they are already defined outside of the file that would be generated. Use the //+crossplane:generate:methods=false comment marker to explicitly disable generation of any methods for a type. Use go generate to generate your Crossplane API types by adding a generate marker to the top level of your api/ directory, for example:

// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run ../vendor/github.com/crossplaneio/crossplane-tools/cmd/angryjet/main.go generate-methodsets ./...
$ angryjet generate-methodsets --help
usage: angryjet generate-methodsets [<flags>] [<packages>]

Generate a Crossplane method sets.

Flags:
  --help                     Show context-sensitive help (also try --help-long and --help-man).
  --header-file=HEADER-FILE  The contents of this file will be added to the top of all generated files.
  --filename-managed="zz_generated.managed.go"  
                             The filename of generated managed resource files.
  --filename-claim="zz_generated.claim.go"  
                             The filename of generated resource claim files.
  --filename-portable-class="zz_generated.portableclass.go"  
                             The filename of generated portable class files.
  --filename-portable-class-list="zz_generated.portableclasslist.go"  
                             The filename of generated portable class list files.
  --filename-non-portable-class="zz_generated.nonportableclass.go"  
                             The filename of generated non-portable class files.

Args:
  [<packages>]  Package(s) for which to generate methods, for example github.com/crossplaneio/crossplane/apis/...