Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix: # Support latest and one minor back
go: ['1.15', '1.16']
env:
GOFLAGS: -mod=readonly

steps:
- name: Set up Go
uses: actions/setup-go@v2.1.3
with:
stable: 'false'
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v2

- name: Run tests
run: go test -v -race ./...
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
addsvc/addsvc
addsvc/client/client
apigateway/apigateway
profilesvc/profilesvc
stringsvc1/stringsvc1
stringsvc2/stringsvc2
stringsvc3/stringsvc3
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Peter Bourgon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Examples

This repository contains examples extracted from the core [kit](https://github.com/go-kit/kit) repository.

For more information about these examples,
including a walkthrough of the stringsvc example,
see [gokit.io/examples](https://gokit.io/examples).
6 changes: 3 additions & 3 deletions addsvc/cmd/addcli/addcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (

"github.com/go-kit/kit/log"

"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/examples/addsvc/pkg/addtransport"
addthrift "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc"
"github.com/go-kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addtransport"
addthrift "github.com/go-kit/examples/addsvc/thrift/gen-go/addsvc"
)

func main() {
Expand Down
10 changes: 5 additions & 5 deletions addsvc/cmd/addsvc/addsvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
"github.com/go-kit/kit/metrics/prometheus"
kitgrpc "github.com/go-kit/kit/transport/grpc"

addpb "github.com/go-kit/kit/examples/addsvc/pb"
"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/examples/addsvc/pkg/addtransport"
addthrift "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc"
addpb "github.com/go-kit/examples/addsvc/pb"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addtransport"
addthrift "github.com/go-kit/examples/addsvc/thrift/gen-go/addsvc"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions addsvc/cmd/addsvc/wiring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/metrics/discard"

"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/examples/addsvc/pkg/addtransport"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addtransport"
)

func TestHTTP(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion addsvc/pkg/addendpoint/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/go-kit/kit/tracing/opentracing"
"github.com/go-kit/kit/tracing/zipkin"

"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addservice"
)

// Set collects all of the endpoints that compose an add service. It's meant to
Expand Down
6 changes: 3 additions & 3 deletions addsvc/pkg/addtransport/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"github.com/go-kit/kit/transport"
grpctransport "github.com/go-kit/kit/transport/grpc"

"github.com/go-kit/kit/examples/addsvc/pb"
"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pb"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
)

type grpcServer struct {
Expand Down
4 changes: 2 additions & 2 deletions addsvc/pkg/addtransport/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/go-kit/kit/transport"
httptransport "github.com/go-kit/kit/transport/http"

"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
)

// NewHTTPHandler returns an HTTP handler that makes a set of endpoints
Expand Down
4 changes: 2 additions & 2 deletions addsvc/pkg/addtransport/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

"golang.org/x/time/rate"

"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/circuitbreaker"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/ratelimit"
"github.com/go-kit/kit/tracing/opentracing"
Expand Down
6 changes: 3 additions & 3 deletions addsvc/pkg/addtransport/thrift.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/ratelimit"

"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
addthrift "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
addthrift "github.com/go-kit/examples/addsvc/thrift/gen-go/addsvc"
)

type thriftServer struct {
Expand Down
2 changes: 1 addition & 1 deletion addsvc/thrift/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# make
# sudo make install

thrift -r --gen "go:package_prefix=github.com/go-kit/kit/examples/addsvc/thrift/gen-go/,thrift_import=github.com/apache/thrift/lib/go/thrift" addsvc.thrift
thrift -r --gen "go:package_prefix=github.com/go-kit/examples/addsvc/thrift/gen-go/,thrift_import=github.com/apache/thrift/lib/go/thrift" addsvc.thrift

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

6 changes: 3 additions & 3 deletions apigateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"github.com/go-kit/kit/sd/lb"
httptransport "github.com/go-kit/kit/transport/http"

"github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/kit/examples/addsvc/pkg/addtransport"
"github.com/go-kit/examples/addsvc/pkg/addendpoint"
"github.com/go-kit/examples/addsvc/pkg/addservice"
"github.com/go-kit/examples/addsvc/pkg/addtransport"
)

func main() {
Expand Down
24 changes: 24 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module github.com/go-kit/examples

go 1.16

require (
github.com/apache/thrift v0.14.1
github.com/go-kit/kit v0.10.0
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/hashicorp/consul/api v1.8.1
github.com/lightstep/lightstep-tracer-go v0.25.0
github.com/nats-io/nats.go v1.11.0
github.com/oklog/oklog v0.3.2
github.com/opentracing/opentracing-go v1.2.0
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
github.com/openzipkin/zipkin-go v0.2.5
github.com/pact-foundation/pact-go v1.5.2
github.com/pborman/uuid v1.2.1
github.com/prometheus/client_golang v1.10.0
github.com/sony/gobreaker v0.4.1
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
google.golang.org/grpc v1.38.0
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
)
Loading