diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e2e254a6b..90e2ee886 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,10 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Collect Workflow Telemetry - uses: runforesight/foresight-workflow-kit-action@v1 - if: success() || failure() - - name: Set up Go 1.21 uses: actions/setup-go@v4.1.0 with: @@ -25,18 +21,9 @@ jobs: run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH id: setup_path - - name: Build - run: make ci - - - name: Compute code coverage - run: go test -v -json -coverprofile=coverage.out ./...> ./test-report.json || true - - - name: Analyze Test and/or Coverage Results - uses: runforesight/foresight-test-kit-action@v1 - if: success() || failure() - with: - test_format: JSON - test_framework: GOLANG - test_path: "./test-report.json" - coverage_format: GOLANG - coverage_path: ./coverage.out + - name: Run CI for each Makefile + run: | + for makefile in $(find . -type f -name Makefile); do + make -C $(dirname $makefile) test + done + diff --git a/Makefile b/Makefile deleted file mode 100644 index 29eb0a9bc..000000000 --- a/Makefile +++ /dev/null @@ -1,183 +0,0 @@ -#! /usr/bin/make -# -# Makefile for Goa examples -# -# Targets: -# - "depend" retrieves the Go packages needed to run the linter and tests -# - "gen" invokes the "goa" tool to generate the examples source code -# - "build" compiles the example microservices and client CLIs -# - "clean" deletes the output of "build" -# - "lint" runs the linter and checks the code format using goimports -# - "test" runs the tests -# -# Meta targets: -# - "all" is the default target, it runs all the targets in the order above. -# -GO_FILES=$(shell find . -type f -name '*.go') -GOA:=$(shell goa version 2> /dev/null) -GOOS=$(shell go env GOOS) -GOPATH=$(shell go env GOPATH) -GIT_ROOT=$(shell git rev-parse --show-toplevel) - -export GO111MODULE=on - -# Only list test and build dependencies -# Standard dependencies are installed via go get -DEPEND=\ - google.golang.org/protobuf/cmd/protoc-gen-go@latest \ - google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \ - honnef.co/go/tools/cmd/staticcheck@latest \ - goa.design/goa/v3/cmd/goa@v3 - -.phony: all depend lint test build clean - -all: check-goa gen lint test - @echo DONE! - -ci: depend all - -# Install protoc -PROTOC_VERSION=22.2 -UNZIP=unzip -ifeq ($(GOOS),linux) - PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 - PROTOC_EXEC=$(PROTOC)/bin/protoc -endif -ifeq ($(GOOS),darwin) - PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 - PROTOC_EXEC=$(PROTOC)/bin/protoc -endif -ifeq ($(GOOS),windows) - PROTOC=protoc-$(PROTOC_VERSION)-win32 - PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" - GOPATH:=$(subst \,/,$(GOPATH)) - GIT_ROOT:=$(subst \,/,$(GIT_ROOT)) -endif - -# Note: the steps below rely on curl and tar which are available -# on both Linux and Windows 10 (build>=17603). -depend: - @echo INSTALLING DEPENDENCIES... - @go mod download - @for package in $(DEPEND); do go install $$package; done - @go mod tidy -compat=1.19 - @echo INSTALLING PROTOC... - @mkdir $(PROTOC) - @cd $(PROTOC); \ - curl -O -L https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip; \ - $(UNZIP) $(PROTOC).zip - @cp $(PROTOC_EXEC) $(GOPATH)/bin && \ - rm -rf $(PROTOC) && \ - echo "`protoc --version`" - @echo go mod graph - -check-goa: -ifdef GOA - go mod download - @echo $(GOA) -else - go get -u goa.design/goa/v3@v3 - go get -u goa.design/goa/v3/...@v3 - go mod download - @echo $(GOA) -endif - -lint: - @echo LINTING CODE... -ifneq ($(GOOS),windows) - @if [ "`staticcheck ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ - echo "^ - staticcheck errors!" && echo && exit 1; \ - fi -endif - -gen: - @# NOTE: not all command line tools are generated - @echo GENERATING CODE... - @goa version - @cd $(GIT_ROOT) - @rm -rf "basic/cmd/calc-cli" - @rm -rf "cellar/cmd/cellar-cli" - @rm -rf "cookies/cmd/" - @rm -rf "encodings/text/cmd" - @rm -rf "error/cmd" - @rm -rf "files/cmd" - @rm -rf "multipart/cmd" - @rm -rf "security/hierarchy/cmd" - @rm -rf "security/multiauth/cmd" - @rm -rf "streaming/cmd/chatter" - @rm -rf "tus/cmd/upload-cli" - @rm -rf "upload_download/cmd/upload_download-cli" - @echo "basic [1/13]" - @goa gen goa.design/examples/basic/design -o "basic" - @goa example goa.design/examples/basic/design -o "basic" - @echo "cellar [2/13]" - @goa gen goa.design/examples/cellar/design -o "cellar" - @goa example goa.design/examples/cellar/design -o "cellar" - @echo "cookies [3/13]" - @goa gen goa.design/examples/cookies/design -o "cookies" - @goa example goa.design/examples/cookies/design -o "cookies" - @echo "encodings/cbor [4/13]" - @goa gen goa.design/examples/encodings/cbor/design -o "encodings/cbor" - @goa example goa.design/examples/encodings/cbor/design -o "encodings/cbor" - @echo "encodings/text [5/13]" - @goa gen goa.design/examples/encodings/text/design -o "encodings/text" - @goa example goa.design/examples/encodings/text/design -o "encodings/text" - @echo "error [6/13]" - @goa gen goa.design/examples/error/design -o "error" - @goa example goa.design/examples/error/design -o "error" - @echo "files [7/13]" - @goa gen goa.design/examples/files/design -o "files" - @goa example goa.design/examples/files/design -o "files" - @echo "multipart [8/13]" - @goa gen goa.design/examples/multipart/design -o "multipart" - @goa example goa.design/examples/multipart/design -o "multipart" - @echo "security/hierarchy [9/13]" - @goa gen goa.design/examples/security/hierarchy/design -o "security/hierarchy" - @goa example goa.design/examples/security/hierarchy/design -o "security/hierarchy" - @echo "security/multiauth [10/13]" - @goa gen goa.design/examples/security/multiauth/design -o "security/multiauth" - @goa example goa.design/examples/security/multiauth/design -o "security/multiauth" - @echo "streaming [11/13]" - @goa gen goa.design/examples/streaming/design -o "streaming" - @goa example goa.design/examples/streaming/design -o "streaming" - @echo "tus [12/13]" - @goa gen goa.design/examples/tus/design -o "tus" - @goa example goa.design/examples/tus/design -o "tus" - @echo "upload_download [13/13]" - @goa gen goa.design/examples/upload_download/design -o "upload_download" - @goa example goa.design/examples/upload_download/design -o "upload_download" - @go mod tidy -compat=1.19 - -build: - @cd "$(GIT_ROOT)/basic" && \ - go build ./cmd/calc && go build ./cmd/calc-cli - @cd "$(GIT_ROOT)/cellar" && \ - go build ./cmd/cellar && go build ./cmd/cellar-cli - @cd "$(GIT_ROOT)/cookies" && \ - go build ./cmd/session && go build ./cmd/session-cli - @cd "$(GIT_ROOT)/encodings/cbor" && \ - go build ./cmd/concat && go build ./cmd/concat-cli - @cd "$(GIT_ROOT)/encodings/text" && \ - go build ./cmd/text && go build ./cmd/text-cli - @cd "$(GIT_ROOT)/error" && \ - go build ./cmd/calc && go build ./cmd/calc-cli - @cd "$(GIT_ROOT)/files" && \ - go build ./cmd/openapi && go build ./cmd/openapi-cli - @cd "$(GIT_ROOT)/multipart" && \ - go build ./cmd/resume && go build ./cmd/resume-cli - @cd "$(GIT_ROOT)/security/hierarchy" && \ - go build ./cmd/hierarchy && go build ./cmd/hierarchy-cli - @cd "$(GIT_ROOT)/security/multiauth" && \ - go build ./cmd/multi_auth && go build ./cmd/multi_auth-cli - @cd "$(GIT_ROOT)/streaming" && \ - go build ./cmd/chatter && go build ./cmd/chatter-cli - @cd "$(GIT_ROOT)/tracing" && \ - go build ./cmd/calc && go build ./cmd/calc-cli - @cd "$(GIT_ROOT)/tus" && \ - go build ./cmd/upload && go build ./cmd/upload-cli - @cd "$(GIT_ROOT)/upload_download" && \ - go build ./cmd/upload_download && go build ./cmd/upload_download-cli - -test: - @echo TESTING... - @go test ./... > /dev/null diff --git a/README.md b/README.md index 6fc6e2ef7..d3e6b7cb4 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,24 @@ This repository contains examples of microservices implemented using the directory name. The [cellar](https://github.com/goadesign/examples/tree/master/cellar) example provides a complete implementation of a simple microservice. +The samples in each directory serve as templates, and you can clone them using the `gonew` command, as explained in [this blog post](https://go.dev/blog/gonew). + +```shell +$ go install golang.org/x/tools/cmd/gonew@latest +$ gonew goa.design/examples/basic@latest github.com//basic +$ cd basic +``` + A [fully instrumented example](https://github.com/goadesign/clue/tree/main/example/weather) of a -system consisting of multiple Goa microservices is included in the -[Clue](https://github.com/goadesign/clue) repo. +system consisting of multiple Goa microservices is included in the [Clue](https://github.com/goadesign/clue) repo. + +To get started with the Goa Clue example, you can use the gonew command to clone it into your own repository: + +```shell +$ gonew github.com/goadesign/clue/example/weather github.com//weather +$ cd weather +``` +Please follow the README in the Clue repository for more details on running and testing the Goa Clue example. As you study each example consider contributing back by providing better or more complete docs, adding clarifying comments to code or fixing any error you may run across! diff --git a/basic/Makefile b/basic/Makefile new file mode 100644 index 000000000..04f3fe139 --- /dev/null +++ b/basic/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=calc + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/basic/cmd/calc/http.go b/basic/cmd/calc/http.go index 805cfb672..8a4b8ae16 100644 --- a/basic/cmd/calc/http.go +++ b/basic/cmd/calc/http.go @@ -53,7 +53,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calc.Endpo ) { eh := errorHandler(logger) - calcServer = calcsvr.New(calcEndpoints, mux, dec, enc, eh, nil, http.Dir("../../gen/http")) + calcServer = calcsvr.New(calcEndpoints, mux, dec, enc, eh, nil, nil) if debug { servers := goahttp.Servers{ calcServer, @@ -74,7 +74,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calc.Endpo // Start HTTP server using default configuration, change the code to // configure the server as required by your service. - srv := &http.Server{Addr: u.Host, Handler: handler} + srv := &http.Server{Addr: u.Host, Handler: handler, ReadHeaderTimeout: time.Second * 60} for _, m := range calcServer.Mounts { logger.Printf("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } @@ -96,7 +96,10 @@ func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calc.Endpo ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - _ = srv.Shutdown(ctx) + err := srv.Shutdown(ctx) + if err != nil { + logger.Printf("failed to shutdown: %v", err) + } }() } diff --git a/basic/cmd/calc/main.go b/basic/cmd/calc/main.go index 67ba3eef6..5812aa361 100644 --- a/basic/cmd/calc/main.go +++ b/basic/cmd/calc/main.go @@ -78,8 +78,7 @@ func main() { addr := "http://localhost:8000/calc" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "https" @@ -90,8 +89,7 @@ func main() { if *httpPortF != "" { h, _, err := net.SplitHostPort(u.Host) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", u.Host, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) } u.Host = net.JoinHostPort(h, *httpPortF) } else if u.Port() == "" { @@ -104,8 +102,7 @@ func main() { addr := "grpc://localhost:8080" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "grpcs" @@ -116,8 +113,7 @@ func main() { if *grpcPortF != "" { h, _, err := net.SplitHostPort(u.Host) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", u.Host, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) } u.Host = net.JoinHostPort(h, *grpcPortF) } else if u.Port() == "" { @@ -132,8 +128,7 @@ func main() { addr = strings.Replace(addr, "{version}", *versionF, -1) u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "https" @@ -144,8 +139,7 @@ func main() { if *httpPortF != "" { h, _, err := net.SplitHostPort(u.Host) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", u.Host, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) } u.Host = net.JoinHostPort(h, *httpPortF) } else if u.Port() == "" { @@ -159,8 +153,7 @@ func main() { addr = strings.Replace(addr, "{version}", *versionF, -1) u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "grpcs" @@ -171,8 +164,7 @@ func main() { if *grpcPortF != "" { h, _, err := net.SplitHostPort(u.Host) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", u.Host, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) } u.Host = net.JoinHostPort(h, *grpcPortF) } else if u.Port() == "" { @@ -182,7 +174,7 @@ func main() { } default: - fmt.Fprintf(os.Stderr, "invalid host argument: %q (valid hosts: development|production)\n", *hostF) + logger.Fatalf("invalid host argument: %q (valid hosts: development|production)\n", *hostF) } // Wait for signal. diff --git a/basic/gen/calc/client.go b/basic/gen/calc/client.go index f4c383a06..8b1ffe3d6 100644 --- a/basic/gen/calc/client.go +++ b/basic/gen/calc/client.go @@ -3,7 +3,7 @@ // calc client // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package calc diff --git a/basic/gen/calc/endpoints.go b/basic/gen/calc/endpoints.go index cee8f8baa..6092411e0 100644 --- a/basic/gen/calc/endpoints.go +++ b/basic/gen/calc/endpoints.go @@ -3,7 +3,7 @@ // calc endpoints // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package calc diff --git a/basic/gen/calc/service.go b/basic/gen/calc/service.go index 34f0f8503..014a45037 100644 --- a/basic/gen/calc/service.go +++ b/basic/gen/calc/service.go @@ -3,7 +3,7 @@ // calc service // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package calc diff --git a/basic/gen/grpc/calc/client/cli.go b/basic/gen/grpc/calc/client/cli.go index 9f397c9f5..7d49a8bc0 100644 --- a/basic/gen/grpc/calc/client/cli.go +++ b/basic/gen/grpc/calc/client/cli.go @@ -3,7 +3,7 @@ // calc gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/grpc/calc/client/client.go b/basic/gen/grpc/calc/client/client.go index ceb905cad..b6cdf3ae9 100644 --- a/basic/gen/grpc/calc/client/client.go +++ b/basic/gen/grpc/calc/client/client.go @@ -3,7 +3,7 @@ // calc gRPC client // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/grpc/calc/client/encode_decode.go b/basic/gen/grpc/calc/client/encode_decode.go index 00ececa87..6864cd0c1 100644 --- a/basic/gen/grpc/calc/client/encode_decode.go +++ b/basic/gen/grpc/calc/client/encode_decode.go @@ -3,7 +3,7 @@ // calc gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/grpc/calc/client/types.go b/basic/gen/grpc/calc/client/types.go index d0001147e..771f28fb6 100644 --- a/basic/gen/grpc/calc/client/types.go +++ b/basic/gen/grpc/calc/client/types.go @@ -3,7 +3,7 @@ // calc gRPC client types // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/grpc/calc/pb/goagen_basic_calc.pb.go b/basic/gen/grpc/calc/pb/goagen_basic_calc.pb.go index 7225174ac..8c01369b4 100644 --- a/basic/gen/grpc/calc/pb/goagen_basic_calc.pb.go +++ b/basic/gen/grpc/calc/pb/goagen_basic_calc.pb.go @@ -3,12 +3,12 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_basic_calc.proto package calcpb diff --git a/basic/gen/grpc/calc/pb/goagen_basic_calc.proto b/basic/gen/grpc/calc/pb/goagen_basic_calc.proto index 8d140f32f..c3a2e8c8c 100644 --- a/basic/gen/grpc/calc/pb/goagen_basic_calc.proto +++ b/basic/gen/grpc/calc/pb/goagen_basic_calc.proto @@ -3,7 +3,7 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design syntax = "proto3"; diff --git a/basic/gen/grpc/calc/pb/goagen_basic_calc_grpc.pb.go b/basic/gen/grpc/calc/pb/goagen_basic_calc_grpc.pb.go index 066ea87b0..008d87db8 100644 --- a/basic/gen/grpc/calc/pb/goagen_basic_calc_grpc.pb.go +++ b/basic/gen/grpc/calc/pb/goagen_basic_calc_grpc.pb.go @@ -3,12 +3,12 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_basic_calc.proto package calcpb diff --git a/basic/gen/grpc/calc/server/encode_decode.go b/basic/gen/grpc/calc/server/encode_decode.go index 26401f67f..e4ddee216 100644 --- a/basic/gen/grpc/calc/server/encode_decode.go +++ b/basic/gen/grpc/calc/server/encode_decode.go @@ -3,7 +3,7 @@ // calc gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/grpc/calc/server/server.go b/basic/gen/grpc/calc/server/server.go index 68a8f0ea1..52cd6d47c 100644 --- a/basic/gen/grpc/calc/server/server.go +++ b/basic/gen/grpc/calc/server/server.go @@ -3,7 +3,7 @@ // calc gRPC server // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/grpc/calc/server/types.go b/basic/gen/grpc/calc/server/types.go index fcdda008f..887889948 100644 --- a/basic/gen/grpc/calc/server/types.go +++ b/basic/gen/grpc/calc/server/types.go @@ -3,7 +3,7 @@ // calc gRPC server types // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/grpc/cli/calc/cli.go b/basic/gen/grpc/cli/calc/cli.go index ffa6a890c..1f8be64ca 100644 --- a/basic/gen/grpc/cli/calc/cli.go +++ b/basic/gen/grpc/cli/calc/cli.go @@ -3,7 +3,7 @@ // calc gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package cli diff --git a/basic/gen/http/calc/client/cli.go b/basic/gen/http/calc/client/cli.go index 6338ee647..148a47fbf 100644 --- a/basic/gen/http/calc/client/cli.go +++ b/basic/gen/http/calc/client/cli.go @@ -3,7 +3,7 @@ // calc HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/http/calc/client/client.go b/basic/gen/http/calc/client/client.go index 14e850d8b..c9d183c18 100644 --- a/basic/gen/http/calc/client/client.go +++ b/basic/gen/http/calc/client/client.go @@ -3,7 +3,7 @@ // calc client HTTP transport // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/http/calc/client/encode_decode.go b/basic/gen/http/calc/client/encode_decode.go index bc621b2fe..51ff1a891 100644 --- a/basic/gen/http/calc/client/encode_decode.go +++ b/basic/gen/http/calc/client/encode_decode.go @@ -3,7 +3,7 @@ // calc HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/http/calc/client/paths.go b/basic/gen/http/calc/client/paths.go index ecc435bf0..6b9e6500b 100644 --- a/basic/gen/http/calc/client/paths.go +++ b/basic/gen/http/calc/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the calc service. // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/http/calc/client/types.go b/basic/gen/http/calc/client/types.go index 9b45773be..ab85866d5 100644 --- a/basic/gen/http/calc/client/types.go +++ b/basic/gen/http/calc/client/types.go @@ -3,6 +3,6 @@ // calc HTTP client types // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package client diff --git a/basic/gen/http/calc/server/encode_decode.go b/basic/gen/http/calc/server/encode_decode.go index 3a34bdc74..a6a000a88 100644 --- a/basic/gen/http/calc/server/encode_decode.go +++ b/basic/gen/http/calc/server/encode_decode.go @@ -3,7 +3,7 @@ // calc HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/http/calc/server/paths.go b/basic/gen/http/calc/server/paths.go index 9834e5281..03bccae4c 100644 --- a/basic/gen/http/calc/server/paths.go +++ b/basic/gen/http/calc/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the calc service. // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/http/calc/server/server.go b/basic/gen/http/calc/server/server.go index 931c73464..65adc529b 100644 --- a/basic/gen/http/calc/server/server.go +++ b/basic/gen/http/calc/server/server.go @@ -3,7 +3,7 @@ // calc HTTP server // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/http/calc/server/types.go b/basic/gen/http/calc/server/types.go index 0d03ac51b..1276b41c8 100644 --- a/basic/gen/http/calc/server/types.go +++ b/basic/gen/http/calc/server/types.go @@ -3,7 +3,7 @@ // calc HTTP server types // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package server diff --git a/basic/gen/http/cli/calc/cli.go b/basic/gen/http/cli/calc/cli.go index b2ca5ee60..bf626d313 100644 --- a/basic/gen/http/cli/calc/cli.go +++ b/basic/gen/http/cli/calc/cli.go @@ -3,7 +3,7 @@ // calc HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/basic/design -o basic +// $ goa gen goa.design/examples/basic/design package cli diff --git a/basic/go.mod b/basic/go.mod new file mode 100644 index 000000000..731eca3cf --- /dev/null +++ b/basic/go.mod @@ -0,0 +1,27 @@ +module goa.design/examples/basic + +go 1.21.1 + +require ( + goa.design/goa/v3 v3.13.2 + google.golang.org/grpc v1.58.2 + google.golang.org/protobuf v1.31.0 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/basic/go.sum b/basic/go.sum new file mode 100644 index 000000000..864cc39f0 --- /dev/null +++ b/basic/go.sum @@ -0,0 +1,66 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cellar/Makefile b/cellar/Makefile new file mode 100644 index 000000000..6bc04d70d --- /dev/null +++ b/cellar/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=cellar + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/cellar/cmd/cellar/grpc.go b/cellar/cmd/cellar/grpc.go index 29bce2145..10755bf58 100644 --- a/cellar/cmd/cellar/grpc.go +++ b/cellar/cmd/cellar/grpc.go @@ -16,6 +16,7 @@ import ( grpcmdlwr "goa.design/goa/v3/grpc/middleware" "goa.design/goa/v3/middleware" "google.golang.org/grpc" + "google.golang.org/grpc/reflection" ) // handleGRPCServer starts configures and starts a gRPC server on the given @@ -61,6 +62,10 @@ func handleGRPCServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme } } + // Register the server reflection service on the server. + // See https://grpc.github.io/grpc/core/md_doc_server-reflection.html. + reflection.Register(srv) + (*wg).Add(1) go func() { defer (*wg).Done() diff --git a/cellar/cmd/cellar/http.go b/cellar/cmd/cellar/http.go index 9476132f7..a7bf42168 100644 --- a/cellar/cmd/cellar/http.go +++ b/cellar/cmd/cellar/http.go @@ -16,7 +16,7 @@ import ( sommelier "goa.design/examples/cellar/gen/sommelier" storage "goa.design/examples/cellar/gen/storage" goahttp "goa.design/goa/v3/http" - httpmiddleware "goa.design/goa/v3/http/middleware" + httpmdlwr "goa.design/goa/v3/http/middleware" "goa.design/goa/v3/middleware" ) @@ -35,7 +35,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme // Provide the transport specific request decoder and response encoder. // The goa http package has built-in support for JSON, XML and gob. // Other encodings can be used by providing the corresponding functions, - // see goa.design/encoding. + // see goa.design/implement/encoding. var ( dec = goahttp.RequestDecoder enc = goahttp.ResponseEncoder @@ -62,6 +62,14 @@ func handleHTTPServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme sommelierServer = sommeliersvr.New(sommelierEndpoints, mux, dec, enc, eh, nil) storageServer = storagesvr.New(storageEndpoints, mux, dec, enc, eh, nil, cellar.StorageMultiAddDecoderFunc, cellar.StorageMultiUpdateDecoderFunc) swaggerServer = swaggersvr.New(nil, mux, dec, enc, eh, nil, nil) + if debug { + servers := goahttp.Servers{ + sommelierServer, + storageServer, + swaggerServer, + } + servers.Use(httpmdlwr.Debug(mux, os.Stdout)) + } } // Configure the mux. sommeliersvr.Mount(mux, sommelierServer) @@ -72,16 +80,13 @@ func handleHTTPServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme // here apply to all the service endpoints. var handler http.Handler = mux { - if debug { - handler = httpmiddleware.Debug(mux, os.Stdout)(handler) - } - handler = httpmiddleware.Log(adapter)(handler) - handler = httpmiddleware.RequestID()(handler) + handler = httpmdlwr.Log(adapter)(handler) + handler = httpmdlwr.RequestID()(handler) } // Start HTTP server using default configuration, change the code to // configure the server as required by your service. - srv := &http.Server{Addr: u.Host, Handler: handler} + srv := &http.Server{Addr: u.Host, Handler: handler, ReadHeaderTimeout: time.Second * 60} for _, m := range sommelierServer.Mounts { logger.Printf("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } @@ -106,10 +111,13 @@ func handleHTTPServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme logger.Printf("shutting down HTTP server at %q", u.Host) // Shutdown gracefully with a 30s timeout. - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - srv.Shutdown(ctx) + err := srv.Shutdown(ctx) + if err != nil { + logger.Printf("failed to shutdown: %v", err) + } }() } @@ -119,7 +127,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, sommelierEndpoints *somme func errorHandler(logger *log.Logger) func(context.Context, http.ResponseWriter, error) { return func(ctx context.Context, w http.ResponseWriter, err error) { id := ctx.Value(middleware.RequestIDKey).(string) - w.Write([]byte("[" + id + "] encoding: " + err.Error())) + _, _ = w.Write([]byte("[" + id + "] encoding: " + err.Error())) logger.Printf("[%s] ERROR: %s", id, err.Error()) } } diff --git a/cellar/cmd/cellar/main.go b/cellar/cmd/cellar/main.go index 74aa4fa57..63e6b5f44 100644 --- a/cellar/cmd/cellar/main.go +++ b/cellar/cmd/cellar/main.go @@ -5,11 +5,12 @@ import ( "flag" "fmt" "log" + "net" "net/url" "os" "os/signal" - "strings" "sync" + "syscall" "github.com/boltdb/bolt" @@ -25,7 +26,7 @@ func main() { hostF = flag.String("host", "localhost", "Server host (valid values: localhost, goa.design)") domainF = flag.String("domain", "", "Host domain name (overrides host domain specified in service design)") httpPortF = flag.String("http-port", "", "HTTP port (overrides host HTTP port specified in service design)") - grpcPortF = flag.String("grpc-port", "", "GRPC port (overrides host gRPC port specified in service design)") + grpcPortF = flag.String("grpc-port", "", "gRPC port (overrides host gRPC port specified in service design)") secureF = flag.Bool("secure", false, "Use secure scheme (https or grpcs)") dbgF = flag.Bool("debug", false, "Log request and response bodies") ) @@ -38,7 +39,6 @@ func main() { { logger = log.New(os.Stderr, "[cellar] ", log.Ltime) } - // Initialize service dependencies such as databases. var ( db *bolt.DB @@ -51,7 +51,6 @@ func main() { } defer db.Close() } - // Initialize the services. var ( sommelierSvc sommelier.Service @@ -85,12 +84,13 @@ func main() { // that SIGINT and SIGTERM signals cause the services to stop gracefully. go func() { c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) errc <- fmt.Errorf("%s", <-c) }() var wg sync.WaitGroup ctx, cancel := context.WithCancel(context.Background()) + // Start the servers and send errors (if any) to the error channel. switch *hostF { case "localhost": @@ -98,8 +98,7 @@ func main() { addr := "http://localhost:8000/cellar" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "https" @@ -108,10 +107,13 @@ func main() { u.Host = *domainF } if *httpPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *httpPortF + h, _, err := net.SplitHostPort(u.Host) + if err != nil { + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) + } + u.Host = net.JoinHostPort(h, *httpPortF) } else if u.Port() == "" { - u.Host += ":80" + u.Host = net.JoinHostPort(u.Host, "80") } handleHTTPServer(ctx, u, sommelierEndpoints, storageEndpoints, &wg, errc, logger, *dbgF) } @@ -120,8 +122,7 @@ func main() { addr := "grpc://localhost:8080/cellar" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "grpcs" @@ -130,20 +131,23 @@ func main() { u.Host = *domainF } if *grpcPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *grpcPortF + h, _, err := net.SplitHostPort(u.Host) + if err != nil { + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) + } + u.Host = net.JoinHostPort(h, *grpcPortF) } else if u.Port() == "" { - u.Host += ":8080" + u.Host = net.JoinHostPort(u.Host, "8080") } handleGRPCServer(ctx, u, sommelierEndpoints, storageEndpoints, &wg, errc, logger, *dbgF) } + case "goa.design": { addr := "https://goa.design/cellar" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "https" @@ -152,10 +156,13 @@ func main() { u.Host = *domainF } if *httpPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *httpPortF + h, _, err := net.SplitHostPort(u.Host) + if err != nil { + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) + } + u.Host = net.JoinHostPort(h, *httpPortF) } else if u.Port() == "" { - u.Host += ":443" + u.Host = net.JoinHostPort(u.Host, "443") } handleHTTPServer(ctx, u, sommelierEndpoints, storageEndpoints, &wg, errc, logger, *dbgF) } @@ -164,8 +171,7 @@ func main() { addr := "grpcs://goa.design/cellar" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "grpcs" @@ -174,16 +180,21 @@ func main() { u.Host = *domainF } if *grpcPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *grpcPortF + h, _, err := net.SplitHostPort(u.Host) + if err != nil { + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) + } + u.Host = net.JoinHostPort(h, *grpcPortF) } else if u.Port() == "" { - u.Host += ":8443" + u.Host = net.JoinHostPort(u.Host, "8443") } handleGRPCServer(ctx, u, sommelierEndpoints, storageEndpoints, &wg, errc, logger, *dbgF) } + default: - fmt.Fprintf(os.Stderr, "invalid host argument: %q (valid hosts: localhost|goa.design)", *hostF) + logger.Fatalf("invalid host argument: %q (valid hosts: localhost|goa.design)\n", *hostF) } + // Wait for signal. logger.Printf("exiting (%v)", <-errc) diff --git a/cellar/gen/grpc/cli/cellar/cli.go b/cellar/gen/grpc/cli/cellar/cli.go index b10f65d56..f5878a0bb 100644 --- a/cellar/gen/grpc/cli/cellar/cli.go +++ b/cellar/gen/grpc/cli/cellar/cli.go @@ -3,7 +3,7 @@ // cellar gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package cli diff --git a/cellar/gen/grpc/sommelier/client/cli.go b/cellar/gen/grpc/sommelier/client/cli.go index 9f1256f62..d8f423ba0 100644 --- a/cellar/gen/grpc/sommelier/client/cli.go +++ b/cellar/gen/grpc/sommelier/client/cli.go @@ -3,7 +3,7 @@ // sommelier gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/sommelier/client/client.go b/cellar/gen/grpc/sommelier/client/client.go index 4a8d02126..393323712 100644 --- a/cellar/gen/grpc/sommelier/client/client.go +++ b/cellar/gen/grpc/sommelier/client/client.go @@ -3,7 +3,7 @@ // sommelier gRPC client // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/sommelier/client/encode_decode.go b/cellar/gen/grpc/sommelier/client/encode_decode.go index e99fd9dce..3b8722e38 100644 --- a/cellar/gen/grpc/sommelier/client/encode_decode.go +++ b/cellar/gen/grpc/sommelier/client/encode_decode.go @@ -3,7 +3,7 @@ // sommelier gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/sommelier/client/types.go b/cellar/gen/grpc/sommelier/client/types.go index 7e1b3f6b5..c37ec0693 100644 --- a/cellar/gen/grpc/sommelier/client/types.go +++ b/cellar/gen/grpc/sommelier/client/types.go @@ -3,7 +3,7 @@ // sommelier gRPC client types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.pb.go b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.pb.go index 5e8e62c68..df6d0864c 100644 --- a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.pb.go +++ b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.pb.go @@ -3,12 +3,12 @@ // sommelier protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_cellar_sommelier.proto package sommelierpb diff --git a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.proto b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.proto index 08d8cc171..1b145b360 100644 --- a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.proto +++ b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier.proto @@ -3,7 +3,7 @@ // sommelier protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design syntax = "proto3"; diff --git a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier_grpc.pb.go b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier_grpc.pb.go index 06e120780..2d4ef0039 100644 --- a/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier_grpc.pb.go +++ b/cellar/gen/grpc/sommelier/pb/goagen_cellar_sommelier_grpc.pb.go @@ -3,12 +3,12 @@ // sommelier protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_cellar_sommelier.proto package sommelierpb diff --git a/cellar/gen/grpc/sommelier/server/encode_decode.go b/cellar/gen/grpc/sommelier/server/encode_decode.go index 6753d0956..129eaaf83 100644 --- a/cellar/gen/grpc/sommelier/server/encode_decode.go +++ b/cellar/gen/grpc/sommelier/server/encode_decode.go @@ -3,7 +3,7 @@ // sommelier gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/grpc/sommelier/server/server.go b/cellar/gen/grpc/sommelier/server/server.go index e654a1b63..21e3f1cc0 100644 --- a/cellar/gen/grpc/sommelier/server/server.go +++ b/cellar/gen/grpc/sommelier/server/server.go @@ -3,7 +3,7 @@ // sommelier gRPC server // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/grpc/sommelier/server/types.go b/cellar/gen/grpc/sommelier/server/types.go index 0f42e2066..4bf63b79f 100644 --- a/cellar/gen/grpc/sommelier/server/types.go +++ b/cellar/gen/grpc/sommelier/server/types.go @@ -3,7 +3,7 @@ // sommelier gRPC server types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/grpc/storage/client/cli.go b/cellar/gen/grpc/storage/client/cli.go index 0f4ca0ea2..5fd3192d0 100644 --- a/cellar/gen/grpc/storage/client/cli.go +++ b/cellar/gen/grpc/storage/client/cli.go @@ -3,7 +3,7 @@ // storage gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/storage/client/client.go b/cellar/gen/grpc/storage/client/client.go index c37071f38..6d87dee91 100644 --- a/cellar/gen/grpc/storage/client/client.go +++ b/cellar/gen/grpc/storage/client/client.go @@ -3,7 +3,7 @@ // storage gRPC client // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/storage/client/encode_decode.go b/cellar/gen/grpc/storage/client/encode_decode.go index 8daf6644b..ea0042b89 100644 --- a/cellar/gen/grpc/storage/client/encode_decode.go +++ b/cellar/gen/grpc/storage/client/encode_decode.go @@ -3,7 +3,7 @@ // storage gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/storage/client/types.go b/cellar/gen/grpc/storage/client/types.go index 7a894368a..d2482501d 100644 --- a/cellar/gen/grpc/storage/client/types.go +++ b/cellar/gen/grpc/storage/client/types.go @@ -3,7 +3,7 @@ // storage gRPC client types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/grpc/storage/pb/goagen_cellar_storage.pb.go b/cellar/gen/grpc/storage/pb/goagen_cellar_storage.pb.go index 6d4ff3a6f..edfa8fea6 100644 --- a/cellar/gen/grpc/storage/pb/goagen_cellar_storage.pb.go +++ b/cellar/gen/grpc/storage/pb/goagen_cellar_storage.pb.go @@ -3,12 +3,12 @@ // storage protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_cellar_storage.proto package storagepb diff --git a/cellar/gen/grpc/storage/pb/goagen_cellar_storage.proto b/cellar/gen/grpc/storage/pb/goagen_cellar_storage.proto index 66a38c040..c9ad470cc 100644 --- a/cellar/gen/grpc/storage/pb/goagen_cellar_storage.proto +++ b/cellar/gen/grpc/storage/pb/goagen_cellar_storage.proto @@ -3,7 +3,7 @@ // storage protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design syntax = "proto3"; diff --git a/cellar/gen/grpc/storage/pb/goagen_cellar_storage_grpc.pb.go b/cellar/gen/grpc/storage/pb/goagen_cellar_storage_grpc.pb.go index cc515aa65..bbd40a49e 100644 --- a/cellar/gen/grpc/storage/pb/goagen_cellar_storage_grpc.pb.go +++ b/cellar/gen/grpc/storage/pb/goagen_cellar_storage_grpc.pb.go @@ -3,12 +3,12 @@ // storage protocol buffer definition // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_cellar_storage.proto package storagepb diff --git a/cellar/gen/grpc/storage/server/encode_decode.go b/cellar/gen/grpc/storage/server/encode_decode.go index 0968d782c..e11ebf267 100644 --- a/cellar/gen/grpc/storage/server/encode_decode.go +++ b/cellar/gen/grpc/storage/server/encode_decode.go @@ -3,7 +3,7 @@ // storage gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/grpc/storage/server/server.go b/cellar/gen/grpc/storage/server/server.go index 89e055da6..ecaff63c0 100644 --- a/cellar/gen/grpc/storage/server/server.go +++ b/cellar/gen/grpc/storage/server/server.go @@ -3,7 +3,7 @@ // storage gRPC server // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/grpc/storage/server/types.go b/cellar/gen/grpc/storage/server/types.go index 3e20b545b..e2e83ac0e 100644 --- a/cellar/gen/grpc/storage/server/types.go +++ b/cellar/gen/grpc/storage/server/types.go @@ -3,7 +3,7 @@ // storage gRPC server types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/cli/cellar/cli.go b/cellar/gen/http/cli/cellar/cli.go index dc413624b..ea372ad47 100644 --- a/cellar/gen/http/cli/cellar/cli.go +++ b/cellar/gen/http/cli/cellar/cli.go @@ -3,7 +3,7 @@ // cellar HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package cli diff --git a/cellar/gen/http/sommelier/client/cli.go b/cellar/gen/http/sommelier/client/cli.go index 91ad3df85..ef921726b 100644 --- a/cellar/gen/http/sommelier/client/cli.go +++ b/cellar/gen/http/sommelier/client/cli.go @@ -3,7 +3,7 @@ // sommelier HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/sommelier/client/client.go b/cellar/gen/http/sommelier/client/client.go index 3b1724e16..b05fc431b 100644 --- a/cellar/gen/http/sommelier/client/client.go +++ b/cellar/gen/http/sommelier/client/client.go @@ -3,7 +3,7 @@ // sommelier client HTTP transport // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/sommelier/client/encode_decode.go b/cellar/gen/http/sommelier/client/encode_decode.go index feb6e9308..5739b1529 100644 --- a/cellar/gen/http/sommelier/client/encode_decode.go +++ b/cellar/gen/http/sommelier/client/encode_decode.go @@ -3,7 +3,7 @@ // sommelier HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/sommelier/client/paths.go b/cellar/gen/http/sommelier/client/paths.go index 784a25509..5fcdde2eb 100644 --- a/cellar/gen/http/sommelier/client/paths.go +++ b/cellar/gen/http/sommelier/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the sommelier service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/sommelier/client/types.go b/cellar/gen/http/sommelier/client/types.go index 7eefe41fb..24d219eb2 100644 --- a/cellar/gen/http/sommelier/client/types.go +++ b/cellar/gen/http/sommelier/client/types.go @@ -3,7 +3,7 @@ // sommelier HTTP client types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/sommelier/server/encode_decode.go b/cellar/gen/http/sommelier/server/encode_decode.go index b9d69f4ca..06663e9cd 100644 --- a/cellar/gen/http/sommelier/server/encode_decode.go +++ b/cellar/gen/http/sommelier/server/encode_decode.go @@ -3,7 +3,7 @@ // sommelier HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/sommelier/server/paths.go b/cellar/gen/http/sommelier/server/paths.go index de89039cd..a6d95d180 100644 --- a/cellar/gen/http/sommelier/server/paths.go +++ b/cellar/gen/http/sommelier/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the sommelier service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/sommelier/server/server.go b/cellar/gen/http/sommelier/server/server.go index acfc145c8..3969d97b0 100644 --- a/cellar/gen/http/sommelier/server/server.go +++ b/cellar/gen/http/sommelier/server/server.go @@ -3,7 +3,7 @@ // sommelier HTTP server // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/sommelier/server/types.go b/cellar/gen/http/sommelier/server/types.go index f8cbcbd7a..75cf750d9 100644 --- a/cellar/gen/http/sommelier/server/types.go +++ b/cellar/gen/http/sommelier/server/types.go @@ -3,7 +3,7 @@ // sommelier HTTP server types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/storage/client/cli.go b/cellar/gen/http/storage/client/cli.go index 78c38e016..2eed68ff6 100644 --- a/cellar/gen/http/storage/client/cli.go +++ b/cellar/gen/http/storage/client/cli.go @@ -3,7 +3,7 @@ // storage HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/storage/client/client.go b/cellar/gen/http/storage/client/client.go index e4b285243..78ceb7a28 100644 --- a/cellar/gen/http/storage/client/client.go +++ b/cellar/gen/http/storage/client/client.go @@ -3,7 +3,7 @@ // storage client HTTP transport // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/storage/client/encode_decode.go b/cellar/gen/http/storage/client/encode_decode.go index e65da5cc0..2bc1ddd6d 100644 --- a/cellar/gen/http/storage/client/encode_decode.go +++ b/cellar/gen/http/storage/client/encode_decode.go @@ -3,7 +3,7 @@ // storage HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/storage/client/paths.go b/cellar/gen/http/storage/client/paths.go index b3d04aa81..ca6522e61 100644 --- a/cellar/gen/http/storage/client/paths.go +++ b/cellar/gen/http/storage/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the storage service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/storage/client/types.go b/cellar/gen/http/storage/client/types.go index e0dd7065b..49c46f0e3 100644 --- a/cellar/gen/http/storage/client/types.go +++ b/cellar/gen/http/storage/client/types.go @@ -3,7 +3,7 @@ // storage HTTP client types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/storage/server/encode_decode.go b/cellar/gen/http/storage/server/encode_decode.go index 3adb5bd33..913775cee 100644 --- a/cellar/gen/http/storage/server/encode_decode.go +++ b/cellar/gen/http/storage/server/encode_decode.go @@ -3,7 +3,7 @@ // storage HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/storage/server/paths.go b/cellar/gen/http/storage/server/paths.go index 5cceacd62..cf461ea6f 100644 --- a/cellar/gen/http/storage/server/paths.go +++ b/cellar/gen/http/storage/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the storage service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/storage/server/server.go b/cellar/gen/http/storage/server/server.go index f47bc6e8b..ef2c38eba 100644 --- a/cellar/gen/http/storage/server/server.go +++ b/cellar/gen/http/storage/server/server.go @@ -3,7 +3,7 @@ // storage HTTP server // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/storage/server/types.go b/cellar/gen/http/storage/server/types.go index 76d26c6bd..782da2439 100644 --- a/cellar/gen/http/storage/server/types.go +++ b/cellar/gen/http/storage/server/types.go @@ -3,7 +3,7 @@ // storage HTTP server types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/swagger/client/client.go b/cellar/gen/http/swagger/client/client.go index cb8ad5db8..c2aaa67b2 100644 --- a/cellar/gen/http/swagger/client/client.go +++ b/cellar/gen/http/swagger/client/client.go @@ -3,7 +3,7 @@ // swagger client HTTP transport // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/swagger/client/encode_decode.go b/cellar/gen/http/swagger/client/encode_decode.go index f0b478564..1919b91dd 100644 --- a/cellar/gen/http/swagger/client/encode_decode.go +++ b/cellar/gen/http/swagger/client/encode_decode.go @@ -3,6 +3,6 @@ // swagger HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/swagger/client/paths.go b/cellar/gen/http/swagger/client/paths.go index 48524a583..921d56edb 100644 --- a/cellar/gen/http/swagger/client/paths.go +++ b/cellar/gen/http/swagger/client/paths.go @@ -3,6 +3,6 @@ // HTTP request path constructors for the swagger service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/swagger/client/types.go b/cellar/gen/http/swagger/client/types.go index c356578a2..d3025892d 100644 --- a/cellar/gen/http/swagger/client/types.go +++ b/cellar/gen/http/swagger/client/types.go @@ -3,6 +3,6 @@ // swagger HTTP client types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package client diff --git a/cellar/gen/http/swagger/server/paths.go b/cellar/gen/http/swagger/server/paths.go index d070589f3..1a1b9d268 100644 --- a/cellar/gen/http/swagger/server/paths.go +++ b/cellar/gen/http/swagger/server/paths.go @@ -3,6 +3,6 @@ // HTTP request path constructors for the swagger service. // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/swagger/server/server.go b/cellar/gen/http/swagger/server/server.go index 8dd79ef75..b2cd23e15 100644 --- a/cellar/gen/http/swagger/server/server.go +++ b/cellar/gen/http/swagger/server/server.go @@ -3,7 +3,7 @@ // swagger HTTP server // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/http/swagger/server/types.go b/cellar/gen/http/swagger/server/types.go index f434fd233..b632a6c43 100644 --- a/cellar/gen/http/swagger/server/types.go +++ b/cellar/gen/http/swagger/server/types.go @@ -3,6 +3,6 @@ // swagger HTTP server types // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package server diff --git a/cellar/gen/sommelier/client.go b/cellar/gen/sommelier/client.go index b13c224d2..9b1bf32b6 100644 --- a/cellar/gen/sommelier/client.go +++ b/cellar/gen/sommelier/client.go @@ -3,7 +3,7 @@ // sommelier client // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package sommelier diff --git a/cellar/gen/sommelier/endpoints.go b/cellar/gen/sommelier/endpoints.go index 722742d46..e6a2a94fe 100644 --- a/cellar/gen/sommelier/endpoints.go +++ b/cellar/gen/sommelier/endpoints.go @@ -3,7 +3,7 @@ // sommelier endpoints // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package sommelier diff --git a/cellar/gen/sommelier/service.go b/cellar/gen/sommelier/service.go index aa2785a57..0f199a5f1 100644 --- a/cellar/gen/sommelier/service.go +++ b/cellar/gen/sommelier/service.go @@ -3,7 +3,7 @@ // sommelier service // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package sommelier diff --git a/cellar/gen/sommelier/views/view.go b/cellar/gen/sommelier/views/view.go index a26f94183..207bd7fbf 100644 --- a/cellar/gen/sommelier/views/view.go +++ b/cellar/gen/sommelier/views/view.go @@ -3,7 +3,7 @@ // sommelier views // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package views diff --git a/cellar/gen/storage/client.go b/cellar/gen/storage/client.go index 6a4db512c..862b1cb3f 100644 --- a/cellar/gen/storage/client.go +++ b/cellar/gen/storage/client.go @@ -3,7 +3,7 @@ // storage client // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package storage diff --git a/cellar/gen/storage/endpoints.go b/cellar/gen/storage/endpoints.go index 880b4a542..7fae218c0 100644 --- a/cellar/gen/storage/endpoints.go +++ b/cellar/gen/storage/endpoints.go @@ -3,7 +3,7 @@ // storage endpoints // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package storage diff --git a/cellar/gen/storage/service.go b/cellar/gen/storage/service.go index 463d2c517..7104d417b 100644 --- a/cellar/gen/storage/service.go +++ b/cellar/gen/storage/service.go @@ -3,7 +3,7 @@ // storage service // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package storage diff --git a/cellar/gen/storage/views/view.go b/cellar/gen/storage/views/view.go index 7d0dfdb0f..298b3790d 100644 --- a/cellar/gen/storage/views/view.go +++ b/cellar/gen/storage/views/view.go @@ -3,7 +3,7 @@ // storage views // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package views diff --git a/cellar/gen/swagger/client.go b/cellar/gen/swagger/client.go index 7896f4983..28fa84d9c 100644 --- a/cellar/gen/swagger/client.go +++ b/cellar/gen/swagger/client.go @@ -3,7 +3,7 @@ // swagger client // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package swagger diff --git a/cellar/gen/swagger/endpoints.go b/cellar/gen/swagger/endpoints.go index 5d9f15a5b..03c450b72 100644 --- a/cellar/gen/swagger/endpoints.go +++ b/cellar/gen/swagger/endpoints.go @@ -3,7 +3,7 @@ // swagger endpoints // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package swagger diff --git a/cellar/gen/swagger/service.go b/cellar/gen/swagger/service.go index ff533de18..496744b68 100644 --- a/cellar/gen/swagger/service.go +++ b/cellar/gen/swagger/service.go @@ -3,7 +3,7 @@ // swagger service // // Command: -// $ goa gen goa.design/examples/cellar/design -o cellar +// $ goa gen goa.design/examples/cellar/design package swagger diff --git a/cellar/go.mod b/cellar/go.mod new file mode 100644 index 000000000..6a83745b8 --- /dev/null +++ b/cellar/go.mod @@ -0,0 +1,28 @@ +module goa.design/examples/cellar + +go 1.21.1 + +require ( + github.com/boltdb/bolt v1.3.1 + goa.design/goa/v3 v3.13.2 + google.golang.org/grpc v1.58.2 + google.golang.org/protobuf v1.31.0 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/cellar/go.sum b/cellar/go.sum new file mode 100644 index 000000000..a5b438d04 --- /dev/null +++ b/cellar/go.sum @@ -0,0 +1,68 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cellar/storage.go b/cellar/storage.go index df65664ea..4bf93ad69 100644 --- a/cellar/storage.go +++ b/cellar/storage.go @@ -5,9 +5,8 @@ import ( "log" "strings" - storage "goa.design/examples/cellar/gen/storage" - "github.com/boltdb/bolt" + storage "goa.design/examples/cellar/gen/storage" ) // storage service example implementation. diff --git a/cookies/Makefile b/cookies/Makefile new file mode 100644 index 000000000..befbe0064 --- /dev/null +++ b/cookies/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=cookies + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/cookies/gen/http/cli/session/cli.go b/cookies/gen/http/cli/session/cli.go index e1cbb4ed5..2a33dbaab 100644 --- a/cookies/gen/http/cli/session/cli.go +++ b/cookies/gen/http/cli/session/cli.go @@ -3,7 +3,7 @@ // session HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package cli diff --git a/cookies/gen/http/session/client/cli.go b/cookies/gen/http/session/client/cli.go index cc54e0c98..c9233ac2e 100644 --- a/cookies/gen/http/session/client/cli.go +++ b/cookies/gen/http/session/client/cli.go @@ -3,7 +3,7 @@ // session HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package client diff --git a/cookies/gen/http/session/client/client.go b/cookies/gen/http/session/client/client.go index f93bb0295..6cd54e8b3 100644 --- a/cookies/gen/http/session/client/client.go +++ b/cookies/gen/http/session/client/client.go @@ -3,7 +3,7 @@ // session client HTTP transport // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package client diff --git a/cookies/gen/http/session/client/encode_decode.go b/cookies/gen/http/session/client/encode_decode.go index 695a62219..78cb233df 100644 --- a/cookies/gen/http/session/client/encode_decode.go +++ b/cookies/gen/http/session/client/encode_decode.go @@ -3,7 +3,7 @@ // session HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package client diff --git a/cookies/gen/http/session/client/paths.go b/cookies/gen/http/session/client/paths.go index 8c894781a..bf720d7a7 100644 --- a/cookies/gen/http/session/client/paths.go +++ b/cookies/gen/http/session/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the session service. // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package client diff --git a/cookies/gen/http/session/client/types.go b/cookies/gen/http/session/client/types.go index 8ea5bd271..bc8c00f91 100644 --- a/cookies/gen/http/session/client/types.go +++ b/cookies/gen/http/session/client/types.go @@ -3,7 +3,7 @@ // session HTTP client types // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package client diff --git a/cookies/gen/http/session/server/encode_decode.go b/cookies/gen/http/session/server/encode_decode.go index d764b53a8..33fe40fd8 100644 --- a/cookies/gen/http/session/server/encode_decode.go +++ b/cookies/gen/http/session/server/encode_decode.go @@ -3,7 +3,7 @@ // session HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package server diff --git a/cookies/gen/http/session/server/paths.go b/cookies/gen/http/session/server/paths.go index bea8f81c7..1ebe66f3b 100644 --- a/cookies/gen/http/session/server/paths.go +++ b/cookies/gen/http/session/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the session service. // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package server diff --git a/cookies/gen/http/session/server/server.go b/cookies/gen/http/session/server/server.go index 40eae19ab..182928b49 100644 --- a/cookies/gen/http/session/server/server.go +++ b/cookies/gen/http/session/server/server.go @@ -3,7 +3,7 @@ // session HTTP server // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package server diff --git a/cookies/gen/http/session/server/types.go b/cookies/gen/http/session/server/types.go index 2f6329973..16d65152e 100644 --- a/cookies/gen/http/session/server/types.go +++ b/cookies/gen/http/session/server/types.go @@ -3,7 +3,7 @@ // session HTTP server types // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package server diff --git a/cookies/gen/session/client.go b/cookies/gen/session/client.go index e7d7f1bd0..a445d7d22 100644 --- a/cookies/gen/session/client.go +++ b/cookies/gen/session/client.go @@ -3,7 +3,7 @@ // session client // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package session diff --git a/cookies/gen/session/endpoints.go b/cookies/gen/session/endpoints.go index 40130dafd..9f03591af 100644 --- a/cookies/gen/session/endpoints.go +++ b/cookies/gen/session/endpoints.go @@ -3,7 +3,7 @@ // session endpoints // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package session diff --git a/cookies/gen/session/service.go b/cookies/gen/session/service.go index fca4f79e1..364716e31 100644 --- a/cookies/gen/session/service.go +++ b/cookies/gen/session/service.go @@ -3,7 +3,7 @@ // session service // // Command: -// $ goa gen goa.design/examples/cookies/design -o cookies +// $ goa gen goa.design/examples/cookies/design package session diff --git a/cookies/go.mod b/cookies/go.mod new file mode 100644 index 000000000..89858dbe8 --- /dev/null +++ b/cookies/go.mod @@ -0,0 +1,23 @@ +module goa.design/examples/cookies + +go 1.21.1 + +require ( + github.com/rs/xid v1.5.0 + goa.design/goa/v3 v3.13.2 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/cookies/go.sum b/cookies/go.sum new file mode 100644 index 000000000..1d07210bc --- /dev/null +++ b/cookies/go.sum @@ -0,0 +1,51 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cookies/session.go b/cookies/session.go index 388496501..49cef07d3 100644 --- a/cookies/session.go +++ b/cookies/session.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/rs/xid" session "goa.design/examples/cookies/gen/session" + "github.com/rs/xid" ) // session service example implementation. diff --git a/encodings/cbor/Makefile b/encodings/cbor/Makefile new file mode 100644 index 000000000..cc6c46cff --- /dev/null +++ b/encodings/cbor/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=concat + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/encodings/cbor/cmd/concat-cli/http.go b/encodings/cbor/cmd/concat-cli/http.go index 5d640b0cb..70a699feb 100644 --- a/encodings/cbor/cmd/concat-cli/http.go +++ b/encodings/cbor/cmd/concat-cli/http.go @@ -4,13 +4,12 @@ import ( "net/http" "time" - concatapi "goa.design/examples/encodings/cbor" cli "goa.design/examples/encodings/cbor/gen/http/cli/concat" goahttp "goa.design/goa/v3/http" goa "goa.design/goa/v3/pkg" ) -func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) { +func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, any, error) { var ( doer goahttp.Doer ) @@ -25,8 +24,8 @@ func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, interfa scheme, host, doer, - concatapi.RequestEncoder, - concatapi.ResponseDecoder, + goahttp.RequestEncoder, + goahttp.ResponseDecoder, debug, ) } diff --git a/encodings/cbor/cmd/concat-cli/main.go b/encodings/cbor/cmd/concat-cli/main.go index fec9be2fa..cca7a7218 100644 --- a/encodings/cbor/cmd/concat-cli/main.go +++ b/encodings/cbor/cmd/concat-cli/main.go @@ -58,7 +58,7 @@ func main() { } var ( endpoint goa.Endpoint - payload interface{} + payload any err error ) { diff --git a/encodings/cbor/cmd/concat/http.go b/encodings/cbor/cmd/concat/http.go index cc4e7f65e..2ac8b4875 100644 --- a/encodings/cbor/cmd/concat/http.go +++ b/encodings/cbor/cmd/concat/http.go @@ -9,7 +9,6 @@ import ( "sync" "time" - concatapi "goa.design/examples/encodings/cbor" concat "goa.design/examples/encodings/cbor/gen/concat" concatsvr "goa.design/examples/encodings/cbor/gen/http/concat/server" goahttp "goa.design/goa/v3/http" @@ -34,8 +33,8 @@ func handleHTTPServer(ctx context.Context, u *url.URL, concatEndpoints *concat.E // Other encodings can be used by providing the corresponding functions, // see goa.design/implement/encoding. var ( - dec = concatapi.RequestDecoder - enc = concatapi.ResponseEncoder + dec = goahttp.RequestDecoder + enc = goahttp.ResponseEncoder ) // Build the service HTTP request multiplexer and configure it to serve @@ -75,7 +74,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, concatEndpoints *concat.E // Start HTTP server using default configuration, change the code to // configure the server as required by your service. - srv := &http.Server{Addr: u.Host, Handler: handler} + srv := &http.Server{Addr: u.Host, Handler: handler, ReadHeaderTimeout: time.Second * 60} for _, m := range concatServer.Mounts { logger.Printf("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } @@ -97,7 +96,10 @@ func handleHTTPServer(ctx context.Context, u *url.URL, concatEndpoints *concat.E ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - _ = srv.Shutdown(ctx) + err := srv.Shutdown(ctx) + if err != nil { + logger.Printf("failed to shutdown: %v", err) + } }() } diff --git a/encodings/cbor/cmd/concat/main.go b/encodings/cbor/cmd/concat/main.go index 1bc73f262..0a05b568a 100644 --- a/encodings/cbor/cmd/concat/main.go +++ b/encodings/cbor/cmd/concat/main.go @@ -75,8 +75,7 @@ func main() { addr := "http://localhost:80" u, err := url.Parse(addr) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", addr, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", addr, err) } if *secureF { u.Scheme = "https" @@ -87,8 +86,7 @@ func main() { if *httpPortF != "" { h, _, err := net.SplitHostPort(u.Host) if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s\n", u.Host, err) - os.Exit(1) + logger.Fatalf("invalid URL %#v: %s\n", u.Host, err) } u.Host = net.JoinHostPort(h, *httpPortF) } else if u.Port() == "" { @@ -98,7 +96,7 @@ func main() { } default: - fmt.Fprintf(os.Stderr, "invalid host argument: %q (valid hosts: localhost)\n", *hostF) + logger.Fatalf("invalid host argument: %q (valid hosts: localhost)\n", *hostF) } // Wait for signal. diff --git a/encodings/cbor/gen/concat/client.go b/encodings/cbor/gen/concat/client.go index 9aaeb8177..78a8e4370 100644 --- a/encodings/cbor/gen/concat/client.go +++ b/encodings/cbor/gen/concat/client.go @@ -3,7 +3,7 @@ // concat client // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package concat diff --git a/encodings/cbor/gen/concat/endpoints.go b/encodings/cbor/gen/concat/endpoints.go index ab203c69d..c828abe7d 100644 --- a/encodings/cbor/gen/concat/endpoints.go +++ b/encodings/cbor/gen/concat/endpoints.go @@ -3,7 +3,7 @@ // concat endpoints // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package concat diff --git a/encodings/cbor/gen/concat/service.go b/encodings/cbor/gen/concat/service.go index 9ac183a9b..01dbcd926 100644 --- a/encodings/cbor/gen/concat/service.go +++ b/encodings/cbor/gen/concat/service.go @@ -3,7 +3,7 @@ // concat service // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package concat diff --git a/encodings/cbor/gen/http/cli/concat/cli.go b/encodings/cbor/gen/http/cli/concat/cli.go index 4578e3af7..e615d9ebc 100644 --- a/encodings/cbor/gen/http/cli/concat/cli.go +++ b/encodings/cbor/gen/http/cli/concat/cli.go @@ -3,7 +3,7 @@ // concat HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package cli diff --git a/encodings/cbor/gen/http/concat/client/cli.go b/encodings/cbor/gen/http/concat/client/cli.go index b8b7eeb05..3c9f9893d 100644 --- a/encodings/cbor/gen/http/concat/client/cli.go +++ b/encodings/cbor/gen/http/concat/client/cli.go @@ -3,7 +3,7 @@ // concat HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package client diff --git a/encodings/cbor/gen/http/concat/client/client.go b/encodings/cbor/gen/http/concat/client/client.go index 7bbb5c806..9dc43e2aa 100644 --- a/encodings/cbor/gen/http/concat/client/client.go +++ b/encodings/cbor/gen/http/concat/client/client.go @@ -3,7 +3,7 @@ // concat client HTTP transport // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package client diff --git a/encodings/cbor/gen/http/concat/client/encode_decode.go b/encodings/cbor/gen/http/concat/client/encode_decode.go index 48055f8a5..4d5974da4 100644 --- a/encodings/cbor/gen/http/concat/client/encode_decode.go +++ b/encodings/cbor/gen/http/concat/client/encode_decode.go @@ -3,7 +3,7 @@ // concat HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package client diff --git a/encodings/cbor/gen/http/concat/client/paths.go b/encodings/cbor/gen/http/concat/client/paths.go index 9ee5979a2..18c2424f3 100644 --- a/encodings/cbor/gen/http/concat/client/paths.go +++ b/encodings/cbor/gen/http/concat/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the concat service. // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package client diff --git a/encodings/cbor/gen/http/concat/client/types.go b/encodings/cbor/gen/http/concat/client/types.go index d1b2b7c32..d8108cea3 100644 --- a/encodings/cbor/gen/http/concat/client/types.go +++ b/encodings/cbor/gen/http/concat/client/types.go @@ -3,6 +3,6 @@ // concat HTTP client types // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package client diff --git a/encodings/cbor/gen/http/concat/server/encode_decode.go b/encodings/cbor/gen/http/concat/server/encode_decode.go index 57047b802..b1fef00f6 100644 --- a/encodings/cbor/gen/http/concat/server/encode_decode.go +++ b/encodings/cbor/gen/http/concat/server/encode_decode.go @@ -3,7 +3,7 @@ // concat HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package server diff --git a/encodings/cbor/gen/http/concat/server/paths.go b/encodings/cbor/gen/http/concat/server/paths.go index 0ae888a3e..fa97a3279 100644 --- a/encodings/cbor/gen/http/concat/server/paths.go +++ b/encodings/cbor/gen/http/concat/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the concat service. // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package server diff --git a/encodings/cbor/gen/http/concat/server/server.go b/encodings/cbor/gen/http/concat/server/server.go index 87160e5be..ea7268eef 100644 --- a/encodings/cbor/gen/http/concat/server/server.go +++ b/encodings/cbor/gen/http/concat/server/server.go @@ -3,7 +3,7 @@ // concat HTTP server // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package server diff --git a/encodings/cbor/gen/http/concat/server/types.go b/encodings/cbor/gen/http/concat/server/types.go index 6807b5f0e..2308f9d98 100644 --- a/encodings/cbor/gen/http/concat/server/types.go +++ b/encodings/cbor/gen/http/concat/server/types.go @@ -3,7 +3,7 @@ // concat HTTP server types // // Command: -// $ goa gen goa.design/examples/encodings/cbor/design -o encodings/cbor +// $ goa gen goa.design/examples/encodings/cbor/design package server diff --git a/encodings/cbor/go.mod b/encodings/cbor/go.mod new file mode 100644 index 000000000..38412f20d --- /dev/null +++ b/encodings/cbor/go.mod @@ -0,0 +1,24 @@ +module goa.design/examples/encodings/cbor + +go 1.21.1 + +require ( + github.com/fxamacker/cbor/v2 v2.5.0 + goa.design/goa/v3 v3.13.2 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/encodings/cbor/go.sum b/encodings/cbor/go.sum new file mode 100644 index 000000000..800e4330d --- /dev/null +++ b/encodings/cbor/go.sum @@ -0,0 +1,53 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= +github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/encodings/text/Makefile b/encodings/text/Makefile new file mode 100644 index 000000000..d698d2f49 --- /dev/null +++ b/encodings/text/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=text + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/encodings/text/gen/http/cli/text/cli.go b/encodings/text/gen/http/cli/text/cli.go index 11f4968a1..9b484eea8 100644 --- a/encodings/text/gen/http/cli/text/cli.go +++ b/encodings/text/gen/http/cli/text/cli.go @@ -3,7 +3,7 @@ // text HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package cli diff --git a/encodings/text/gen/http/text/client/cli.go b/encodings/text/gen/http/text/client/cli.go index f5917cf98..f4953a5e8 100644 --- a/encodings/text/gen/http/text/client/cli.go +++ b/encodings/text/gen/http/text/client/cli.go @@ -3,7 +3,7 @@ // text HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package client diff --git a/encodings/text/gen/http/text/client/client.go b/encodings/text/gen/http/text/client/client.go index 3d9af2c7e..fcb87a1ae 100644 --- a/encodings/text/gen/http/text/client/client.go +++ b/encodings/text/gen/http/text/client/client.go @@ -3,7 +3,7 @@ // text client HTTP transport // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package client diff --git a/encodings/text/gen/http/text/client/encode_decode.go b/encodings/text/gen/http/text/client/encode_decode.go index 10753679f..f11f94750 100644 --- a/encodings/text/gen/http/text/client/encode_decode.go +++ b/encodings/text/gen/http/text/client/encode_decode.go @@ -3,7 +3,7 @@ // text HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package client diff --git a/encodings/text/gen/http/text/client/paths.go b/encodings/text/gen/http/text/client/paths.go index dac52544d..c01624094 100644 --- a/encodings/text/gen/http/text/client/paths.go +++ b/encodings/text/gen/http/text/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the text service. // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package client diff --git a/encodings/text/gen/http/text/client/types.go b/encodings/text/gen/http/text/client/types.go index 17ce536de..e46e5f1ad 100644 --- a/encodings/text/gen/http/text/client/types.go +++ b/encodings/text/gen/http/text/client/types.go @@ -3,7 +3,7 @@ // text HTTP client types // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package client diff --git a/encodings/text/gen/http/text/server/encode_decode.go b/encodings/text/gen/http/text/server/encode_decode.go index 09546d4b0..bcc1d155d 100644 --- a/encodings/text/gen/http/text/server/encode_decode.go +++ b/encodings/text/gen/http/text/server/encode_decode.go @@ -3,7 +3,7 @@ // text HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package server diff --git a/encodings/text/gen/http/text/server/paths.go b/encodings/text/gen/http/text/server/paths.go index c4c5ed3a8..9fc553cf3 100644 --- a/encodings/text/gen/http/text/server/paths.go +++ b/encodings/text/gen/http/text/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the text service. // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package server diff --git a/encodings/text/gen/http/text/server/server.go b/encodings/text/gen/http/text/server/server.go index 1de40fd49..162617433 100644 --- a/encodings/text/gen/http/text/server/server.go +++ b/encodings/text/gen/http/text/server/server.go @@ -3,7 +3,7 @@ // text HTTP server // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package server diff --git a/encodings/text/gen/http/text/server/types.go b/encodings/text/gen/http/text/server/types.go index 53c6b3ecf..84bd82346 100644 --- a/encodings/text/gen/http/text/server/types.go +++ b/encodings/text/gen/http/text/server/types.go @@ -3,7 +3,7 @@ // text HTTP server types // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package server diff --git a/encodings/text/gen/text/client.go b/encodings/text/gen/text/client.go index bfaa42093..c85ed0d8b 100644 --- a/encodings/text/gen/text/client.go +++ b/encodings/text/gen/text/client.go @@ -3,7 +3,7 @@ // text client // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package text diff --git a/encodings/text/gen/text/endpoints.go b/encodings/text/gen/text/endpoints.go index 323cc1706..7c1a137ee 100644 --- a/encodings/text/gen/text/endpoints.go +++ b/encodings/text/gen/text/endpoints.go @@ -3,7 +3,7 @@ // text endpoints // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package text diff --git a/encodings/text/gen/text/service.go b/encodings/text/gen/text/service.go index 11d2c61d1..f66257fa4 100644 --- a/encodings/text/gen/text/service.go +++ b/encodings/text/gen/text/service.go @@ -3,7 +3,7 @@ // text service // // Command: -// $ goa gen goa.design/examples/encodings/text/design -o encodings/text +// $ goa gen goa.design/examples/encodings/text/design package text diff --git a/encodings/text/go.mod b/encodings/text/go.mod new file mode 100644 index 000000000..d612e3892 --- /dev/null +++ b/encodings/text/go.mod @@ -0,0 +1,20 @@ +module goa.design/examples/encodings/text + +go 1.21.1 + +require goa.design/goa/v3 v3.13.2 + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/encodings/text/go.sum b/encodings/text/go.sum new file mode 100644 index 000000000..8a92cf665 --- /dev/null +++ b/encodings/text/go.sum @@ -0,0 +1,49 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/error/Makefile b/error/Makefile new file mode 100644 index 000000000..04f3fe139 --- /dev/null +++ b/error/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=calc + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/error/gen/calc/client.go b/error/gen/calc/client.go index 933f6e4fa..83d9e0847 100644 --- a/error/gen/calc/client.go +++ b/error/gen/calc/client.go @@ -3,7 +3,7 @@ // calc client // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package calc diff --git a/error/gen/calc/endpoints.go b/error/gen/calc/endpoints.go index 64d4ef98c..f3683a2a1 100644 --- a/error/gen/calc/endpoints.go +++ b/error/gen/calc/endpoints.go @@ -3,7 +3,7 @@ // calc endpoints // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package calc diff --git a/error/gen/calc/service.go b/error/gen/calc/service.go index 1040e4dbd..a10a4bcda 100644 --- a/error/gen/calc/service.go +++ b/error/gen/calc/service.go @@ -3,7 +3,7 @@ // calc service // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package calc diff --git a/error/gen/grpc/calc/client/cli.go b/error/gen/grpc/calc/client/cli.go index 49fba71a0..a37902acc 100644 --- a/error/gen/grpc/calc/client/cli.go +++ b/error/gen/grpc/calc/client/cli.go @@ -3,7 +3,7 @@ // calc gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/grpc/calc/client/client.go b/error/gen/grpc/calc/client/client.go index 504154d5d..f2558de6f 100644 --- a/error/gen/grpc/calc/client/client.go +++ b/error/gen/grpc/calc/client/client.go @@ -3,7 +3,7 @@ // calc gRPC client // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/grpc/calc/client/encode_decode.go b/error/gen/grpc/calc/client/encode_decode.go index 5b9499e0e..d7805806e 100644 --- a/error/gen/grpc/calc/client/encode_decode.go +++ b/error/gen/grpc/calc/client/encode_decode.go @@ -3,7 +3,7 @@ // calc gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/grpc/calc/client/types.go b/error/gen/grpc/calc/client/types.go index 2f147592e..2836ca777 100644 --- a/error/gen/grpc/calc/client/types.go +++ b/error/gen/grpc/calc/client/types.go @@ -3,7 +3,7 @@ // calc gRPC client types // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/grpc/calc/pb/goagen_error_calc.pb.go b/error/gen/grpc/calc/pb/goagen_error_calc.pb.go index f0d6235dc..4ab49c4ac 100644 --- a/error/gen/grpc/calc/pb/goagen_error_calc.pb.go +++ b/error/gen/grpc/calc/pb/goagen_error_calc.pb.go @@ -3,12 +3,12 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_error_calc.proto package calcpb diff --git a/error/gen/grpc/calc/pb/goagen_error_calc.proto b/error/gen/grpc/calc/pb/goagen_error_calc.proto index eb387358d..23787777e 100644 --- a/error/gen/grpc/calc/pb/goagen_error_calc.proto +++ b/error/gen/grpc/calc/pb/goagen_error_calc.proto @@ -3,7 +3,7 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design syntax = "proto3"; diff --git a/error/gen/grpc/calc/pb/goagen_error_calc_grpc.pb.go b/error/gen/grpc/calc/pb/goagen_error_calc_grpc.pb.go index 04eb11a58..a98d89016 100644 --- a/error/gen/grpc/calc/pb/goagen_error_calc_grpc.pb.go +++ b/error/gen/grpc/calc/pb/goagen_error_calc_grpc.pb.go @@ -3,12 +3,12 @@ // calc protocol buffer definition // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_error_calc.proto package calcpb diff --git a/error/gen/grpc/calc/server/encode_decode.go b/error/gen/grpc/calc/server/encode_decode.go index 2103c9b56..df4739d8d 100644 --- a/error/gen/grpc/calc/server/encode_decode.go +++ b/error/gen/grpc/calc/server/encode_decode.go @@ -3,7 +3,7 @@ // calc gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/grpc/calc/server/server.go b/error/gen/grpc/calc/server/server.go index fa0f3ce18..887ec202b 100644 --- a/error/gen/grpc/calc/server/server.go +++ b/error/gen/grpc/calc/server/server.go @@ -3,7 +3,7 @@ // calc gRPC server // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/grpc/calc/server/types.go b/error/gen/grpc/calc/server/types.go index c1d2b649d..3b4efc53c 100644 --- a/error/gen/grpc/calc/server/types.go +++ b/error/gen/grpc/calc/server/types.go @@ -3,7 +3,7 @@ // calc gRPC server types // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/grpc/cli/calc/cli.go b/error/gen/grpc/cli/calc/cli.go index 5c37da3f0..25fa90a1b 100644 --- a/error/gen/grpc/cli/calc/cli.go +++ b/error/gen/grpc/cli/calc/cli.go @@ -3,7 +3,7 @@ // calc gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package cli diff --git a/error/gen/http/calc/client/cli.go b/error/gen/http/calc/client/cli.go index 54c4b869d..dd3b79131 100644 --- a/error/gen/http/calc/client/cli.go +++ b/error/gen/http/calc/client/cli.go @@ -3,7 +3,7 @@ // calc HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/http/calc/client/client.go b/error/gen/http/calc/client/client.go index 6e52091b6..56facaf19 100644 --- a/error/gen/http/calc/client/client.go +++ b/error/gen/http/calc/client/client.go @@ -3,7 +3,7 @@ // calc client HTTP transport // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/http/calc/client/encode_decode.go b/error/gen/http/calc/client/encode_decode.go index 081b993f2..75fef3568 100644 --- a/error/gen/http/calc/client/encode_decode.go +++ b/error/gen/http/calc/client/encode_decode.go @@ -3,7 +3,7 @@ // calc HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/http/calc/client/paths.go b/error/gen/http/calc/client/paths.go index 28b198555..7d015b3b8 100644 --- a/error/gen/http/calc/client/paths.go +++ b/error/gen/http/calc/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the calc service. // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/http/calc/client/types.go b/error/gen/http/calc/client/types.go index 71bad4353..ce4840cec 100644 --- a/error/gen/http/calc/client/types.go +++ b/error/gen/http/calc/client/types.go @@ -3,7 +3,7 @@ // calc HTTP client types // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package client diff --git a/error/gen/http/calc/server/encode_decode.go b/error/gen/http/calc/server/encode_decode.go index 33634bd6e..cd7beeba5 100644 --- a/error/gen/http/calc/server/encode_decode.go +++ b/error/gen/http/calc/server/encode_decode.go @@ -3,7 +3,7 @@ // calc HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/http/calc/server/paths.go b/error/gen/http/calc/server/paths.go index 141358183..50ed40803 100644 --- a/error/gen/http/calc/server/paths.go +++ b/error/gen/http/calc/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the calc service. // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/http/calc/server/server.go b/error/gen/http/calc/server/server.go index 21b81af83..72a8ce1c3 100644 --- a/error/gen/http/calc/server/server.go +++ b/error/gen/http/calc/server/server.go @@ -3,7 +3,7 @@ // calc HTTP server // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/http/calc/server/types.go b/error/gen/http/calc/server/types.go index 712049348..f2a7b4339 100644 --- a/error/gen/http/calc/server/types.go +++ b/error/gen/http/calc/server/types.go @@ -3,7 +3,7 @@ // calc HTTP server types // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package server diff --git a/error/gen/http/cli/calc/cli.go b/error/gen/http/cli/calc/cli.go index b7290559d..150609bf8 100644 --- a/error/gen/http/cli/calc/cli.go +++ b/error/gen/http/cli/calc/cli.go @@ -3,7 +3,7 @@ // calc HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/error/design -o error +// $ goa gen goa.design/examples/error/design package cli diff --git a/error/go.mod b/error/go.mod new file mode 100644 index 000000000..ef2a0e3e0 --- /dev/null +++ b/error/go.mod @@ -0,0 +1,27 @@ +module goa.design/examples/error + +go 1.21.1 + +require ( + goa.design/goa/v3 v3.13.2 + google.golang.org/grpc v1.58.2 + google.golang.org/protobuf v1.31.0 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/error/go.sum b/error/go.sum new file mode 100644 index 000000000..864cc39f0 --- /dev/null +++ b/error/go.sum @@ -0,0 +1,66 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/files/Makefile b/files/Makefile new file mode 100644 index 000000000..c5e9464ca --- /dev/null +++ b/files/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=openapi + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/files/gen/http/cli/openapi/cli.go b/files/gen/http/cli/openapi/cli.go index 04594cf56..91d2f3eb4 100644 --- a/files/gen/http/cli/openapi/cli.go +++ b/files/gen/http/cli/openapi/cli.go @@ -3,7 +3,7 @@ // openapi HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package cli diff --git a/files/gen/http/openapi/client/client.go b/files/gen/http/openapi/client/client.go index a816807f8..9baf34310 100644 --- a/files/gen/http/openapi/client/client.go +++ b/files/gen/http/openapi/client/client.go @@ -3,7 +3,7 @@ // openapi client HTTP transport // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package client diff --git a/files/gen/http/openapi/client/encode_decode.go b/files/gen/http/openapi/client/encode_decode.go index d761f7e5c..49a8a5146 100644 --- a/files/gen/http/openapi/client/encode_decode.go +++ b/files/gen/http/openapi/client/encode_decode.go @@ -3,6 +3,6 @@ // openapi HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package client diff --git a/files/gen/http/openapi/client/paths.go b/files/gen/http/openapi/client/paths.go index 3171be480..b3c1fc8c5 100644 --- a/files/gen/http/openapi/client/paths.go +++ b/files/gen/http/openapi/client/paths.go @@ -3,6 +3,6 @@ // HTTP request path constructors for the openapi service. // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package client diff --git a/files/gen/http/openapi/client/types.go b/files/gen/http/openapi/client/types.go index e8cf28f2a..b907cf666 100644 --- a/files/gen/http/openapi/client/types.go +++ b/files/gen/http/openapi/client/types.go @@ -3,6 +3,6 @@ // openapi HTTP client types // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package client diff --git a/files/gen/http/openapi/server/paths.go b/files/gen/http/openapi/server/paths.go index 83c43850d..71b978518 100644 --- a/files/gen/http/openapi/server/paths.go +++ b/files/gen/http/openapi/server/paths.go @@ -3,6 +3,6 @@ // HTTP request path constructors for the openapi service. // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package server diff --git a/files/gen/http/openapi/server/server.go b/files/gen/http/openapi/server/server.go index e934b487a..5040da955 100644 --- a/files/gen/http/openapi/server/server.go +++ b/files/gen/http/openapi/server/server.go @@ -3,7 +3,7 @@ // openapi HTTP server // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package server diff --git a/files/gen/http/openapi/server/types.go b/files/gen/http/openapi/server/types.go index fa2923963..2296a21e3 100644 --- a/files/gen/http/openapi/server/types.go +++ b/files/gen/http/openapi/server/types.go @@ -3,6 +3,6 @@ // openapi HTTP server types // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package server diff --git a/files/gen/openapi/client.go b/files/gen/openapi/client.go index a74a9369e..7207dbf23 100644 --- a/files/gen/openapi/client.go +++ b/files/gen/openapi/client.go @@ -3,7 +3,7 @@ // openapi client // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package openapi diff --git a/files/gen/openapi/endpoints.go b/files/gen/openapi/endpoints.go index ebfa407b1..a2137b943 100644 --- a/files/gen/openapi/endpoints.go +++ b/files/gen/openapi/endpoints.go @@ -3,7 +3,7 @@ // openapi endpoints // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package openapi diff --git a/files/gen/openapi/service.go b/files/gen/openapi/service.go index 47fa41f4a..991b35cef 100644 --- a/files/gen/openapi/service.go +++ b/files/gen/openapi/service.go @@ -3,7 +3,7 @@ // openapi service // // Command: -// $ goa gen goa.design/examples/files/design -o files +// $ goa gen goa.design/examples/files/design package openapi diff --git a/files/go.mod b/files/go.mod new file mode 100644 index 000000000..7547f1f1e --- /dev/null +++ b/files/go.mod @@ -0,0 +1,20 @@ +module goa.design/examples/files + +go 1.21.1 + +require goa.design/goa/v3 v3.13.2 + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/files/go.sum b/files/go.sum new file mode 100644 index 000000000..8a92cf665 --- /dev/null +++ b/files/go.sum @@ -0,0 +1,49 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/multipart/Makefile b/multipart/Makefile new file mode 100644 index 000000000..eadbc98be --- /dev/null +++ b/multipart/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=multipart + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/multipart/gen/http/cli/resume/cli.go b/multipart/gen/http/cli/resume/cli.go index c8d6e3e88..eb219f57a 100644 --- a/multipart/gen/http/cli/resume/cli.go +++ b/multipart/gen/http/cli/resume/cli.go @@ -3,7 +3,7 @@ // resume HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package cli diff --git a/multipart/gen/http/resume/client/cli.go b/multipart/gen/http/resume/client/cli.go index 335ccb6c6..279c1f04a 100644 --- a/multipart/gen/http/resume/client/cli.go +++ b/multipart/gen/http/resume/client/cli.go @@ -3,7 +3,7 @@ // resume HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package client diff --git a/multipart/gen/http/resume/client/client.go b/multipart/gen/http/resume/client/client.go index 55ea3a70d..128b9bbbc 100644 --- a/multipart/gen/http/resume/client/client.go +++ b/multipart/gen/http/resume/client/client.go @@ -3,7 +3,7 @@ // resume client HTTP transport // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package client diff --git a/multipart/gen/http/resume/client/encode_decode.go b/multipart/gen/http/resume/client/encode_decode.go index dca979fba..35f0e08ae 100644 --- a/multipart/gen/http/resume/client/encode_decode.go +++ b/multipart/gen/http/resume/client/encode_decode.go @@ -3,7 +3,7 @@ // resume HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package client diff --git a/multipart/gen/http/resume/client/paths.go b/multipart/gen/http/resume/client/paths.go index 185f3d899..d9c3ac3f9 100644 --- a/multipart/gen/http/resume/client/paths.go +++ b/multipart/gen/http/resume/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the resume service. // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package client diff --git a/multipart/gen/http/resume/client/types.go b/multipart/gen/http/resume/client/types.go index 5d449809a..773ca7d64 100644 --- a/multipart/gen/http/resume/client/types.go +++ b/multipart/gen/http/resume/client/types.go @@ -3,7 +3,7 @@ // resume HTTP client types // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package client diff --git a/multipart/gen/http/resume/server/encode_decode.go b/multipart/gen/http/resume/server/encode_decode.go index 4ad841ce3..c5a0e50f7 100644 --- a/multipart/gen/http/resume/server/encode_decode.go +++ b/multipart/gen/http/resume/server/encode_decode.go @@ -3,7 +3,7 @@ // resume HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package server diff --git a/multipart/gen/http/resume/server/paths.go b/multipart/gen/http/resume/server/paths.go index ef751ba1c..08b753eca 100644 --- a/multipart/gen/http/resume/server/paths.go +++ b/multipart/gen/http/resume/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the resume service. // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package server diff --git a/multipart/gen/http/resume/server/server.go b/multipart/gen/http/resume/server/server.go index 166534a1e..299bb6100 100644 --- a/multipart/gen/http/resume/server/server.go +++ b/multipart/gen/http/resume/server/server.go @@ -3,7 +3,7 @@ // resume HTTP server // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package server diff --git a/multipart/gen/http/resume/server/types.go b/multipart/gen/http/resume/server/types.go index f305403a0..196f7a3f5 100644 --- a/multipart/gen/http/resume/server/types.go +++ b/multipart/gen/http/resume/server/types.go @@ -3,7 +3,7 @@ // resume HTTP server types // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package server diff --git a/multipart/gen/resume/client.go b/multipart/gen/resume/client.go index cce6aac6e..1e60ba2e2 100644 --- a/multipart/gen/resume/client.go +++ b/multipart/gen/resume/client.go @@ -3,7 +3,7 @@ // resume client // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package resume diff --git a/multipart/gen/resume/endpoints.go b/multipart/gen/resume/endpoints.go index 2d4f96188..c7715457a 100644 --- a/multipart/gen/resume/endpoints.go +++ b/multipart/gen/resume/endpoints.go @@ -3,7 +3,7 @@ // resume endpoints // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package resume diff --git a/multipart/gen/resume/service.go b/multipart/gen/resume/service.go index 4026e64a2..567053fe6 100644 --- a/multipart/gen/resume/service.go +++ b/multipart/gen/resume/service.go @@ -3,7 +3,7 @@ // resume service // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package resume diff --git a/multipart/gen/resume/views/view.go b/multipart/gen/resume/views/view.go index 9f0629c5e..1ced6d432 100644 --- a/multipart/gen/resume/views/view.go +++ b/multipart/gen/resume/views/view.go @@ -3,7 +3,7 @@ // resume views // // Command: -// $ goa gen goa.design/examples/multipart/design -o multipart +// $ goa gen goa.design/examples/multipart/design package views diff --git a/multipart/go.mod b/multipart/go.mod new file mode 100644 index 000000000..0a2a46a62 --- /dev/null +++ b/multipart/go.mod @@ -0,0 +1,20 @@ +module goa.design/examples/multipart + +go 1.21.1 + +require goa.design/goa/v3 v3.13.2 + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/multipart/go.sum b/multipart/go.sum new file mode 100644 index 000000000..8a92cf665 --- /dev/null +++ b/multipart/go.sum @@ -0,0 +1,49 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/security/hierarchy/Makefile b/security/hierarchy/Makefile new file mode 100644 index 000000000..cd5c5746d --- /dev/null +++ b/security/hierarchy/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=hierarchy + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/security/hierarchy/gen/api_key_service/client.go b/security/hierarchy/gen/api_key_service/client.go index eff380847..7c0cbe03b 100644 --- a/security/hierarchy/gen/api_key_service/client.go +++ b/security/hierarchy/gen/api_key_service/client.go @@ -3,7 +3,7 @@ // api_key_service client // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package apikeyservice diff --git a/security/hierarchy/gen/api_key_service/endpoints.go b/security/hierarchy/gen/api_key_service/endpoints.go index 010423cb8..6b452c832 100644 --- a/security/hierarchy/gen/api_key_service/endpoints.go +++ b/security/hierarchy/gen/api_key_service/endpoints.go @@ -3,7 +3,7 @@ // api_key_service endpoints // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package apikeyservice diff --git a/security/hierarchy/gen/api_key_service/service.go b/security/hierarchy/gen/api_key_service/service.go index 21f106fcf..103297a50 100644 --- a/security/hierarchy/gen/api_key_service/service.go +++ b/security/hierarchy/gen/api_key_service/service.go @@ -3,7 +3,7 @@ // api_key_service service // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package apikeyservice diff --git a/security/hierarchy/gen/default_service/client.go b/security/hierarchy/gen/default_service/client.go index 3f96dbf85..6d8284f75 100644 --- a/security/hierarchy/gen/default_service/client.go +++ b/security/hierarchy/gen/default_service/client.go @@ -3,7 +3,7 @@ // default_service client // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package defaultservice diff --git a/security/hierarchy/gen/default_service/endpoints.go b/security/hierarchy/gen/default_service/endpoints.go index 082b0b2c0..d0aff2f30 100644 --- a/security/hierarchy/gen/default_service/endpoints.go +++ b/security/hierarchy/gen/default_service/endpoints.go @@ -3,7 +3,7 @@ // default_service endpoints // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package defaultservice diff --git a/security/hierarchy/gen/default_service/service.go b/security/hierarchy/gen/default_service/service.go index 6534b751c..8d9ebb4a2 100644 --- a/security/hierarchy/gen/default_service/service.go +++ b/security/hierarchy/gen/default_service/service.go @@ -3,7 +3,7 @@ // default_service service // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package defaultservice diff --git a/security/hierarchy/gen/http/api_key_service/client/cli.go b/security/hierarchy/gen/http/api_key_service/client/cli.go index 5836864c7..4473482d5 100644 --- a/security/hierarchy/gen/http/api_key_service/client/cli.go +++ b/security/hierarchy/gen/http/api_key_service/client/cli.go @@ -3,7 +3,7 @@ // api_key_service HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/api_key_service/client/client.go b/security/hierarchy/gen/http/api_key_service/client/client.go index 4b3b5d108..4a0875b0f 100644 --- a/security/hierarchy/gen/http/api_key_service/client/client.go +++ b/security/hierarchy/gen/http/api_key_service/client/client.go @@ -3,7 +3,7 @@ // api_key_service client HTTP transport // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/api_key_service/client/encode_decode.go b/security/hierarchy/gen/http/api_key_service/client/encode_decode.go index cffb706fd..389228365 100644 --- a/security/hierarchy/gen/http/api_key_service/client/encode_decode.go +++ b/security/hierarchy/gen/http/api_key_service/client/encode_decode.go @@ -3,7 +3,7 @@ // api_key_service HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/api_key_service/client/paths.go b/security/hierarchy/gen/http/api_key_service/client/paths.go index 961008645..fc0ae01c4 100644 --- a/security/hierarchy/gen/http/api_key_service/client/paths.go +++ b/security/hierarchy/gen/http/api_key_service/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the api_key_service service. // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/api_key_service/client/types.go b/security/hierarchy/gen/http/api_key_service/client/types.go index da6c39c72..343e3206f 100644 --- a/security/hierarchy/gen/http/api_key_service/client/types.go +++ b/security/hierarchy/gen/http/api_key_service/client/types.go @@ -3,6 +3,6 @@ // api_key_service HTTP client types // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/api_key_service/server/encode_decode.go b/security/hierarchy/gen/http/api_key_service/server/encode_decode.go index 48bb70986..3f2395b11 100644 --- a/security/hierarchy/gen/http/api_key_service/server/encode_decode.go +++ b/security/hierarchy/gen/http/api_key_service/server/encode_decode.go @@ -3,7 +3,7 @@ // api_key_service HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/api_key_service/server/paths.go b/security/hierarchy/gen/http/api_key_service/server/paths.go index 9f10af698..5a19dce09 100644 --- a/security/hierarchy/gen/http/api_key_service/server/paths.go +++ b/security/hierarchy/gen/http/api_key_service/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the api_key_service service. // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/api_key_service/server/server.go b/security/hierarchy/gen/http/api_key_service/server/server.go index ae0105aa2..28cf74a1e 100644 --- a/security/hierarchy/gen/http/api_key_service/server/server.go +++ b/security/hierarchy/gen/http/api_key_service/server/server.go @@ -3,7 +3,7 @@ // api_key_service HTTP server // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/api_key_service/server/types.go b/security/hierarchy/gen/http/api_key_service/server/types.go index d94bb3044..62f51b134 100644 --- a/security/hierarchy/gen/http/api_key_service/server/types.go +++ b/security/hierarchy/gen/http/api_key_service/server/types.go @@ -3,7 +3,7 @@ // api_key_service HTTP server types // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/cli/hierarchy/cli.go b/security/hierarchy/gen/http/cli/hierarchy/cli.go index dac90e854..4ed27ae57 100644 --- a/security/hierarchy/gen/http/cli/hierarchy/cli.go +++ b/security/hierarchy/gen/http/cli/hierarchy/cli.go @@ -3,7 +3,7 @@ // hierarchy HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package cli diff --git a/security/hierarchy/gen/http/default_service/client/cli.go b/security/hierarchy/gen/http/default_service/client/cli.go index 9b5dccc05..8c2515499 100644 --- a/security/hierarchy/gen/http/default_service/client/cli.go +++ b/security/hierarchy/gen/http/default_service/client/cli.go @@ -3,7 +3,7 @@ // default_service HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/default_service/client/client.go b/security/hierarchy/gen/http/default_service/client/client.go index 4464831a4..432838c03 100644 --- a/security/hierarchy/gen/http/default_service/client/client.go +++ b/security/hierarchy/gen/http/default_service/client/client.go @@ -3,7 +3,7 @@ // default_service client HTTP transport // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/default_service/client/encode_decode.go b/security/hierarchy/gen/http/default_service/client/encode_decode.go index f4a2acf52..91119f443 100644 --- a/security/hierarchy/gen/http/default_service/client/encode_decode.go +++ b/security/hierarchy/gen/http/default_service/client/encode_decode.go @@ -3,7 +3,7 @@ // default_service HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/default_service/client/paths.go b/security/hierarchy/gen/http/default_service/client/paths.go index f1bd656f7..20208e69f 100644 --- a/security/hierarchy/gen/http/default_service/client/paths.go +++ b/security/hierarchy/gen/http/default_service/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the default_service service. // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/default_service/client/types.go b/security/hierarchy/gen/http/default_service/client/types.go index 4a1a8a0d6..f2a9ab7a6 100644 --- a/security/hierarchy/gen/http/default_service/client/types.go +++ b/security/hierarchy/gen/http/default_service/client/types.go @@ -3,6 +3,6 @@ // default_service HTTP client types // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package client diff --git a/security/hierarchy/gen/http/default_service/server/encode_decode.go b/security/hierarchy/gen/http/default_service/server/encode_decode.go index 4423aa4f8..d1bb233e7 100644 --- a/security/hierarchy/gen/http/default_service/server/encode_decode.go +++ b/security/hierarchy/gen/http/default_service/server/encode_decode.go @@ -3,7 +3,7 @@ // default_service HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/default_service/server/paths.go b/security/hierarchy/gen/http/default_service/server/paths.go index b30f9254f..5483d0fbe 100644 --- a/security/hierarchy/gen/http/default_service/server/paths.go +++ b/security/hierarchy/gen/http/default_service/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the default_service service. // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/default_service/server/server.go b/security/hierarchy/gen/http/default_service/server/server.go index cbeebe6e2..796539397 100644 --- a/security/hierarchy/gen/http/default_service/server/server.go +++ b/security/hierarchy/gen/http/default_service/server/server.go @@ -3,7 +3,7 @@ // default_service HTTP server // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/gen/http/default_service/server/types.go b/security/hierarchy/gen/http/default_service/server/types.go index f589aadd5..eb3293821 100644 --- a/security/hierarchy/gen/http/default_service/server/types.go +++ b/security/hierarchy/gen/http/default_service/server/types.go @@ -3,7 +3,7 @@ // default_service HTTP server types // // Command: -// $ goa gen goa.design/examples/security/hierarchy/design -o security/hierarchy +// $ goa gen goa.design/examples/security/hierarchy/design package server diff --git a/security/hierarchy/go.mod b/security/hierarchy/go.mod new file mode 100644 index 000000000..70539d940 --- /dev/null +++ b/security/hierarchy/go.mod @@ -0,0 +1,20 @@ +module goa.design/examples/security/hierarchy + +go 1.21.1 + +require goa.design/goa/v3 v3.13.2 + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/security/hierarchy/go.sum b/security/hierarchy/go.sum new file mode 100644 index 000000000..8a92cf665 --- /dev/null +++ b/security/hierarchy/go.sum @@ -0,0 +1,49 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/security/multiauth/Makefile b/security/multiauth/Makefile new file mode 100644 index 000000000..76831789a --- /dev/null +++ b/security/multiauth/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=multi_auth + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/security/multiauth/gen/grpc/cli/multi_auth/cli.go b/security/multiauth/gen/grpc/cli/multi_auth/cli.go index 952940f5d..cc43caa56 100644 --- a/security/multiauth/gen/grpc/cli/multi_auth/cli.go +++ b/security/multiauth/gen/grpc/cli/multi_auth/cli.go @@ -3,7 +3,7 @@ // multi_auth gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package cli diff --git a/security/multiauth/gen/grpc/secured_service/client/cli.go b/security/multiauth/gen/grpc/secured_service/client/cli.go index c6ec97cdb..608258243 100644 --- a/security/multiauth/gen/grpc/secured_service/client/cli.go +++ b/security/multiauth/gen/grpc/secured_service/client/cli.go @@ -3,7 +3,7 @@ // secured_service gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/grpc/secured_service/client/client.go b/security/multiauth/gen/grpc/secured_service/client/client.go index 1b625e66b..470eefe47 100644 --- a/security/multiauth/gen/grpc/secured_service/client/client.go +++ b/security/multiauth/gen/grpc/secured_service/client/client.go @@ -3,7 +3,7 @@ // secured_service gRPC client // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/grpc/secured_service/client/encode_decode.go b/security/multiauth/gen/grpc/secured_service/client/encode_decode.go index 716146b6e..87421a3f9 100644 --- a/security/multiauth/gen/grpc/secured_service/client/encode_decode.go +++ b/security/multiauth/gen/grpc/secured_service/client/encode_decode.go @@ -3,7 +3,7 @@ // secured_service gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/grpc/secured_service/client/types.go b/security/multiauth/gen/grpc/secured_service/client/types.go index 2dde1fb1d..2c7c01e04 100644 --- a/security/multiauth/gen/grpc/secured_service/client/types.go +++ b/security/multiauth/gen/grpc/secured_service/client/types.go @@ -3,7 +3,7 @@ // secured_service gRPC client types // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.pb.go b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.pb.go index ce609a3ec..a69cbc67b 100644 --- a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.pb.go +++ b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.pb.go @@ -3,12 +3,12 @@ // secured_service protocol buffer definition // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_multiauth_secured_service.proto package secured_servicepb diff --git a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.proto b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.proto index debc70d9f..63dbbc681 100644 --- a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.proto +++ b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service.proto @@ -3,7 +3,7 @@ // secured_service protocol buffer definition // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design syntax = "proto3"; diff --git a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service_grpc.pb.go b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service_grpc.pb.go index 3f9646b91..49fe829ee 100644 --- a/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service_grpc.pb.go +++ b/security/multiauth/gen/grpc/secured_service/pb/goagen_multiauth_secured_service_grpc.pb.go @@ -3,12 +3,12 @@ // secured_service protocol buffer definition // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_multiauth_secured_service.proto package secured_servicepb diff --git a/security/multiauth/gen/grpc/secured_service/server/encode_decode.go b/security/multiauth/gen/grpc/secured_service/server/encode_decode.go index b911efd1a..82e4844b4 100644 --- a/security/multiauth/gen/grpc/secured_service/server/encode_decode.go +++ b/security/multiauth/gen/grpc/secured_service/server/encode_decode.go @@ -3,7 +3,7 @@ // secured_service gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/grpc/secured_service/server/server.go b/security/multiauth/gen/grpc/secured_service/server/server.go index de5292175..0f8f8ba8a 100644 --- a/security/multiauth/gen/grpc/secured_service/server/server.go +++ b/security/multiauth/gen/grpc/secured_service/server/server.go @@ -3,7 +3,7 @@ // secured_service gRPC server // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/grpc/secured_service/server/types.go b/security/multiauth/gen/grpc/secured_service/server/types.go index 5eecb69f9..d37833ecb 100644 --- a/security/multiauth/gen/grpc/secured_service/server/types.go +++ b/security/multiauth/gen/grpc/secured_service/server/types.go @@ -3,7 +3,7 @@ // secured_service gRPC server types // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/http/cli/multi_auth/cli.go b/security/multiauth/gen/http/cli/multi_auth/cli.go index 1ac2aeeb7..70ce9b1ba 100644 --- a/security/multiauth/gen/http/cli/multi_auth/cli.go +++ b/security/multiauth/gen/http/cli/multi_auth/cli.go @@ -3,7 +3,7 @@ // multi_auth HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package cli diff --git a/security/multiauth/gen/http/secured_service/client/cli.go b/security/multiauth/gen/http/secured_service/client/cli.go index cb028b26f..525393e97 100644 --- a/security/multiauth/gen/http/secured_service/client/cli.go +++ b/security/multiauth/gen/http/secured_service/client/cli.go @@ -3,7 +3,7 @@ // secured_service HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/http/secured_service/client/client.go b/security/multiauth/gen/http/secured_service/client/client.go index dd11cf016..72304f020 100644 --- a/security/multiauth/gen/http/secured_service/client/client.go +++ b/security/multiauth/gen/http/secured_service/client/client.go @@ -3,7 +3,7 @@ // secured_service client HTTP transport // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/http/secured_service/client/encode_decode.go b/security/multiauth/gen/http/secured_service/client/encode_decode.go index ddda34ebd..0e9d68dc2 100644 --- a/security/multiauth/gen/http/secured_service/client/encode_decode.go +++ b/security/multiauth/gen/http/secured_service/client/encode_decode.go @@ -3,7 +3,7 @@ // secured_service HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/http/secured_service/client/paths.go b/security/multiauth/gen/http/secured_service/client/paths.go index ab4f69720..d6fbebcdb 100644 --- a/security/multiauth/gen/http/secured_service/client/paths.go +++ b/security/multiauth/gen/http/secured_service/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the secured_service service. // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/http/secured_service/client/types.go b/security/multiauth/gen/http/secured_service/client/types.go index 6965535b0..26ce9a1fe 100644 --- a/security/multiauth/gen/http/secured_service/client/types.go +++ b/security/multiauth/gen/http/secured_service/client/types.go @@ -3,7 +3,7 @@ // secured_service HTTP client types // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package client diff --git a/security/multiauth/gen/http/secured_service/server/encode_decode.go b/security/multiauth/gen/http/secured_service/server/encode_decode.go index dd890528f..10b6ca61b 100644 --- a/security/multiauth/gen/http/secured_service/server/encode_decode.go +++ b/security/multiauth/gen/http/secured_service/server/encode_decode.go @@ -3,7 +3,7 @@ // secured_service HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/http/secured_service/server/paths.go b/security/multiauth/gen/http/secured_service/server/paths.go index f2b08bba1..b6559f04a 100644 --- a/security/multiauth/gen/http/secured_service/server/paths.go +++ b/security/multiauth/gen/http/secured_service/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the secured_service service. // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/http/secured_service/server/server.go b/security/multiauth/gen/http/secured_service/server/server.go index 81a04dd61..7fc3e5002 100644 --- a/security/multiauth/gen/http/secured_service/server/server.go +++ b/security/multiauth/gen/http/secured_service/server/server.go @@ -3,7 +3,7 @@ // secured_service HTTP server // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/http/secured_service/server/types.go b/security/multiauth/gen/http/secured_service/server/types.go index 30308fe09..8d7134d81 100644 --- a/security/multiauth/gen/http/secured_service/server/types.go +++ b/security/multiauth/gen/http/secured_service/server/types.go @@ -3,7 +3,7 @@ // secured_service HTTP server types // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package server diff --git a/security/multiauth/gen/secured_service/client.go b/security/multiauth/gen/secured_service/client.go index 30950627a..cd9e22575 100644 --- a/security/multiauth/gen/secured_service/client.go +++ b/security/multiauth/gen/secured_service/client.go @@ -3,7 +3,7 @@ // secured_service client // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package securedservice diff --git a/security/multiauth/gen/secured_service/endpoints.go b/security/multiauth/gen/secured_service/endpoints.go index c4f918e5c..77dc28095 100644 --- a/security/multiauth/gen/secured_service/endpoints.go +++ b/security/multiauth/gen/secured_service/endpoints.go @@ -3,7 +3,7 @@ // secured_service endpoints // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package securedservice diff --git a/security/multiauth/gen/secured_service/service.go b/security/multiauth/gen/secured_service/service.go index be9e213e2..a54ade3fc 100644 --- a/security/multiauth/gen/secured_service/service.go +++ b/security/multiauth/gen/secured_service/service.go @@ -3,7 +3,7 @@ // secured_service service // // Command: -// $ goa gen goa.design/examples/security/multiauth/design -o security/multiauth +// $ goa gen goa.design/examples/security/multiauth/design package securedservice diff --git a/security/multiauth/go.mod b/security/multiauth/go.mod new file mode 100644 index 000000000..c69f9aaf3 --- /dev/null +++ b/security/multiauth/go.mod @@ -0,0 +1,28 @@ +module goa.design/examples/security/multiauth + +go 1.21.1 + +require ( + github.com/golang-jwt/jwt/v4 v4.5.0 + goa.design/goa/v3 v3.13.2 + google.golang.org/grpc v1.58.2 + google.golang.org/protobuf v1.31.0 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/security/multiauth/go.sum b/security/multiauth/go.sum new file mode 100644 index 000000000..cafae3186 --- /dev/null +++ b/security/multiauth/go.sum @@ -0,0 +1,68 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/streaming/Makefile b/streaming/Makefile new file mode 100644 index 000000000..72053d72b --- /dev/null +++ b/streaming/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=chatter + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/streaming/cmd/chatter-cli/grpc.go b/streaming/cmd/chatter-cli/grpc.go index 7fb6ab566..e845b4206 100644 --- a/streaming/cmd/chatter-cli/grpc.go +++ b/streaming/cmd/chatter-cli/grpc.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc/credentials/insecure" ) -func doGRPC(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) { +func doGRPC(scheme, host string, timeout int, debug bool) (goa.Endpoint, any, error) { conn, err := grpc.Dial(host, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { fmt.Fprintf(os.Stderr, "could not connect to gRPC server at %s: %v\n", host, err) diff --git a/streaming/cmd/chatter-cli/http.go b/streaming/cmd/chatter-cli/http.go index a160fc78a..390e68cff 100644 --- a/streaming/cmd/chatter-cli/http.go +++ b/streaming/cmd/chatter-cli/http.go @@ -10,7 +10,7 @@ import ( goa "goa.design/goa/v3/pkg" ) -func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) { +func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, any, error) { var ( doer goahttp.Doer ) diff --git a/streaming/cmd/chatter-cli/main.go b/streaming/cmd/chatter-cli/main.go index 360b815fe..cebc72d4c 100644 --- a/streaming/cmd/chatter-cli/main.go +++ b/streaming/cmd/chatter-cli/main.go @@ -58,7 +58,7 @@ func main() { } var ( endpoint goa.Endpoint - payload interface{} + payload any err error ) { diff --git a/streaming/gen/chatter/client.go b/streaming/gen/chatter/client.go index 39e4c28d1..b5ceab211 100644 --- a/streaming/gen/chatter/client.go +++ b/streaming/gen/chatter/client.go @@ -3,7 +3,7 @@ // chatter client // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package chatter diff --git a/streaming/gen/chatter/endpoints.go b/streaming/gen/chatter/endpoints.go index ab907494f..e78efb640 100644 --- a/streaming/gen/chatter/endpoints.go +++ b/streaming/gen/chatter/endpoints.go @@ -3,7 +3,7 @@ // chatter endpoints // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package chatter diff --git a/streaming/gen/chatter/service.go b/streaming/gen/chatter/service.go index 378eee073..86155bab8 100644 --- a/streaming/gen/chatter/service.go +++ b/streaming/gen/chatter/service.go @@ -3,7 +3,7 @@ // chatter service // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package chatter diff --git a/streaming/gen/chatter/views/view.go b/streaming/gen/chatter/views/view.go index 5b3bbff04..23dc81604 100644 --- a/streaming/gen/chatter/views/view.go +++ b/streaming/gen/chatter/views/view.go @@ -3,7 +3,7 @@ // chatter views // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package views diff --git a/streaming/gen/grpc/chatter/client/cli.go b/streaming/gen/grpc/chatter/client/cli.go index e9206fb93..cf9fdce9f 100644 --- a/streaming/gen/grpc/chatter/client/cli.go +++ b/streaming/gen/grpc/chatter/client/cli.go @@ -3,7 +3,7 @@ // chatter gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/grpc/chatter/client/client.go b/streaming/gen/grpc/chatter/client/client.go index 2aef5d711..1d9b8c5d9 100644 --- a/streaming/gen/grpc/chatter/client/client.go +++ b/streaming/gen/grpc/chatter/client/client.go @@ -3,7 +3,7 @@ // chatter gRPC client // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/grpc/chatter/client/encode_decode.go b/streaming/gen/grpc/chatter/client/encode_decode.go index 10cdee6d5..594b87161 100644 --- a/streaming/gen/grpc/chatter/client/encode_decode.go +++ b/streaming/gen/grpc/chatter/client/encode_decode.go @@ -3,7 +3,7 @@ // chatter gRPC client encoders and decoders // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/grpc/chatter/client/types.go b/streaming/gen/grpc/chatter/client/types.go index ccd71d9ef..76014e684 100644 --- a/streaming/gen/grpc/chatter/client/types.go +++ b/streaming/gen/grpc/chatter/client/types.go @@ -3,7 +3,7 @@ // chatter gRPC client types // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.pb.go b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.pb.go index 7a53d471b..846de7698 100644 --- a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.pb.go +++ b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.pb.go @@ -3,12 +3,12 @@ // chatter protocol buffer definition // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.3 // source: goagen_streaming_chatter.proto package chatterpb diff --git a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.proto b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.proto index 58c8110c2..3bd7c8129 100644 --- a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.proto +++ b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter.proto @@ -3,7 +3,7 @@ // chatter protocol buffer definition // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design syntax = "proto3"; diff --git a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter_grpc.pb.go b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter_grpc.pb.go index 9f37324c3..8f61466a2 100644 --- a/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter_grpc.pb.go +++ b/streaming/gen/grpc/chatter/pb/goagen_streaming_chatter_grpc.pb.go @@ -3,12 +3,12 @@ // chatter protocol buffer definition // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.3 // source: goagen_streaming_chatter.proto package chatterpb diff --git a/streaming/gen/grpc/chatter/server/encode_decode.go b/streaming/gen/grpc/chatter/server/encode_decode.go index 2b0bc8564..540cb85ec 100644 --- a/streaming/gen/grpc/chatter/server/encode_decode.go +++ b/streaming/gen/grpc/chatter/server/encode_decode.go @@ -3,7 +3,7 @@ // chatter gRPC server encoders and decoders // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/grpc/chatter/server/server.go b/streaming/gen/grpc/chatter/server/server.go index e5dea6576..0c7a4b05a 100644 --- a/streaming/gen/grpc/chatter/server/server.go +++ b/streaming/gen/grpc/chatter/server/server.go @@ -3,7 +3,7 @@ // chatter gRPC server // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/grpc/chatter/server/types.go b/streaming/gen/grpc/chatter/server/types.go index bb5b2bc8f..dea98d1c6 100644 --- a/streaming/gen/grpc/chatter/server/types.go +++ b/streaming/gen/grpc/chatter/server/types.go @@ -3,7 +3,7 @@ // chatter gRPC server types // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/grpc/cli/chatter/cli.go b/streaming/gen/grpc/cli/chatter/cli.go index e6f27a057..f69a5f7ef 100644 --- a/streaming/gen/grpc/cli/chatter/cli.go +++ b/streaming/gen/grpc/cli/chatter/cli.go @@ -3,7 +3,7 @@ // chatter gRPC client CLI support package // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package cli diff --git a/streaming/gen/http/chatter/client/cli.go b/streaming/gen/http/chatter/client/cli.go index 7c1a1f1e5..b92fbf334 100644 --- a/streaming/gen/http/chatter/client/cli.go +++ b/streaming/gen/http/chatter/client/cli.go @@ -3,7 +3,7 @@ // chatter HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/client/client.go b/streaming/gen/http/chatter/client/client.go index 9efdc5eb5..54813d544 100644 --- a/streaming/gen/http/chatter/client/client.go +++ b/streaming/gen/http/chatter/client/client.go @@ -3,7 +3,7 @@ // chatter client HTTP transport // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/client/encode_decode.go b/streaming/gen/http/chatter/client/encode_decode.go index 8d4661699..e5ab4d9a0 100644 --- a/streaming/gen/http/chatter/client/encode_decode.go +++ b/streaming/gen/http/chatter/client/encode_decode.go @@ -3,7 +3,7 @@ // chatter HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/client/paths.go b/streaming/gen/http/chatter/client/paths.go index e95849c7e..56c444c1e 100644 --- a/streaming/gen/http/chatter/client/paths.go +++ b/streaming/gen/http/chatter/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the chatter service. // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/client/types.go b/streaming/gen/http/chatter/client/types.go index f0de56cbb..ccff7e6ea 100644 --- a/streaming/gen/http/chatter/client/types.go +++ b/streaming/gen/http/chatter/client/types.go @@ -3,7 +3,7 @@ // chatter HTTP client types // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/client/websocket.go b/streaming/gen/http/chatter/client/websocket.go index 1cc54906c..2c0d19638 100644 --- a/streaming/gen/http/chatter/client/websocket.go +++ b/streaming/gen/http/chatter/client/websocket.go @@ -3,7 +3,7 @@ // chatter WebSocket client streaming // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package client diff --git a/streaming/gen/http/chatter/server/encode_decode.go b/streaming/gen/http/chatter/server/encode_decode.go index f43408544..b3dfddfb4 100644 --- a/streaming/gen/http/chatter/server/encode_decode.go +++ b/streaming/gen/http/chatter/server/encode_decode.go @@ -3,7 +3,7 @@ // chatter HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/http/chatter/server/paths.go b/streaming/gen/http/chatter/server/paths.go index 3ea1bc861..351cc738b 100644 --- a/streaming/gen/http/chatter/server/paths.go +++ b/streaming/gen/http/chatter/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the chatter service. // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/http/chatter/server/server.go b/streaming/gen/http/chatter/server/server.go index eb55c0ad5..ade44e4a1 100644 --- a/streaming/gen/http/chatter/server/server.go +++ b/streaming/gen/http/chatter/server/server.go @@ -3,7 +3,7 @@ // chatter HTTP server // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/http/chatter/server/types.go b/streaming/gen/http/chatter/server/types.go index 823bffcf4..ed0937c6d 100644 --- a/streaming/gen/http/chatter/server/types.go +++ b/streaming/gen/http/chatter/server/types.go @@ -3,7 +3,7 @@ // chatter HTTP server types // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/http/chatter/server/websocket.go b/streaming/gen/http/chatter/server/websocket.go index 330750a69..26d80ad47 100644 --- a/streaming/gen/http/chatter/server/websocket.go +++ b/streaming/gen/http/chatter/server/websocket.go @@ -3,7 +3,7 @@ // chatter WebSocket server streaming // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package server diff --git a/streaming/gen/http/cli/chatter/cli.go b/streaming/gen/http/cli/chatter/cli.go index dec5561e1..5d72a0de5 100644 --- a/streaming/gen/http/cli/chatter/cli.go +++ b/streaming/gen/http/cli/chatter/cli.go @@ -3,7 +3,7 @@ // chatter HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/streaming/design -o streaming +// $ goa gen github.com/ikawaha/examples/streaming/design package cli diff --git a/go.mod b/streaming/go.mod similarity index 77% rename from go.mod rename to streaming/go.mod index da4a24801..19e3d81d1 100644 --- a/go.mod +++ b/streaming/go.mod @@ -1,14 +1,10 @@ -module goa.design/examples +module goa.design/examples/streaming -go 1.20 +go 1.21.1 require ( - github.com/boltdb/bolt v1.3.1 - github.com/fxamacker/cbor/v2 v2.5.0 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/gorilla/websocket v1.5.0 - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/rs/xid v1.5.0 goa.design/goa/v3 v3.13.2 google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 @@ -21,9 +17,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/google/uuid v1.3.1 // indirect github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/sergi/go-diff v1.3.1 // indirect - github.com/x448/float16 v0.8.4 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect diff --git a/streaming/go.sum b/streaming/go.sum new file mode 100644 index 000000000..69f5997e0 --- /dev/null +++ b/streaming/go.sum @@ -0,0 +1,68 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tracing/README.md b/tracing/README.md deleted file mode 100644 index 536d1e32b..000000000 --- a/tracing/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Tracing Example - -This example illustrates how to use the tracing and AWS X-Ray middleware in -Goa v3. - -## Server Tracing Setup - -The tracing middleware can be mounted on the `net/http` `Handler` for HTTP -transport or when initializing a gRPC server for gRPC transport. The ordering -of mounting the tracing and X-Ray middleware is important as shown below. - -``` - // HTTP - - var handler http.Handler = mux - { - xrayHndlr, err := xray.New("calc", daemon) - if err != nil { - logger.Printf("[WARN] cannot connect to xray daemon %s: %s", daemon, err) - } - // Wrap the Xray and the tracing handler. The order is very important. - handler = xrayHndlr(handler) - handler = httpmdlwr.Trace()(handler) - } - - // gRPC - - xm, err := xray.NewUnaryServer("calc", daemon) - if err != nil { - logger.Printf("[WARN] cannot connect to xray daemon %s: %s", daemon, err) - } - // Initialize gRPC server with the middleware. - srv := grpc.NewServer( - grpc.ChainUnaryInterceptor( - // Mount the trace and X-Ray middleware. Order is very important. - grpcmdlwr.UnaryServerTrace(), - xm, - ), - ) -``` - -## Client Tracing Setup - -The tracing middleware can be wrapped around a HTTP client for HTTP transport or -when initializing a gRPC client connection for gRPC transport. - -``` - // HTTP - - var ( - doer goahttp.Doer - ) - { - doer = &http.Client{Timeout: time.Duration(timeout) * time.Second} - // Wrap doer with X-Ray and trace client middleware. Order is very important. - doer = xray.WrapDoer(doer) - doer = middleware.WrapDoer(doer) - } - - // gRPC - - conn, err := grpc.Dial( - host, - grpc.WithInsecure(), - grpc.WithUnaryInterceptor(grpcmiddleware.ChainUnaryClient( - // Mount the X-Ray and trace client middleware. Order is very important. - xray.UnaryClient(host), - middleware.UnaryClientTrace(), - )), - ) -``` diff --git a/tracing/cmd/calc-cli/grpc.go b/tracing/cmd/calc-cli/grpc.go deleted file mode 100644 index b0cb34e31..000000000 --- a/tracing/cmd/calc-cli/grpc.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - "fmt" - "os" - - grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" - cli "goa.design/examples/basic/gen/grpc/cli/calc" - "goa.design/goa/v3/grpc/middleware" - "goa.design/goa/v3/grpc/middleware/xray" - goa "goa.design/goa/v3/pkg" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -func doGRPC(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) { - conn, err := grpc.Dial( - host, - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(grpcmiddleware.ChainUnaryClient( - // Mount the X-Ray and trace client middleware. Order is very important. - xray.UnaryClient(host), - middleware.UnaryClientTrace(), - )), - ) - if err != nil { - fmt.Fprintf(os.Stderr, "could not connect to gRPC server at %s: %v\n", host, err) - } - return cli.ParseEndpoint(conn) -} diff --git a/tracing/cmd/calc-cli/http.go b/tracing/cmd/calc-cli/http.go deleted file mode 100644 index 474bff494..000000000 --- a/tracing/cmd/calc-cli/http.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "net/http" - "time" - - cli "goa.design/examples/basic/gen/http/cli/calc" - goahttp "goa.design/goa/v3/http" - "goa.design/goa/v3/http/middleware" - "goa.design/goa/v3/http/middleware/xray" - goa "goa.design/goa/v3/pkg" -) - -func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) { - var ( - doer goahttp.Doer - ) - { - doer = &http.Client{Timeout: time.Duration(timeout) * time.Second} - if debug { - doer = goahttp.NewDebugDoer(doer) - } - // Wrap doer with X-Ray and trace client middleware. Order is very important. - doer = xray.WrapDoer(doer) - doer = middleware.WrapDoer(doer) - } - - return cli.ParseEndpoint( - scheme, - host, - doer, - goahttp.RequestEncoder, - goahttp.ResponseDecoder, - debug, - ) -} -func httpUsageCommands() string { - return cli.UsageCommands() -} - -func httpUsageExamples() string { - return cli.UsageExamples() -} diff --git a/tracing/cmd/calc-cli/main.go b/tracing/cmd/calc-cli/main.go deleted file mode 100644 index 439d1d848..000000000 --- a/tracing/cmd/calc-cli/main.go +++ /dev/null @@ -1,127 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "flag" - "fmt" - "net/url" - "os" - "strings" - - goa "goa.design/goa/v3/pkg" -) - -func main() { - var ( - hostF = flag.String("host", "development", "Server host (valid values: development, production)") - addrF = flag.String("url", "", "URL to service host") - - versionF = flag.String("version", "v1", "API version") - verboseF = flag.Bool("verbose", false, "Print request and response details") - vF = flag.Bool("v", false, "Print request and response details") - timeoutF = flag.Int("timeout", 30, "Maximum number of seconds to wait for response") - ) - flag.Usage = usage - flag.Parse() - var ( - addr string - timeout int - debug bool - ) - { - addr = *addrF - if addr == "" { - switch *hostF { - case "development": - addr = "http://localhost:8000/calc" - case "production": - addr = "https://{version}.goa.design/calc" - addr = strings.Replace(addr, "{version}", *versionF, -1) - default: - fmt.Fprintf(os.Stderr, "invalid host argument: %q (valid hosts: development|production)", *hostF) - os.Exit(1) - } - } - timeout = *timeoutF - debug = *verboseF || *vF - } - - var ( - scheme string - host string - ) - { - u, err := url.Parse(addr) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) - } - scheme = u.Scheme - host = u.Host - } - var ( - endpoint goa.Endpoint - payload interface{} - err error - ) - { - switch scheme { - case "http", "https": - endpoint, payload, err = doHTTP(scheme, host, timeout, debug) - case "grpc", "grpcs": - endpoint, payload, err = doGRPC(scheme, host, timeout, debug) - default: - fmt.Fprintf(os.Stderr, "invalid scheme: %q (valid schemes: grpc|grpcs|http|https)", scheme) - os.Exit(1) - } - } - if err != nil { - if err == flag.ErrHelp { - os.Exit(0) - } - fmt.Fprintln(os.Stderr, err.Error()) - fmt.Fprintln(os.Stderr, "run '"+os.Args[0]+" --help' for detailed usage.") - os.Exit(1) - } - - data, err := endpoint(context.Background(), payload) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - if data != nil { - m, _ := json.MarshalIndent(data, "", " ") - fmt.Println(string(m)) - } -} - -func usage() { - fmt.Fprintf(os.Stderr, `%s is a command line client for the calc API. - -Usage: - %s [-host HOST][-url URL][-timeout SECONDS][-verbose|-v][-version VERSION] SERVICE ENDPOINT [flags] - - -host HOST: server host (development). valid values: development, production - -url URL: specify service URL overriding host URL (http://localhost:8080) - -timeout: maximum number of seconds to wait for response (30) - -verbose|-v: print request and response details (false) - -version: API version (v1) - -Commands: -%s -Additional help: - %s SERVICE [ENDPOINT] --help - -Example: -%s -`, os.Args[0], os.Args[0], indent(httpUsageCommands()), os.Args[0], indent(httpUsageExamples())) -} - -func indent(s string) string { - if s == "" { - return "" - } - return " " + strings.Replace(s, "\n", "\n ", -1) -} diff --git a/tracing/cmd/calc/grpc.go b/tracing/cmd/calc/grpc.go deleted file mode 100644 index 0cf9c680c..000000000 --- a/tracing/cmd/calc/grpc.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "context" - "log" - "net" - "net/url" - "sync" - - calcsvc "goa.design/examples/basic/gen/calc" - calcpb "goa.design/examples/basic/gen/grpc/calc/pb" - calcsvcsvr "goa.design/examples/basic/gen/grpc/calc/server" - grpcmdlwr "goa.design/goa/v3/grpc/middleware" - "goa.design/goa/v3/grpc/middleware/xray" - "goa.design/goa/v3/middleware" - "google.golang.org/grpc" -) - -// handleGRPCServer starts configures and starts a gRPC server on the given -// URL. It shuts down the server if any error is received in the error channel. -func handleGRPCServer(ctx context.Context, u *url.URL, calcEndpoints *calcsvc.Endpoints, wg *sync.WaitGroup, errc chan error, logger *log.Logger, debug bool, daemon string) { - - // Setup goa log adapter. - var ( - adapter middleware.Logger - ) - { - adapter = middleware.NewLogger(logger) - } - - // Wrap the endpoints with the transport specific layers. The generated - // server packages contains code generated from the design which maps - // the service input and output data structures to gRPC requests and - // responses. - var ( - calcServer *calcsvcsvr.Server - ) - { - calcServer = calcsvcsvr.New(calcEndpoints, nil) - } - - xm, err := xray.NewUnaryServer("calc", daemon) - if err != nil { - logger.Printf("[WARN] cannot connect to xray daemon %s: %s", daemon, err) - } - // Initialize gRPC server with the middleware. - srv := grpc.NewServer( - grpc.ChainUnaryInterceptor( - grpcmdlwr.UnaryRequestID(), - grpcmdlwr.UnaryServerLog(adapter), - // Mount the trace and X-Ray middleware. Order is very important. - grpcmdlwr.UnaryServerTrace(), - xm, - ), - ) - - // Register the servers. - calcpb.RegisterCalcServer(srv, calcServer) - - for svc, info := range srv.GetServiceInfo() { - for _, m := range info.Methods { - logger.Printf("serving gRPC method %s", svc+"/"+m.Name) - } - } - - (*wg).Add(1) - go func() { - defer (*wg).Done() - - // Start gRPC server in a separate goroutine. - go func() { - lis, err := net.Listen("tcp", u.Host) - if err != nil { - errc <- err - } - logger.Printf("gRPC server listening on %q", u.Host) - errc <- srv.Serve(lis) - }() - - <-ctx.Done() - logger.Printf("shutting down gRPC server at %q", u.Host) - srv.Stop() - }() -} diff --git a/tracing/cmd/calc/http.go b/tracing/cmd/calc/http.go deleted file mode 100644 index 664de8273..000000000 --- a/tracing/cmd/calc/http.go +++ /dev/null @@ -1,117 +0,0 @@ -package main - -import ( - "context" - "log" - "net/http" - "net/url" - "os" - "sync" - "time" - - calcsvc "goa.design/examples/basic/gen/calc" - calcsvcsvr "goa.design/examples/basic/gen/http/calc/server" - goahttp "goa.design/goa/v3/http" - httpmdlwr "goa.design/goa/v3/http/middleware" - "goa.design/goa/v3/http/middleware/xray" - "goa.design/goa/v3/middleware" -) - -// handleHTTPServer starts configures and starts a HTTP server on the given -// URL. It shuts down the server if any error is received in the error channel. -func handleHTTPServer(ctx context.Context, u *url.URL, calcEndpoints *calcsvc.Endpoints, wg *sync.WaitGroup, errc chan error, logger *log.Logger, debug bool, daemon string) { - - // Setup goa log adapter. - var ( - adapter middleware.Logger - ) - { - adapter = middleware.NewLogger(logger) - } - - // Provide the transport specific request decoder and response encoder. - // The goa http package has built-in support for JSON, XML and gob. - // Other encodings can be used by providing the corresponding functions, - // see goa.design/encoding. - var ( - dec = goahttp.RequestDecoder - enc = goahttp.ResponseEncoder - ) - - // Build the service HTTP request multiplexer and configure it to serve - // HTTP requests to the service endpoints. - var mux goahttp.Muxer - { - mux = goahttp.NewMuxer() - } - - // Wrap the endpoints with the transport specific layers. The generated - // server packages contains code generated from the design which maps - // the service input and output data structures to HTTP requests and - // responses. - var ( - calcServer *calcsvcsvr.Server - ) - { - eh := errorHandler(logger) - calcServer = calcsvcsvr.New(calcEndpoints, mux, dec, enc, eh, nil, nil) - } - // Configure the mux. - calcsvcsvr.Mount(mux, calcServer) - - // Wrap the multiplexer with additional middlewares. Middlewares mounted - // here apply to all the service endpoints. - var handler http.Handler = mux - { - if debug { - handler = httpmdlwr.Debug(mux, os.Stdout)(handler) - } - handler = httpmdlwr.Log(adapter)(handler) - handler = httpmdlwr.RequestID()(handler) - xrayHndlr, err := xray.New("calc", daemon) - if err != nil { - logger.Printf("[WARN] cannot connect to xray daemon %s: %s", daemon, err) - } - // Wrap the Xray and the tracing handler. The order is very important. - handler = xrayHndlr(handler) - handler = httpmdlwr.Trace()(handler) - } - - // Start HTTP server using default configuration, change the code to - // configure the server as required by your service. - srv := &http.Server{Addr: u.Host, Handler: handler} - for _, m := range calcServer.Mounts { - logger.Printf("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) - } - - (*wg).Add(1) - go func() { - defer (*wg).Done() - - // Start HTTP server in a separate goroutine. - go func() { - logger.Printf("HTTP server listening on %q", u.Host) - errc <- srv.ListenAndServe() - }() - - ctx.Done() - logger.Printf("shutting down HTTP server at %q", u.Host) - - // Shutdown gracefully with a 30s timeout. - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - - srv.Shutdown(ctx) - }() -} - -// errorHandler returns a function that writes and logs the given error. -// The function also writes and logs the error unique ID so that it's possible -// to correlate. -func errorHandler(logger *log.Logger) func(context.Context, http.ResponseWriter, error) { - return func(ctx context.Context, w http.ResponseWriter, err error) { - id := ctx.Value(middleware.RequestIDKey).(string) - w.Write([]byte("[" + id + "] encoding: " + err.Error())) - logger.Printf("[%s] ERROR: %s", id, err.Error()) - } -} diff --git a/tracing/cmd/calc/main.go b/tracing/cmd/calc/main.go deleted file mode 100644 index 1f872721f..000000000 --- a/tracing/cmd/calc/main.go +++ /dev/null @@ -1,177 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "log" - "net/url" - "os" - "os/signal" - "strings" - "sync" - - calc "goa.design/examples/basic" - calcsvc "goa.design/examples/basic/gen/calc" -) - -func main() { - // Define command line flags, add any other flag required to configure the - // service. - var ( - hostF = flag.String("host", "development", "Server host (valid values: development, production)") - domainF = flag.String("domain", "", "Host domain name (overrides host domain specified in service design)") - httpPortF = flag.String("http-port", "", "HTTP port (overrides host HTTP port specified in service design)") - grpcPortF = flag.String("grpc-port", "", "gRPC port (overrides host gRPC port specified in service design)") - versionF = flag.String("version", "v1", "API version") - secureF = flag.Bool("secure", false, "Use secure scheme (https or grpcs)") - dbgF = flag.Bool("debug", false, "Log request and response bodies") - daemonF = flag.String("daemon", "127.0.0.1:2000", "X-Ray daemon address") - ) - flag.Parse() - - // Setup logger. Replace logger with your own log package of choice. - var ( - logger *log.Logger - ) - { - logger = log.New(os.Stderr, "[calc] ", log.Ltime) - } - - // Initialize the services. - var ( - calcSvc calcsvc.Service - ) - { - calcSvc = calc.NewCalc(logger) - } - - // Wrap the services in endpoints that can be invoked from other services - // potentially running in different processes. - var ( - calcEndpoints *calcsvc.Endpoints - ) - { - calcEndpoints = calcsvc.NewEndpoints(calcSvc) - } - - // Create channel used by both the signal handler and server goroutines - // to notify the main goroutine when to stop the server. - errc := make(chan error) - - // Setup interrupt handler. This optional step configures the process so - // that SIGINT and SIGTERM signals cause the services to stop gracefully. - go func() { - c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) - errc <- fmt.Errorf("%s", <-c) - }() - - var wg sync.WaitGroup - ctx, cancel := context.WithCancel(context.Background()) - // Start the servers and send errors (if any) to the error channel. - switch *hostF { - case "development": - { - addr := "http://localhost:8000/calc" - u, err := url.Parse(addr) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) - } - if *secureF { - u.Scheme = "https" - } - if *domainF != "" { - u.Host = *domainF - } - if *httpPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *httpPortF - } else if u.Port() == "" { - u.Host += ":80" - } - handleHTTPServer(ctx, u, calcEndpoints, &wg, errc, logger, *dbgF, *daemonF) - } - - { - addr := "grpc://localhost:8080" - u, err := url.Parse(addr) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) - } - if *secureF { - u.Scheme = "grpcs" - } - if *domainF != "" { - u.Host = *domainF - } - if *grpcPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *grpcPortF - } else if u.Port() == "" { - u.Host += ":8080" - } - handleGRPCServer(ctx, u, calcEndpoints, &wg, errc, logger, *dbgF, *daemonF) - } - - case "production": - { - addr := "https://{version}.goa.design/calc" - addr = strings.Replace(addr, "{version}", *versionF, -1) - u, err := url.Parse(addr) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) - } - if *secureF { - u.Scheme = "https" - } - if *domainF != "" { - u.Host = *domainF - } - if *httpPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *httpPortF - } else if u.Port() == "" { - u.Host += ":443" - } - handleHTTPServer(ctx, u, calcEndpoints, &wg, errc, logger, *dbgF, *daemonF) - } - - { - addr := "grpcs://{version}.goa.design" - addr = strings.Replace(addr, "{version}", *versionF, -1) - u, err := url.Parse(addr) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid URL %#v: %s", addr, err) - os.Exit(1) - } - if *secureF { - u.Scheme = "grpcs" - } - if *domainF != "" { - u.Host = *domainF - } - if *grpcPortF != "" { - h := strings.Split(u.Host, ":")[0] - u.Host = h + ":" + *grpcPortF - } else if u.Port() == "" { - u.Host += ":8443" - } - handleGRPCServer(ctx, u, calcEndpoints, &wg, errc, logger, *dbgF, *daemonF) - } - - default: - fmt.Fprintf(os.Stderr, "invalid host argument: %q (valid hosts: development|production)", *hostF) - } - // Wait for signal. - logger.Printf("exiting (%v)", <-errc) - - // Send cancellation signal to the goroutines. - cancel() - - wg.Wait() - logger.Println("exited") -} diff --git a/tus/Makefile b/tus/Makefile new file mode 100644 index 000000000..367c956d2 --- /dev/null +++ b/tus/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=upload + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/tus/cmd/upload/http.go b/tus/cmd/upload/http.go index 92c90c17b..2807ab76f 100644 --- a/tus/cmd/upload/http.go +++ b/tus/cmd/upload/http.go @@ -10,7 +10,7 @@ import ( "time" tussvr "goa.design/examples/tus/gen/http/tus/server" - tus "goa.design/examples/tus/gen/tus" + "goa.design/examples/tus/gen/tus" goahttp "goa.design/goa/v3/http" httpmdlwr "goa.design/goa/v3/http/middleware" "goa.design/goa/v3/middleware" @@ -49,7 +49,10 @@ func handleHTTPServer(ctx context.Context, u *url.URL, tusEndpoints *tus.Endpoin ctx, cancel := context.WithTimeout(ctx, 300*time.Second) defer cancel() - srv.Shutdown(ctx) + err := srv.Shutdown(ctx) + if err != nil { + logger.Printf("failed to shutdown: %v", err) + } }() } @@ -59,7 +62,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, tusEndpoints *tus.Endpoin func errorHandler(logger *log.Logger) func(context.Context, http.ResponseWriter, error) { return func(ctx context.Context, w http.ResponseWriter, err error) { id := ctx.Value(middleware.RequestIDKey).(string) - w.Write([]byte("[" + id + "] encoding: " + err.Error())) + _, _ = w.Write([]byte("[" + id + "] encoding: " + err.Error())) logger.Printf("[%s] ERROR: %s", id, err.Error()) } } diff --git a/tus/cmd/upload/main.go b/tus/cmd/upload/main.go index d329d0527..ab8c3e033 100644 --- a/tus/cmd/upload/main.go +++ b/tus/cmd/upload/main.go @@ -11,6 +11,7 @@ import ( "os/signal" "path/filepath" "sync" + "syscall" "time" tussvc "goa.design/examples/tus" @@ -40,9 +41,12 @@ func main() { // SIGINT and SIGTERM signals cause the services to stop gracefully. errc := make(chan error) + + // Setup interrupt handler. This optional step configures the process so + // that SIGINT and SIGTERM signals cause the services to stop gracefully. go func() { c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) errc <- fmt.Errorf("%s", <-c) }() @@ -52,7 +56,7 @@ func main() { // Start the servers and send errors (if any) to the error channel. u, err := url.Parse(fmt.Sprintf("http://localhost:%s/upload", *httpPortF)) if err != nil { - fmt.Fprintf(os.Stderr, "invalid port %#v: %s\n", *httpPortF, err) + _, _ = fmt.Fprintf(os.Stderr, "invalid port %#v: %s\n", *httpPortF, err) os.Exit(1) } handleHTTPServer(ctx, u, endpoints, &wg, errc, logger, *dbgF) diff --git a/tus/gen/http/cli/upload/cli.go b/tus/gen/http/cli/upload/cli.go index 450452143..52971929f 100644 --- a/tus/gen/http/cli/upload/cli.go +++ b/tus/gen/http/cli/upload/cli.go @@ -3,7 +3,7 @@ // Upload HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package cli @@ -28,7 +28,7 @@ func UsageCommands() string { // UsageExamples produces an example of a valid invocation of the CLI tool. func UsageExamples() string { - return os.Args[0] + ` tus head --id "nldc26ee721lv2pnqlki" --tus-resumable "1.0.0"` + "\n" + + return os.Args[0] + ` tus head --id "odtjehsobdnt64luh38o" --tus-resumable "1.0.0"` + "\n" + "" } @@ -207,7 +207,7 @@ Clients use the HEAD request to determine the offset at which the upload should -tus-resumable STRING: Example: - %[1]s tus head --id "nldc26ee721lv2pnqlki" --tus-resumable "1.0.0" + %[1]s tus head --id "odtjehsobdnt64luh38o" --tus-resumable "1.0.0" `, os.Args[0]) } @@ -222,7 +222,7 @@ Clients use the PATCH method to start or resume an upload. -stream STRING: path to file containing the streamed request body Example: - %[1]s tus patch --id "a1nijh8pg0hkte4ios4l" --tus-resumable "1.0.0" --upload-offset 3237920552917083987 --upload-checksum "sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0=" --stream "goa.png" + %[1]s tus patch --id "v4g6t1ktq3m1js4jcd3p" --tus-resumable "1.0.0" --upload-offset 3237920552917083987 --upload-checksum "sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0=" --stream "goa.png" `, os.Args[0]) } @@ -261,6 +261,6 @@ Clients use the DELETE method to terminate completed and unfinished uploads allo -tus-resumable STRING: Example: - %[1]s tus delete --id "9gdoklutr1aq5slbuics" --tus-resumable "1.0.0" + %[1]s tus delete --id "omlckokcapg7m9rq09ki" --tus-resumable "1.0.0" `, os.Args[0]) } diff --git a/tus/gen/http/openapi3.json b/tus/gen/http/openapi3.json index 61ae41fb8..640781d82 100644 --- a/tus/gen/http/openapi3.json +++ b/tus/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"File Upload Service","description":"HTTP service for uploading files using the tus protocol (https://tus.io)","version":"1.0"},"servers":[{"url":"http://localhost:8000/upload","description":"Upload hosts the upload service."}],"paths":{"/upload":{"options":{"tags":["tus"],"summary":"options tus","description":"Clients use the OPTIONS method to gather information about the Server’s current configuration.","operationId":"tus#options","responses":{"204":{"description":"No Content response.","headers":{"Tus-Checksum-Algorithm":{"description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"md5,sha1,crc32","enum":["md5,sha1,crc32"]},"example":"md5,sha1,crc32"},"Tus-Extension":{"description":"tusExtension is a comma separated list of extensions supported by the server. This implementation supports the creation, creation-with-upload, expiration, checksum and termination extensions","schema":{"type":"string","description":"tusExtension is a comma separated list of extensions supported by the server. This implementation supports the creation, creation-with-upload, expiration, checksum and termination extensions","example":"creation,creation-with-upload,creation-defer-length,expiration,checksum,termination","enum":["creation,creation-with-upload,creation-defer-length,expiration,checksum,termination"]},"example":"creation,creation-with-upload,creation-defer-length,expiration,checksum,termination"},"Tus-Max-Size":{"description":"tusMaxSize represents the maximum allowed size of an entire upload in bytes.","schema":{"type":"integer","description":"tusMaxSize represents the maximum allowed size of an entire upload in bytes.","example":8629356317669087847,"format":"int64"},"example":6978318493894829345},"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Tus-Version":{"description":"tusVersion is a comma separated list of protocol versions supported by the server. This implementation only supports 1.0.0.","schema":{"type":"string","description":"tusVersion is a comma separated list of protocol versions supported by the server. This implementation only supports 1.0.0.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"post":{"tags":["tus"],"summary":"post tus","description":"Clients use the POST method against a known upload creation URL to request a new upload resource.","operationId":"tus#post","parameters":[{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},{"name":"Upload-Length","in":"header","description":"uploadLength represents the size of the entire upload in bytes.","allowEmptyValue":true,"schema":{"type":"integer","description":"uploadLength represents the size of the entire upload in bytes.","example":7396158580806568053,"format":"int64"},"example":5624338093414857634},{"name":"Upload-Defer-Length","in":"header","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","allowEmptyValue":true,"schema":{"type":"integer","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","example":1,"enum":[1]},"example":1},{"name":"Upload-Checksum","in":"header","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","allowEmptyValue":true,"schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},"example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},{"name":"Upload-Metadata","in":"header","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","allowEmptyValue":true,"schema":{"type":"string","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","example":"key1 val1,key2 val2"},"example":"key1 val1,key2 val2"},{"name":"Tus-Max-Size","in":"header","description":"Length of the upload","allowEmptyValue":true,"schema":{"type":"integer","description":"Length of the upload","example":7105892283630893200,"format":"int64"},"example":1929678290230995950}],"responses":{"201":{"description":"Created response.","headers":{"Location":{"description":"URL of created resource","schema":{"type":"string","description":"URL of created resource","example":"/files/123","format":"uri"},"example":"/files/123"},"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Expires":{"description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","schema":{"type":"string","description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","example":"Wed, 25 Jun 2014 16:00:00 GMT"},"example":"Wed, 25 Jun 2014 16:00:00 GMT"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":3713765798879909435,"format":"int64"},"example":375294180421079817}}},"400":{"description":"InvalidChecksumAlgorithm: The checksum algorithm is not supported by the server.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"413":{"description":"MaximumSizeExceeded: If the length of the upload exceeds the maximum, which MAY be specified using the Tus-Max-Size header, the Server MUST respond with the 413 Request Entity Too Large status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"460":{"description":"ChecksumMismatch: The checksums mismatch.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}}}}},"/upload/{id}":{"delete":{"tags":["tus"],"summary":"delete tus","description":"Clients use the DELETE method to terminate completed and unfinished uploads allowing the Server to free up used resources.","operationId":"tus#delete","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"ik6rlq3a8366rpvebef0","pattern":"[0-9a-v]{20}"},"example":"m5hshraskinqrm8ikkh8"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}],"responses":{"204":{"description":"No Content response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}}},"404":{"description":"NotFound: For all future requests to this URL, the Server SHOULD respond with the 404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":false}}},"410":{"description":"Gone: For all future requests to this URL, the Server SHOULD respond with the 404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"head":{"tags":["tus"],"summary":"head tus","description":"Clients use the HEAD request to determine the offset at which the upload should be continued.","operationId":"tus#head","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"e64o6s954tc2inqh39dk","pattern":"[0-9a-v]{20}"},"example":"tlg9j18c4vkmm8kkmt4j"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}],"responses":{"200":{"description":"OK response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Defer-Length":{"description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","schema":{"type":"integer","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","example":1,"enum":[1]},"example":1},"Upload-Length":{"description":"uploadLength represents the size of the entire upload in bytes.","schema":{"type":"integer","description":"uploadLength represents the size of the entire upload in bytes.","example":3120396208044830135,"format":"int64"},"example":7081237826977381629},"Upload-Metadata":{"description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","schema":{"type":"string","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","example":"key1 val1,key2 val2"},"example":"key1 val1,key2 val2"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":5128883553528072720,"format":"int64"},"example":6645337381640055720}}},"404":{"description":"NotFound: If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"410":{"description":"Gone: If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"patch":{"tags":["tus"],"summary":"patch tus","description":"Clients use the PATCH method to start or resume an upload.","operationId":"tus#patch","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"tqo05mp6u44fclff5irv","pattern":"[0-9a-v]{20}"},"example":"9s17nq3vsfd6euk8g7t3"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},{"name":"Upload-Offset","in":"header","description":"uploadOffset represents a byte offset within a resource.","allowEmptyValue":true,"required":true,"schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":6693083797116430622,"format":"int64"},"example":7695622195691640609},{"name":"Upload-Checksum","in":"header","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","allowEmptyValue":true,"schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},"example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="}],"responses":{"204":{"description":"No Content response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Expires":{"description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","schema":{"type":"string","description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","example":"Wed, 25 Jun 2014 16:00:00 GMT"},"example":"Wed, 25 Jun 2014 16:00:00 GMT"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":7267554011524460006,"format":"int64"},"example":6460434301675760960}}},"400":{"description":"InvalidChecksumAlgorithm: The checksum algorithm is not supported by the server.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"404":{"description":"NotFound: If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"409":{"description":"InvalidOffset: If the offsets do not match, the Server MUST respond with the 409 Conflict status without modifying the upload resource.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"410":{"description":"Gone: If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"415":{"description":"InvalidContentType: All PATCH requests MUST use Content-Type: application/offset+octet-stream, otherwise the server SHOULD return a 415 Unsupported Media Type status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":true}}},"460":{"description":"ChecksumMismatch: The checksums mismatch.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":true}}},"500":{"description":"Internal: Internal error","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}}}}}},"components":{},"tags":[{"name":"tus","description":"The tus service exposes the methods required to implement the tus protocol"}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"File Upload Service","description":"HTTP service for uploading files using the tus protocol (https://tus.io)","version":"1.0"},"servers":[{"url":"http://localhost:8000/upload","description":"Upload hosts the upload service."}],"paths":{"/upload":{"options":{"tags":["tus"],"summary":"options tus","description":"Clients use the OPTIONS method to gather information about the Server’s current configuration.","operationId":"tus#options","responses":{"204":{"description":"No Content response.","headers":{"Tus-Checksum-Algorithm":{"description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"md5,sha1,crc32","enum":["md5,sha1,crc32"]},"example":"md5,sha1,crc32"},"Tus-Extension":{"description":"tusExtension is a comma separated list of extensions supported by the server. This implementation supports the creation, creation-with-upload, expiration, checksum and termination extensions","schema":{"type":"string","description":"tusExtension is a comma separated list of extensions supported by the server. This implementation supports the creation, creation-with-upload, expiration, checksum and termination extensions","example":"creation,creation-with-upload,creation-defer-length,expiration,checksum,termination","enum":["creation,creation-with-upload,creation-defer-length,expiration,checksum,termination"]},"example":"creation,creation-with-upload,creation-defer-length,expiration,checksum,termination"},"Tus-Max-Size":{"description":"tusMaxSize represents the maximum allowed size of an entire upload in bytes.","schema":{"type":"integer","description":"tusMaxSize represents the maximum allowed size of an entire upload in bytes.","example":8629356317669087847,"format":"int64"},"example":6978318493894829345},"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Tus-Version":{"description":"tusVersion is a comma separated list of protocol versions supported by the server. This implementation only supports 1.0.0.","schema":{"type":"string","description":"tusVersion is a comma separated list of protocol versions supported by the server. This implementation only supports 1.0.0.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"post":{"tags":["tus"],"summary":"post tus","description":"Clients use the POST method against a known upload creation URL to request a new upload resource.","operationId":"tus#post","parameters":[{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},{"name":"Upload-Length","in":"header","description":"uploadLength represents the size of the entire upload in bytes.","allowEmptyValue":true,"schema":{"type":"integer","description":"uploadLength represents the size of the entire upload in bytes.","example":7396158580806568053,"format":"int64"},"example":5624338093414857634},{"name":"Upload-Defer-Length","in":"header","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","allowEmptyValue":true,"schema":{"type":"integer","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","example":1,"enum":[1]},"example":1},{"name":"Upload-Checksum","in":"header","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","allowEmptyValue":true,"schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},"example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},{"name":"Upload-Metadata","in":"header","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","allowEmptyValue":true,"schema":{"type":"string","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","example":"key1 val1,key2 val2"},"example":"key1 val1,key2 val2"},{"name":"Tus-Max-Size","in":"header","description":"Length of the upload","allowEmptyValue":true,"schema":{"type":"integer","description":"Length of the upload","example":7105892283630893200,"format":"int64"},"example":1929678290230995950}],"responses":{"201":{"description":"Created response.","headers":{"Location":{"description":"URL of created resource","schema":{"type":"string","description":"URL of created resource","example":"/files/123","format":"uri"},"example":"/files/123"},"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Expires":{"description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","schema":{"type":"string","description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","example":"Wed, 25 Jun 2014 16:00:00 GMT"},"example":"Wed, 25 Jun 2014 16:00:00 GMT"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":3713765798879909435,"format":"int64"},"example":375294180421079817}}},"400":{"description":"InvalidChecksumAlgorithm: The checksum algorithm is not supported by the server.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"413":{"description":"MaximumSizeExceeded: If the length of the upload exceeds the maximum, which MAY be specified using the Tus-Max-Size header, the Server MUST respond with the 413 Request Entity Too Large status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"460":{"description":"ChecksumMismatch: The checksums mismatch.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}}}}},"/upload/{id}":{"delete":{"tags":["tus"],"summary":"delete tus","description":"Clients use the DELETE method to terminate completed and unfinished uploads allowing the Server to free up used resources.","operationId":"tus#delete","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"mfrskee41vb6gp4koth2","pattern":"[0-9a-v]{20}"},"example":"qjdkjo6ot60kgpo2bbr8"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}],"responses":{"204":{"description":"No Content response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}}},"404":{"description":"NotFound: For all future requests to this URL, the Server SHOULD respond with the 404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":false}}},"410":{"description":"Gone: For all future requests to this URL, the Server SHOULD respond with the 404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"head":{"tags":["tus"],"summary":"head tus","description":"Clients use the HEAD request to determine the offset at which the upload should be continued.","operationId":"tus#head","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"mjle5vmf9mbbf0mmgtlo","pattern":"[0-9a-v]{20}"},"example":"hpbisr4o2nkmrs8tn0ss"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"}],"responses":{"200":{"description":"OK response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Defer-Length":{"description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","schema":{"type":"integer","description":"The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later.","example":1,"enum":[1]},"example":1},"Upload-Length":{"description":"uploadLength represents the size of the entire upload in bytes.","schema":{"type":"integer","description":"uploadLength represents the size of the entire upload in bytes.","example":3120396208044830135,"format":"int64"},"example":7081237826977381629},"Upload-Metadata":{"description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","schema":{"type":"string","description":"The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request.","example":"key1 val1,key2 val2"},"example":"key1 val1,key2 val2"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":5128883553528072720,"format":"int64"},"example":6645337381640055720}}},"404":{"description":"NotFound: If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"410":{"description":"Gone: If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}}}},"patch":{"tags":["tus"],"summary":"patch tus","description":"Clients use the PATCH method to start or resume an upload.","operationId":"tus#patch","parameters":[{"name":"id","in":"path","description":"IDs are generated using Xid: https://github.com/rs/xid","required":true,"schema":{"type":"string","description":"IDs are generated using Xid: https://github.com/rs/xid","example":"i8j740kcfh05bt0i9bjt","pattern":"[0-9a-v]{20}"},"example":"sebl90aqddcqpboeua0m"},{"name":"Tus-Resumable","in":"header","description":"tusResumable represents a tus protocol version.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},{"name":"Upload-Offset","in":"header","description":"uploadOffset represents a byte offset within a resource.","allowEmptyValue":true,"required":true,"schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":6693083797116430622,"format":"int64"},"example":7695622195691640609},{"name":"Upload-Checksum","in":"header","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","allowEmptyValue":true,"schema":{"type":"string","description":"A Client MAY include the Upload-Checksum header in a PATCH request. Once the entire request has been received, the Server MUST verify the uploaded chunk against the provided checksum using the specified algorithm.","example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="},"example":"sha1 Kq5sNclPz7QV2+lfQIuc6R7oRu0="}],"responses":{"204":{"description":"No Content response.","headers":{"Tus-Resumable":{"description":"tusResumable represents a tus protocol version.","schema":{"type":"string","description":"tusResumable represents a tus protocol version.","example":"1.0.0","pattern":"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"},"example":"1.0.0"},"Upload-Expires":{"description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","schema":{"type":"string","description":"The Upload-Expires response header indicates the time after which the unfinished upload expires.","example":"Wed, 25 Jun 2014 16:00:00 GMT"},"example":"Wed, 25 Jun 2014 16:00:00 GMT"},"Upload-Offset":{"description":"uploadOffset represents a byte offset within a resource.","schema":{"type":"integer","description":"uploadOffset represents a byte offset within a resource.","example":7267554011524460006,"format":"int64"},"example":6460434301675760960}}},"400":{"description":"InvalidChecksumAlgorithm: The checksum algorithm is not supported by the server.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":true},"example":true}}},"404":{"description":"NotFound: If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"409":{"description":"InvalidOffset: If the offsets do not match, the Server MUST respond with the 409 Conflict status without modifying the upload resource.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"410":{"description":"Gone: If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the404 Not Found or 410 Gone status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}},"412":{"description":"InvalidTusResumable: If the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status.","headers":{"Tus-Version":{"description":"Comma separated list of supported versions.","schema":{"type":"string","description":"Comma separated list of supported versions.","example":"1.0.0","enum":["1.0.0"]},"example":"1.0.0"}}},"415":{"description":"InvalidContentType: All PATCH requests MUST use Content-Type: application/offset+octet-stream, otherwise the server SHOULD return a 415 Unsupported Media Type status.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":false},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":true}}},"460":{"description":"ChecksumMismatch: The checksums mismatch.","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"example":true},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":true},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":true}}},"500":{"description":"Internal: Internal error","headers":{"goa-attribute-fault":{"description":"Is the error a server-side fault?","schema":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"example":false},"goa-attribute-id":{"description":"ID is a unique identifier for this particular occurrence of the problem.","schema":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"example":"123abc"},"goa-attribute-message":{"description":"Message is a human-readable explanation specific to this occurrence of the problem.","schema":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"example":"parameter 'p' must be an integer"},"goa-attribute-name":{"description":"Name is the name of this class of errors.","schema":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"example":"bad_request"},"goa-attribute-temporary":{"description":"Is the error temporary?","schema":{"type":"boolean","description":"Is the error temporary?","example":false},"example":true},"goa-attribute-timeout":{"description":"Is the error a timeout?","schema":{"type":"boolean","description":"Is the error a timeout?","example":false},"example":false}}}}}}},"components":{},"tags":[{"name":"tus","description":"The tus service exposes the methods required to implement the tus protocol"}]} \ No newline at end of file diff --git a/tus/gen/http/openapi3.yaml b/tus/gen/http/openapi3.yaml index 4826eafe5..3fb7c8ec1 100644 --- a/tus/gen/http/openapi3.yaml +++ b/tus/gen/http/openapi3.yaml @@ -337,9 +337,9 @@ paths: schema: type: string description: 'IDs are generated using Xid: https://github.com/rs/xid' - example: ik6rlq3a8366rpvebef0 + example: mfrskee41vb6gp4koth2 pattern: '[0-9a-v]{20}' - example: m5hshraskinqrm8ikkh8 + example: qjdkjo6ot60kgpo2bbr8 - name: Tus-Resumable in: header description: tusResumable represents a tus protocol version. @@ -479,9 +479,9 @@ paths: schema: type: string description: 'IDs are generated using Xid: https://github.com/rs/xid' - example: e64o6s954tc2inqh39dk + example: mjle5vmf9mbbf0mmgtlo pattern: '[0-9a-v]{20}' - example: tlg9j18c4vkmm8kkmt4j + example: hpbisr4o2nkmrs8tn0ss - name: Tus-Resumable in: header description: tusResumable represents a tus protocol version. @@ -653,9 +653,9 @@ paths: schema: type: string description: 'IDs are generated using Xid: https://github.com/rs/xid' - example: tqo05mp6u44fclff5irv + example: i8j740kcfh05bt0i9bjt pattern: '[0-9a-v]{20}' - example: 9s17nq3vsfd6euk8g7t3 + example: sebl90aqddcqpboeua0m - name: Tus-Resumable in: header description: tusResumable represents a tus protocol version. diff --git a/tus/gen/http/tus/client/cli.go b/tus/gen/http/tus/client/cli.go index 187490fc0..47da17e87 100644 --- a/tus/gen/http/tus/client/cli.go +++ b/tus/gen/http/tus/client/cli.go @@ -3,7 +3,7 @@ // tus HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package client diff --git a/tus/gen/http/tus/client/client.go b/tus/gen/http/tus/client/client.go index 3ec425af7..c7a7baac5 100644 --- a/tus/gen/http/tus/client/client.go +++ b/tus/gen/http/tus/client/client.go @@ -3,7 +3,7 @@ // tus client HTTP transport // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package client diff --git a/tus/gen/http/tus/client/encode_decode.go b/tus/gen/http/tus/client/encode_decode.go index 1fc666e4d..679ab91e5 100644 --- a/tus/gen/http/tus/client/encode_decode.go +++ b/tus/gen/http/tus/client/encode_decode.go @@ -3,7 +3,7 @@ // tus HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package client diff --git a/tus/gen/http/tus/client/paths.go b/tus/gen/http/tus/client/paths.go index 85793ecf9..fb956fac2 100644 --- a/tus/gen/http/tus/client/paths.go +++ b/tus/gen/http/tus/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the tus service. // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package client diff --git a/tus/gen/http/tus/client/types.go b/tus/gen/http/tus/client/types.go index 881ce8927..9c404de33 100644 --- a/tus/gen/http/tus/client/types.go +++ b/tus/gen/http/tus/client/types.go @@ -3,7 +3,7 @@ // tus HTTP client types // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package client diff --git a/tus/gen/http/tus/server/encode_decode.go b/tus/gen/http/tus/server/encode_decode.go index 289f8ae70..ab65b2843 100644 --- a/tus/gen/http/tus/server/encode_decode.go +++ b/tus/gen/http/tus/server/encode_decode.go @@ -3,7 +3,7 @@ // tus HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package server diff --git a/tus/gen/http/tus/server/paths.go b/tus/gen/http/tus/server/paths.go index 45f1e0b53..aba0955df 100644 --- a/tus/gen/http/tus/server/paths.go +++ b/tus/gen/http/tus/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the tus service. // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package server diff --git a/tus/gen/http/tus/server/server.go b/tus/gen/http/tus/server/server.go index c7fbc84bb..915249b0c 100644 --- a/tus/gen/http/tus/server/server.go +++ b/tus/gen/http/tus/server/server.go @@ -3,7 +3,7 @@ // tus HTTP server // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package server diff --git a/tus/gen/http/tus/server/types.go b/tus/gen/http/tus/server/types.go index e890489d3..019ea601a 100644 --- a/tus/gen/http/tus/server/types.go +++ b/tus/gen/http/tus/server/types.go @@ -3,7 +3,7 @@ // tus HTTP server types // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package server diff --git a/tus/gen/tus/client.go b/tus/gen/tus/client.go index 7a9786e97..b5a414e70 100644 --- a/tus/gen/tus/client.go +++ b/tus/gen/tus/client.go @@ -3,7 +3,7 @@ // tus client // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package tus diff --git a/tus/gen/tus/endpoints.go b/tus/gen/tus/endpoints.go index de527976d..7cb3b0de5 100644 --- a/tus/gen/tus/endpoints.go +++ b/tus/gen/tus/endpoints.go @@ -3,7 +3,7 @@ // tus endpoints // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package tus diff --git a/tus/gen/tus/service.go b/tus/gen/tus/service.go index 1f810b091..f3f39b3d4 100644 --- a/tus/gen/tus/service.go +++ b/tus/gen/tus/service.go @@ -3,7 +3,7 @@ // tus service // // Command: -// $ goa gen goa.design/examples/tus/design -o tus +// $ goa gen goa.design/examples/tus/design package tus diff --git a/tus/go.mod b/tus/go.mod new file mode 100644 index 000000000..3bb84b3be --- /dev/null +++ b/tus/go.mod @@ -0,0 +1,23 @@ +module goa.design/examples/tus + +go 1.21.1 + +require ( + github.com/rs/xid v1.5.0 + goa.design/goa/v3 v3.13.2 +) + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/tus/go.sum b/tus/go.sum new file mode 100644 index 000000000..1d07210bc --- /dev/null +++ b/tus/go.sum @@ -0,0 +1,51 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tus/tus.go b/tus/tus.go index 8846e6604..f7b06ed60 100644 --- a/tus/tus.go +++ b/tus/tus.go @@ -8,10 +8,10 @@ import ( "net/http" "time" - "github.com/rs/xid" "goa.design/examples/tus/gen/http/tus/server" "goa.design/examples/tus/gen/tus" "goa.design/examples/tus/persist" + "github.com/rs/xid" goahttp "goa.design/goa/v3/http" ) diff --git a/upload_download/Makefile b/upload_download/Makefile new file mode 100644 index 000000000..6d0389a3f --- /dev/null +++ b/upload_download/Makefile @@ -0,0 +1,101 @@ +#! /usr/bin/make +# +# Makefile for Goa examples +# +# Targets: +# - "depend" retrieves the Go packages needed to run the linter and tests +# - "gen" invokes the "goa" tool to generate the examples source code +# - "build" compiles the example microservices and client CLIs +# - "clean" deletes the output of "build" +# - "lint" runs the linter and checks the code format using goimports +# - "test" runs the tests +# +# Meta targets: +# - "all" is the default target, it runs all the targets in the order above. +# +GO_FILES=$(shell find . -type f -name '*.go') +MODULE=$(shell go list -m) +APP=upload_download + +# Only list test and build dependencies +# Standard dependencies are installed via go get +DEPEND=\ + github.com/hashicorp/go-getter \ + github.com/cheggaaa/pb \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/golang/protobuf/proto \ + goa.design/goa/... \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck + +.phony: all depend lint test build clean + +all: gen lint test + @echo DONE! + +# Install protoc +GOOS=$(shell go env GOOS) +PROTOC_VERSION=3.6.1 +ifeq ($(GOOS),linux) +PROTOC=protoc-$(PROTOC_VERSION)-linux-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin +else + ifeq ($(GOOS),darwin) +PROTOC=protoc-$(PROTOC_VERSION)-osx-x86_64 +PROTOC_EXEC=$(PROTOC)/bin/protoc +GOBIN=$(GOPATH)/bin + else + ifeq ($(GOOS),windows) +PROTOC=protoc-$(PROTOC_VERSION)-win32 +PROTOC_EXEC="$(PROTOC)\bin\protoc.exe" +GOBIN="$(GOPATH)\bin" + endif + endif +endif +depend: + @echo INSTALLING DEPENDENCIES... + @go get -v $(DEPEND) + @go install github.com/hashicorp/go-getter/cmd/go-getter && \ + go-getter https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC).zip $(PROTOC) && \ + cp $(PROTOC_EXEC) $(GOBIN) && \ + rm -r $(PROTOC) + @go install github.com/golang/protobuf/protoc-gen-go + @go get -t -v ./... + +lint: + @echo LINTING CODE... + @if [ "`goimports -l $(GO_FILES) | grep -v .pb.go | tee /dev/stderr`" ]; then \ + echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ + fi + @if [ "`staticcheck -checks all,-ST1000,-ST1001 ./... | grep -v ".pb.go" | tee /dev/stderr`" ]; then \ + echo "^ - staticcheck errors!" && echo && exit 1; \ + fi + +.PHONY: gen +gen: + @# NOTE: not all command line tools are generated + @echo GENERATING CODE... + goa gen "$(MODULE)/design" && \ + goa example "$(MODULE)/design" + +build: + @go build "./cmd/$(APP)" && go build "./cmd/$(APP)-cli" + +clean: + @rm -rf "./cmd/$(APP)" "./cmd/$(APP)-cli" + +test: + @echo TESTING... + @go test ./... > /dev/null + +check-freshness: + @if [ "`git diff | wc -l`" -gt "0" ]; then \ + echo "[ERROR] generated code not in-sync with design:"; \ + echo; \ + git status -s; \ + git --no-pager diff; \ + echo; \ + exit 1; \ + fi diff --git a/upload_download/cmd/upload_download/http.go b/upload_download/cmd/upload_download/http.go index 740010a04..0cac5fac7 100644 --- a/upload_download/cmd/upload_download/http.go +++ b/upload_download/cmd/upload_download/http.go @@ -74,7 +74,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, updownEndpoints *updown.E // Start HTTP server using default configuration, change the code to // configure the server as required by your service. - srv := &http.Server{Addr: u.Host, Handler: handler} + srv := &http.Server{Addr: u.Host, Handler: handler, ReadHeaderTimeout: time.Second * 60} for _, m := range updownServer.Mounts { logger.Printf("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } @@ -93,10 +93,13 @@ func handleHTTPServer(ctx context.Context, u *url.URL, updownEndpoints *updown.E logger.Printf("shutting down HTTP server at %q", u.Host) // Shutdown gracefully with a 30s timeout. - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - srv.Shutdown(ctx) + err := srv.Shutdown(ctx) + if err != nil { + logger.Printf("failed to shutdown: %v", err) + } }() } @@ -106,7 +109,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, updownEndpoints *updown.E func errorHandler(logger *log.Logger) func(context.Context, http.ResponseWriter, error) { return func(ctx context.Context, w http.ResponseWriter, err error) { id := ctx.Value(middleware.RequestIDKey).(string) - w.Write([]byte("[" + id + "] encoding: " + err.Error())) + _, _ = w.Write([]byte("[" + id + "] encoding: " + err.Error())) logger.Printf("[%s] ERROR: %s", id, err.Error()) } } diff --git a/upload_download/cmd/upload_download/main.go b/upload_download/cmd/upload_download/main.go index b89dc9bf2..6bad900f3 100644 --- a/upload_download/cmd/upload_download/main.go +++ b/upload_download/cmd/upload_download/main.go @@ -10,9 +10,10 @@ import ( "os/signal" "strings" "sync" + "syscall" uploaddownload "goa.design/examples/upload_download" - updown "goa.design/examples/upload_download/gen/updown" + "goa.design/examples/upload_download/gen/updown" ) func main() { @@ -58,7 +59,7 @@ func main() { // that SIGINT and SIGTERM signals cause the services to stop gracefully. go func() { c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) errc <- fmt.Errorf("%s", <-c) }() diff --git a/upload_download/gen/http/cli/upload_download/cli.go b/upload_download/gen/http/cli/upload_download/cli.go index 4b6f43d30..fe2576d57 100644 --- a/upload_download/gen/http/cli/upload_download/cli.go +++ b/upload_download/gen/http/cli/upload_download/cli.go @@ -3,7 +3,7 @@ // upload_download HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package cli diff --git a/upload_download/gen/http/updown/client/cli.go b/upload_download/gen/http/updown/client/cli.go index 85aa8b115..6505c1544 100644 --- a/upload_download/gen/http/updown/client/cli.go +++ b/upload_download/gen/http/updown/client/cli.go @@ -3,7 +3,7 @@ // updown HTTP client CLI support package // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package client diff --git a/upload_download/gen/http/updown/client/client.go b/upload_download/gen/http/updown/client/client.go index 382f6bf18..c1e35fd57 100644 --- a/upload_download/gen/http/updown/client/client.go +++ b/upload_download/gen/http/updown/client/client.go @@ -3,7 +3,7 @@ // updown client HTTP transport // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package client diff --git a/upload_download/gen/http/updown/client/encode_decode.go b/upload_download/gen/http/updown/client/encode_decode.go index 8ae66e37d..a3a4ac4e2 100644 --- a/upload_download/gen/http/updown/client/encode_decode.go +++ b/upload_download/gen/http/updown/client/encode_decode.go @@ -3,7 +3,7 @@ // updown HTTP client encoders and decoders // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package client diff --git a/upload_download/gen/http/updown/client/paths.go b/upload_download/gen/http/updown/client/paths.go index 4931d5379..6ae3a02f3 100644 --- a/upload_download/gen/http/updown/client/paths.go +++ b/upload_download/gen/http/updown/client/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the updown service. // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package client diff --git a/upload_download/gen/http/updown/client/types.go b/upload_download/gen/http/updown/client/types.go index 5d3fed2a4..4521e47ec 100644 --- a/upload_download/gen/http/updown/client/types.go +++ b/upload_download/gen/http/updown/client/types.go @@ -3,7 +3,7 @@ // updown HTTP client types // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package client diff --git a/upload_download/gen/http/updown/server/encode_decode.go b/upload_download/gen/http/updown/server/encode_decode.go index 6fcf70cef..5a37945f6 100644 --- a/upload_download/gen/http/updown/server/encode_decode.go +++ b/upload_download/gen/http/updown/server/encode_decode.go @@ -3,7 +3,7 @@ // updown HTTP server encoders and decoders // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package server diff --git a/upload_download/gen/http/updown/server/paths.go b/upload_download/gen/http/updown/server/paths.go index 6b3620d8e..ed461bb73 100644 --- a/upload_download/gen/http/updown/server/paths.go +++ b/upload_download/gen/http/updown/server/paths.go @@ -3,7 +3,7 @@ // HTTP request path constructors for the updown service. // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package server diff --git a/upload_download/gen/http/updown/server/server.go b/upload_download/gen/http/updown/server/server.go index 7c19321c9..08ffce50a 100644 --- a/upload_download/gen/http/updown/server/server.go +++ b/upload_download/gen/http/updown/server/server.go @@ -3,7 +3,7 @@ // updown HTTP server // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package server diff --git a/upload_download/gen/http/updown/server/types.go b/upload_download/gen/http/updown/server/types.go index 496f96f32..f50520448 100644 --- a/upload_download/gen/http/updown/server/types.go +++ b/upload_download/gen/http/updown/server/types.go @@ -3,7 +3,7 @@ // updown HTTP server types // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package server diff --git a/upload_download/gen/updown/client.go b/upload_download/gen/updown/client.go index d4a857219..c86205fb0 100644 --- a/upload_download/gen/updown/client.go +++ b/upload_download/gen/updown/client.go @@ -3,7 +3,7 @@ // updown client // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package updown diff --git a/upload_download/gen/updown/endpoints.go b/upload_download/gen/updown/endpoints.go index 2c297ea80..aa1760e42 100644 --- a/upload_download/gen/updown/endpoints.go +++ b/upload_download/gen/updown/endpoints.go @@ -3,7 +3,7 @@ // updown endpoints // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package updown diff --git a/upload_download/gen/updown/service.go b/upload_download/gen/updown/service.go index 1b5723ea6..453abbdfb 100644 --- a/upload_download/gen/updown/service.go +++ b/upload_download/gen/updown/service.go @@ -3,7 +3,7 @@ // updown service // // Command: -// $ goa gen goa.design/examples/upload_download/design -o upload_download +// $ goa gen goa.design/examples/upload_download/design package updown diff --git a/upload_download/go.mod b/upload_download/go.mod new file mode 100644 index 000000000..6c2b3639e --- /dev/null +++ b/upload_download/go.mod @@ -0,0 +1,20 @@ +module goa.design/examples/upload_download + +go 1.21.1 + +require goa.design/goa/v3 v3.13.2 + +require ( + github.com/AnatolyRugalev/goregen v0.1.0 // indirect + github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect + github.com/sergi/go-diff v1.3.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/upload_download/go.sum b/upload_download/go.sum new file mode 100644 index 000000000..8a92cf665 --- /dev/null +++ b/upload_download/go.sum @@ -0,0 +1,49 @@ +github.com/AnatolyRugalev/goregen v0.1.0 h1:xrdXkLaskMnbxW0x4FWNj2yoednv0X2bcTBWpuJGYfE= +github.com/AnatolyRugalev/goregen v0.1.0/go.mod h1:sVlY1tjcirqLBRZnCcIq1+7/Lwmqz5g7IK8AStjOVzI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= +github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= +github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +goa.design/goa/v3 v3.13.2 h1:RclNIpo7891ZqGRVO4fpBjT7Fs7LjBNm78i8J41KHrI= +goa.design/goa/v3 v3.13.2/go.mod h1:VvZsuC8CSIUQOHVqk6Ep3MFSFz21OjOv87UPqCHiB94= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=