Skip to content

Commit

Permalink
services/horizon: remove go-codegen (#2371)
Browse files Browse the repository at this point in the history
### What
Remove use of the go-codegen tool for generating the action handlers.

### Why
Go-codegen is difficult to install because it is using the old [gb] build tool that is no longer maintained. We're using go-codegen to generate 4 lines of code for each action type. There are 15 types that we generate those 4 lines of code for, which means we're using this tool to generate only 60 lines of code. We can easily write these lines of code by hand and the effort to keep using go-codegen is much higher than that.

Additionally, @bartekn mentioned that this code will disappear when we move away from actions in the near future so there is even less value in us keeping the go-codegen code generation working.

[gb]: http://github.com/constabulary/gb
  • Loading branch information
leighmcculloch authored Mar 9, 2020
1 parent a826a9d commit a991284
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 17 deletions.
7 changes: 0 additions & 7 deletions services/horizon/internal/Action.tmpl

This file was deleted.

4 changes: 0 additions & 4 deletions services/horizon/internal/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import (

// Action is the "base type" for all actions in horizon. It provides
// structs that embed it with access to the App struct.
//
// Additionally, this type is a trigger for go-codegen and causes
// the file at Action.tmpl to be instantiated for each struct that
// embeds Action.
type Action struct {
actions.Base
App *App
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions services/horizon/internal/docs/notes_for_developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Compile and install Horizon as described in the [Horizon development guide](deve

Horizon uses two Go tools you'll need to install:
1. [go-bindata](github.com/kevinburke/go-bindata) is used to bundle test data
2. [go-codegen](https://github.com/nullstyle/go-codegen) is used to generate some boilerplate code

After the above are installed, run `go generate github.com/stellar/go/services/horizon/...`. This will look for any `.tmpl` files in the directory and use them to generate code when annotated structs are found in the package source.
After the above are installed, run `go generate github.com/stellar/go/services/horizon/...`.

## <a name="scenarios"></a> Adding, rebuilding and using test scenarios

Expand Down
4 changes: 0 additions & 4 deletions services/horizon/internal/main.go

This file was deleted.

0 comments on commit a991284

Please sign in to comment.