Skip to content

Commit

Permalink
Upgrade to latest Goa examples and Clue for observability (#165)
Browse files Browse the repository at this point in the history
* Upgrade plugins to use latest Goa and Clue

* Fix Makefiles to use relative paths
  • Loading branch information
raphael authored Jul 8, 2024
1 parent 891bf8d commit 77793db
Show file tree
Hide file tree
Showing 180 changed files with 891 additions and 1,083 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/goakit/examples/fetcher/archiver/cmd/archivercli/archivercli
/goakit/examples/calc/cmd/calccli/calccli
/goakit/examples/calc/cmd/calccli/calccli
/zaplogger/examples/calc/calc
/zaplogger/examples/calc/calc-cli

*.swp
.vscode/*
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Makefile for goa v3 plugins

GOOS=$(shell go env GOOS)
GOPATH=$(shell go env GOPATH)
GOA:=$(shell goa version 2> /dev/null)

# Only list test and build dependencies
Expand Down Expand Up @@ -38,7 +37,6 @@ endif
ifeq ($(GOOS),windows)
PROTOC=protoc-$(PROTOC_VERSION)-win32
PROTOC_EXEC="$(PROTOC)\bin\protoc.exe"
GOPATH:=$(subst \,/,$(GOPATH))
endif

all: check-goa gen tidy lint test
Expand Down
12 changes: 6 additions & 6 deletions cors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
# - "example" generates the example files for the example services

# include common Makefile content for plugins
GOPATH=$(shell go env GOPATH)
PLUGIN_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include ../plugins.mk

gen:
@goa gen goa.design/plugins/v3/cors/examples/calc/design -o "$(GOPATH)/src/goa.design/plugins/cors/examples/calc" && \
@goa gen goa.design/plugins/v3/cors/examples/calc/design -o "$(PLUGIN_DIR)/examples/calc" && \
make example

example:
@rm -rf "$(GOPATH)/src/goa.design/plugins/cors/examples/calc/cmd"
goa example goa.design/plugins/v3/cors/examples/calc/design -o "$(GOPATH)/src/goa.design/plugins/cors/examples/calc"
@rm -rf "$(PLUGIN_DIR)/examples/calc/cmd"
goa example goa.design/plugins/v3/cors/examples/calc/design -o "$(PLUGIN_DIR)/examples/calc"

build-examples:
@cd "$(GOPATH)/src/goa.design/plugins/cors/examples/calc" && \
@cd "$(PLUGIN_DIR)/examples/calc" && \
go build ./cmd/calc && go build ./cmd/calc-cli

clean:
@cd "$(GOPATH)/src/goa.design/plugins/cors/examples/calc" && \
@cd "$(PLUGIN_DIR)/examples/calc" && \
rm -f calc calc-cli
1 change: 1 addition & 0 deletions cors/examples/calc/cmd/calc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calc.Endpo
// Log query and response bodies if debug logs are enabled.
handler = debug.HTTP()(handler)
}
handler = log.HTTP(ctx)(handler)

// Start HTTP server using default configuration, change the code to
// configure the server as required by your service.
Expand Down
2 changes: 1 addition & 1 deletion cors/examples/calc/cmd/calc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {
}

default:
log.Fatal(ctx, fmt.Errorf("invalid host argument: %q (valid hosts: localhost)\n", *hostF))
log.Fatal(ctx, fmt.Errorf("invalid host argument: %q (valid hosts: localhost)", *hostF))

Check failure on line 106 in cors/examples/calc/cmd/calc/main.go

View workflow job for this annotation

GitHub Actions / Linux

error strings should not end with punctuation or newlines (ST1005)
}

// Wait for signal.
Expand Down
4 changes: 2 additions & 2 deletions cors/examples/calc/gen/calc/client.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/calc/endpoints.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/calc/service.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/client/cli.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/client/client.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/client/encode_decode.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/client/paths.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/client/types.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/server/encode_decode.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/server/paths.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/server/server.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/calc/server/types.go

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

4 changes: 2 additions & 2 deletions cors/examples/calc/gen/http/cli/calc/cli.go

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

12 changes: 6 additions & 6 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
# - "gen" generates the goa files for the example services

# include common Makefile content for plugins
GOPATH=$(shell go env GOPATH)
PLUGIN_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include ../plugins.mk

gen:
@rm -f examples/calc/gen/docs.json
goa gen goa.design/plugins/v3/docs/examples/calc/design -o "$(GOPATH)/src/goa.design/plugins/docs/examples/calc" && \
goa gen goa.design/plugins/v3/docs/examples/calc/design -o "$(PLUGIN_DIR)/examples/calc" && \
make example

example:
@ rm -rf "$(GOPATH)/src/goa.design/plugins/docs/examples/calc/cmd" && \
goa example goa.design/plugins/v3/docs/examples/calc/design -o "$(GOPATH)/src/goa.design/plugins/docs/examples/calc"
@ rm -rf "$(PLUGIN_DIR)/examples/calc/cmd" && \
goa example goa.design/plugins/v3/docs/examples/calc/design -o "$(PLUGIN_DIR)/examples/calc"

build-examples:
@cd "$(GOPATH)/src/goa.design/plugins/docs/examples/calc" && \
@cd "$(PLUGIN_DIR)/examples/calc" && \
go build ./cmd/calc && go build ./cmd/calc-cli

clean:
@cd "$(GOPATH)/src/goa.design/plugins/docs/examples/calc" && \
@cd "$(PLUGIN_DIR)/examples/calc" && \
rm -f calc calc-cli
1 change: 1 addition & 0 deletions docs/examples/calc/cmd/calc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calc.Endpo
// Log query and response bodies if debug logs are enabled.
handler = debug.HTTP()(handler)
}
handler = log.HTTP(ctx)(handler)

// Start HTTP server using default configuration, change the code to
// configure the server as required by your service.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/calc/cmd/calc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {
}

default:
log.Fatal(ctx, fmt.Errorf("invalid host argument: %q (valid hosts: localhost)\n", *hostF))
log.Fatal(ctx, fmt.Errorf("invalid host argument: %q (valid hosts: localhost)", *hostF))

Check failure on line 106 in docs/examples/calc/cmd/calc/main.go

View workflow job for this annotation

GitHub Actions / Linux

error strings should not end with punctuation or newlines (ST1005)
}

// Wait for signal.
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/calc/gen/calc/client.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/calc/endpoints.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/calc/service.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/http/calc/client/cli.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/http/calc/client/client.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/http/calc/client/encode_decode.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/http/calc/client/paths.go

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

4 changes: 2 additions & 2 deletions docs/examples/calc/gen/http/calc/client/types.go

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

Loading

0 comments on commit 77793db

Please sign in to comment.