Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the example runnable and fix go generate syntax #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
all:
@go generate && go build
@go generate && go build . && ./go-event-sourcing-sample

clean:
@rm -f goes
@rm -f *_string.go
@rm -f go-event-sourcing-sample

install-stringer:
@go install golang.org/x/tools/cmd/stringer
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
###Event Sourcing in Go
### Event Sourcing in Go

This is the repository for the code which accompanies my post on Event Sourcing in Go. The original post is [here](http://jen20.com/2015/02/08/event-sourcing-in-go.html).
This is the repository for the code which accompanies my post on Event Sourcing in Go. The original post is [here](https://jen20.dev/post/event-sourcing-in-go/).

To build and run:

- `make`
- `./goes`

To clean generated code and the binary:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generated code can be updated by re-run go generated, no need to delete

To clean the binary:

- `make clean`
8 changes: 4 additions & 4 deletions frequent_flier_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ package main
type Status int

const (
StatusRed Status = iota
StatusSilver Status = iota
StatusGold Status = iota
StatusRed Status = iota
StatusSilver
StatusGold
)

// go:generate stringer -type=Status
//go:generate stringer -type=Status

type FrequentFlierAccountCreated struct {
AccountId string
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/jen20/go-event-sourcing-sample

go 1.23.1
15 changes: 12 additions & 3 deletions status_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.