go: use dep in builds, remove relative imports

Fixes #11.
Fixes #12.
Fixes #13.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-08-04 11:21:03 -07:00
parent c7dd0cbf31
commit 427f13fcd3
No known key found for this signature in database
GPG key ID: 5C02521D7B216AD6
36 changed files with 737 additions and 125 deletions

View file

@ -1,8 +1,12 @@
# cartservice_probe # cartservice_probe
FROM golang:1.10 as builder FROM golang:1.10 as builder
WORKDIR /src/microservices-demo/cartservice/probe RUN wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
COPY probe/ . chmod +x /go/bin/dep
RUN go get -d ./... ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/cartservice/probe
WORKDIR /go/src/$PROJECT
COPY probe/Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY ./probe ./
RUN go build -o /cartservice_probe . RUN go build -o /cartservice_probe .
# cartservice # cartservice

View file

@ -0,0 +1 @@
vendor/

101
src/cartservice/probe/Gopkg.lock generated Normal file
View file

@ -0,0 +1,101 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/golang/protobuf"
packages = [
"proto",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/timestamp"
]
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = [
"context",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"trace"
]
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[[projects]]
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable"
]
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"]
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
[[projects]]
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap"
]
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.14.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "8f3c07df5ebc7dc4d50ca8a6c274eef95f3045d33bbe5f384271fa87166a457e"
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -0,0 +1,42 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "github.com/golang/protobuf"
version = "1.1.0"
[[constraint]]
branch = "master"
name = "golang.org/x/net"
[[constraint]]
name = "google.golang.org/grpc"
version = "1.14.0"
[prune]
go-tests = true
unused-packages = true

View file

@ -20,9 +20,8 @@ import (
"os" "os"
"time" "time"
pb "./genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/cartservice/probe/genproto"
"go.opencensus.io/plugin/ocgrpc"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -38,7 +37,6 @@ func main() {
grpc.WithBlock(), grpc.WithBlock(),
grpc.WithTimeout(time.Second*3), grpc.WithTimeout(time.Second*3),
grpc.WithInsecure(), grpc.WithInsecure(),
grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
) )
if err != nil { if err != nil {
log.Fatalf("probe failed: failed to connect: %+v", err) log.Fatalf("probe failed: failed to connect: %+v", err)

View file

@ -0,0 +1 @@
vendor/

View file

@ -1,19 +1,16 @@
FROM golang:1.10-alpine as builder FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates git RUN apk add --no-cache ca-certificates git && \
WORKDIR /go/src/checkoutservice wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
chmod +x /go/bin/dep
ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice
WORKDIR /go/src/$PROJECT
# restore dependencies
COPY Gopkg.* ./
RUN dep ensure --vendor-only -v
# get known dependencies
RUN go get -d github.com/google/uuid \
google.golang.org/grpc \
google.golang.org/grpc/codes \
google.golang.org/grpc/status \
go.opencensus.io/plugin/ocgrpc \
go.opencensus.io/exporter/stackdriver \
go.opencensus.io/trace \
cloud.google.com/go/profiler
COPY . . COPY . .
# get remaining dependencies
RUN go get -d ./...
RUN go build -gcflags='-N -l' -o /checkoutservice . RUN go build -gcflags='-N -l' -o /checkoutservice .
FROM alpine as release FROM alpine as release

View file

@ -13,6 +13,15 @@
revision = "aad3f485ee528456e0768f20397b4d9dd941e755" revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
version = "v0.25.0" version = "v0.25.0"
[[projects]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
packages = [
".",
"propagation"
]
revision = "37aa2801fbf0205003e15636096ebf0373510288"
version = "v0.5.0"
[[projects]] [[projects]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
@ -51,8 +60,6 @@
name = "go.opencensus.io" name = "go.opencensus.io"
packages = [ packages = [
".", ".",
"exporter/stackdriver",
"exporter/stackdriver/propagation",
"internal", "internal",
"internal/tagencoding", "internal/tagencoding",
"plugin/ocgrpc", "plugin/ocgrpc",
@ -82,7 +89,7 @@
"internal/timeseries", "internal/timeseries",
"trace" "trace"
] ]
revision = "a0f8a16cb08c06df97cbdf9c47f4731ba548c33c" revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -102,6 +109,12 @@
packages = ["semaphore"] packages = ["semaphore"]
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
packages = [ packages = [
@ -136,7 +149,7 @@
"transport/grpc", "transport/grpc",
"transport/http" "transport/http"
] ]
revision = "31ca0e01cd791f07750cb23fc99327721f753290" revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
[[projects]] [[projects]]
name = "google.golang.org/appengine" name = "google.golang.org/appengine"
@ -173,7 +186,7 @@
"googleapis/rpc/status", "googleapis/rpc/status",
"protobuf/field_mask" "protobuf/field_mask"
] ]
revision = "2a72893556e4d1f6c795a4c039314c9fa751eedb" revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
[[projects]] [[projects]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
@ -192,7 +205,9 @@
"internal", "internal",
"internal/backoff", "internal/backoff",
"internal/channelz", "internal/channelz",
"internal/envconfig",
"internal/grpcrand", "internal/grpcrand",
"internal/transport",
"keepalive", "keepalive",
"metadata", "metadata",
"naming", "naming",
@ -202,15 +217,14 @@
"resolver/passthrough", "resolver/passthrough",
"stats", "stats",
"status", "status",
"tap", "tap"
"transport"
] ]
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8" revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.13.0" version = "v1.14.0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "73bafb0f18bd463b549babecf99cc93904602a143a87e666f7f8f1a3790c5a3b" inputs-digest = "54254ec0ccf29fb2b490b54b12e5f3eb752ab9b8f9d4f5ab097d60f96eeed9d9"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View file

@ -29,6 +29,10 @@
name = "cloud.google.com/go" name = "cloud.google.com/go"
version = "0.25.0" version = "0.25.0"
[[constraint]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
version = "0.5.0"
[[constraint]] [[constraint]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
version = "1.1.0" version = "1.1.0"
@ -47,7 +51,7 @@
[[constraint]] [[constraint]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
version = "1.13.0" version = "1.14.0"
[prune] [prune]
go-tests = true go-tests = true

View file

@ -0,0 +1,5 @@
# checkoutservice
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only

View file

@ -23,16 +23,16 @@ import (
"time" "time"
"cloud.google.com/go/profiler" "cloud.google.com/go/profiler"
"contrib.go.opencensus.io/exporter/stackdriver"
"github.com/google/uuid" "github.com/google/uuid"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/trace" "go.opencensus.io/trace"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
pb "checkoutservice/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto"
money "checkoutservice/money" money "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/money"
) )
const ( const (

View file

@ -17,7 +17,7 @@ package money
import ( import (
"errors" "errors"
pb "checkoutservice/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto"
) )
const ( const (

View file

@ -19,7 +19,7 @@ import (
"reflect" "reflect"
"testing" "testing"
pb "checkoutservice/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto"
) )
func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} } func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} }

View file

@ -1,32 +1,17 @@
FROM golang:1.10-alpine as builder FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates git RUN apk add --no-cache ca-certificates git && \
WORKDIR /go/src/frontend wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
chmod +x /go/bin/dep
# fetch known dependencies for caching ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/frontend
RUN go get -d github.com/google/uuid \ WORKDIR /go/src/$PROJECT
github.com/gorilla/mux \
github.com/pkg/errors \
github.com/sirupsen/logrus \
google.golang.org/grpc \
google.golang.org/grpc/codes \
google.golang.org/grpc/status \
go.opencensus.io/plugin/ochttp \
go.opencensus.io/plugin/ochttp/propagation/b3 \
go.opencensus.io/exporter/stackdriver \
go.opencensus.io/trace \
cloud.google.com/go/profiler
# copy go-only part of the build # restore dependencies
COPY *.go ./ COPY Gopkg.* ./
COPY ./genproto ./genproto RUN dep ensure --vendor-only -v
COPY ./money ./money COPY . .
# fetch other dependencies might not have listed above (ideally noop)
RUN go get -d ./...
RUN go install . RUN go install .
# ---
FROM alpine as release FROM alpine as release
RUN apk add --no-cache ca-certificates \ RUN apk add --no-cache ca-certificates \
busybox-extras net-tools bind-tools busybox-extras net-tools bind-tools

View file

@ -13,6 +13,15 @@
revision = "aad3f485ee528456e0768f20397b4d9dd941e755" revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
version = "v0.25.0" version = "v0.25.0"
[[projects]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
packages = [
".",
"propagation"
]
revision = "37aa2801fbf0205003e15636096ebf0373510288"
version = "v0.5.0"
[[projects]] [[projects]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
@ -75,8 +84,6 @@
name = "go.opencensus.io" name = "go.opencensus.io"
packages = [ packages = [
".", ".",
"exporter/stackdriver",
"exporter/stackdriver/propagation",
"internal", "internal",
"internal/tagencoding", "internal/tagencoding",
"plugin/ocgrpc", "plugin/ocgrpc",
@ -97,7 +104,7 @@
branch = "master" branch = "master"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = ["ssh/terminal"] packages = ["ssh/terminal"]
revision = "c126467f60eb25f8f27e5a981f32a87e3965053f" revision = "56440b844dfe139a8ac053f4ecac0b20b79058f4"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -112,7 +119,7 @@
"internal/timeseries", "internal/timeseries",
"trace" "trace"
] ]
revision = "a0f8a16cb08c06df97cbdf9c47f4731ba548c33c" revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -139,7 +146,7 @@
"unix", "unix",
"windows" "windows"
] ]
revision = "bd9dbc187b6e1dacfdd2722a87e83093c2d7bd6e" revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -175,7 +182,7 @@
"transport/grpc", "transport/grpc",
"transport/http" "transport/http"
] ]
revision = "31ca0e01cd791f07750cb23fc99327721f753290" revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
[[projects]] [[projects]]
name = "google.golang.org/appengine" name = "google.golang.org/appengine"
@ -212,7 +219,7 @@
"googleapis/rpc/status", "googleapis/rpc/status",
"protobuf/field_mask" "protobuf/field_mask"
] ]
revision = "2a72893556e4d1f6c795a4c039314c9fa751eedb" revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
[[projects]] [[projects]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
@ -231,7 +238,9 @@
"internal", "internal",
"internal/backoff", "internal/backoff",
"internal/channelz", "internal/channelz",
"internal/envconfig",
"internal/grpcrand", "internal/grpcrand",
"internal/transport",
"keepalive", "keepalive",
"metadata", "metadata",
"naming", "naming",
@ -241,15 +250,14 @@
"resolver/passthrough", "resolver/passthrough",
"stats", "stats",
"status", "status",
"tap", "tap"
"transport"
] ]
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8" revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.13.0" version = "v1.14.0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "a3d5d54ffc54113ecaf3060ac9855f71371867737615dfa7654c34676a546271" inputs-digest = "806889b149b944cab2216a1769d221df9ca18b3b62fb5040e40737fd0550084c"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View file

@ -29,6 +29,10 @@
name = "cloud.google.com/go" name = "cloud.google.com/go"
version = "0.25.0" version = "0.25.0"
[[constraint]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
version = "0.5.0"
[[constraint]] [[constraint]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
version = "1.1.0" version = "1.1.0"
@ -59,7 +63,7 @@
[[constraint]] [[constraint]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
version = "1.13.0" version = "1.14.0"
[prune] [prune]
go-tests = true go-tests = true

5
src/frontend/README.md Normal file
View file

@ -0,0 +1,5 @@
# frontend
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only

View file

@ -16,7 +16,6 @@ package main
import ( import (
"fmt" "fmt"
"frontend/money"
"html/template" "html/template"
"net/http" "net/http"
"os" "os"
@ -27,7 +26,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
pb "frontend/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/frontend/genproto"
"github.com/GoogleCloudPlatform/microservices-demo/src/frontend/money"
) )
var ( var (

View file

@ -22,10 +22,10 @@ import (
"time" "time"
"cloud.google.com/go/profiler" "cloud.google.com/go/profiler"
"contrib.go.opencensus.io/exporter/stackdriver"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/plugin/ochttp" "go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/b3" "go.opencensus.io/plugin/ochttp/propagation/b3"

View file

@ -16,7 +16,8 @@ package money
import ( import (
"errors" "errors"
pb "frontend/genproto"
pb "github.com/GoogleCloudPlatform/microservices-demo/src/frontend/genproto"
) )
const ( const (

View file

@ -19,7 +19,7 @@ import (
"reflect" "reflect"
"testing" "testing"
pb "frontend/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/frontend/genproto"
) )
func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} } func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} }

View file

@ -17,7 +17,7 @@ package main
import ( import (
"context" "context"
pb "frontend/genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/frontend/genproto"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

View file

@ -0,0 +1 @@
vendor/

View file

@ -1,20 +1,16 @@
FROM golang:1.10-alpine as builder FROM golang:1.10-alpine as builder
RUN apk add --no-cache \ RUN apk add --no-cache ca-certificates git && \
ca-certificates \ wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
git chmod +x /go/bin/dep
WORKDIR /src/microservices-demo/productcatalogservice
# get known dependencies ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice
RUN go get -d google.golang.org/grpc \ WORKDIR /go/src/$PROJECT
google.golang.org/grpc/codes \
google.golang.org/grpc/status \ # restore dependencies
go.opencensus.io/plugin/ocgrpc \ COPY Gopkg.* ./
go.opencensus.io/trace \ RUN dep ensure --vendor-only -v
go.opencensus.io/exporter/stackdriver \
cloud.google.com/go/profiler
COPY . . COPY . .
# get remaining dependencies
RUN go get -d ./...
RUN go build -o /productcatalogservice . RUN go build -o /productcatalogservice .
FROM alpine as release FROM alpine as release

236
src/productcatalogservice/Gopkg.lock generated Normal file
View file

@ -0,0 +1,236 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "cloud.google.com/go"
packages = [
"compute/metadata",
"internal/version",
"monitoring/apiv3",
"profiler",
"trace/apiv2"
]
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
version = "v0.25.0"
[[projects]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
packages = [
".",
"propagation"
]
revision = "37aa2801fbf0205003e15636096ebf0373510288"
version = "v0.5.0"
[[projects]]
name = "github.com/golang/protobuf"
packages = [
"jsonpb",
"proto",
"protoc-gen-go/descriptor",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/empty",
"ptypes/struct",
"ptypes/timestamp",
"ptypes/wrappers"
]
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0"
[[projects]]
name = "github.com/google/go-cmp"
packages = [
"cmp",
"cmp/internal/diff",
"cmp/internal/function",
"cmp/internal/value"
]
revision = "3af367b6b30c263d47e8895973edcca9a49cf029"
version = "v0.2.0"
[[projects]]
branch = "master"
name = "github.com/google/pprof"
packages = ["profile"]
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
[[projects]]
name = "github.com/googleapis/gax-go"
packages = ["."]
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
version = "v2.0.0"
[[projects]]
name = "go.opencensus.io"
packages = [
".",
"internal",
"internal/tagencoding",
"plugin/ocgrpc",
"plugin/ochttp",
"plugin/ochttp/propagation/b3",
"stats",
"stats/internal",
"stats/view",
"tag",
"trace",
"trace/internal",
"trace/propagation"
]
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
version = "v0.14.0"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = [
"context",
"context/ctxhttp",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"trace"
]
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
[[projects]]
branch = "master"
name = "golang.org/x/oauth2"
packages = [
".",
"google",
"internal",
"jws",
"jwt"
]
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
[[projects]]
branch = "master"
name = "golang.org/x/sync"
packages = ["semaphore"]
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[[projects]]
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable"
]
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
name = "google.golang.org/api"
packages = [
"googleapi/transport",
"internal",
"iterator",
"option",
"support/bundler",
"transport",
"transport/grpc",
"transport/http"
]
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
[[projects]]
name = "google.golang.org/appengine"
packages = [
".",
"internal",
"internal/app_identity",
"internal/base",
"internal/datastore",
"internal/log",
"internal/modules",
"internal/remote_api",
"internal/socket",
"internal/urlfetch",
"socket",
"urlfetch"
]
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
version = "v1.1.0"
[[projects]]
branch = "master"
name = "google.golang.org/genproto"
packages = [
"googleapis/api/annotations",
"googleapis/api/distribution",
"googleapis/api/label",
"googleapis/api/metric",
"googleapis/api/monitoredres",
"googleapis/devtools/cloudprofiler/v2",
"googleapis/devtools/cloudtrace/v2",
"googleapis/monitoring/v3",
"googleapis/rpc/errdetails",
"googleapis/rpc/status",
"protobuf/field_mask"
]
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
[[projects]]
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"credentials/oauth",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap"
]
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.14.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "c8e8e119ed16d97490ab7d949aa70654738f91a59da70583dfed22ee44661a1b"
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -0,0 +1,58 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "cloud.google.com/go"
version = "0.25.0"
[[constraint]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
version = "0.5.0"
[[constraint]]
name = "github.com/golang/protobuf"
version = "1.1.0"
[[constraint]]
name = "github.com/google/go-cmp"
version = "0.2.0"
[[constraint]]
name = "go.opencensus.io"
version = "0.14.0"
[[constraint]]
branch = "master"
name = "golang.org/x/net"
[[constraint]]
name = "google.golang.org/grpc"
version = "1.14.0"
[prune]
go-tests = true
unused-packages = true

View file

@ -0,0 +1,5 @@
# productcatalogservice
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only

View file

@ -25,11 +25,11 @@ import (
"strings" "strings"
"time" "time"
pb "./genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto"
"cloud.google.com/go/profiler" "cloud.google.com/go/profiler"
"contrib.go.opencensus.io/exporter/stackdriver"
"github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/jsonpb"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/trace" "go.opencensus.io/trace"
"google.golang.org/grpc" "google.golang.org/grpc"

View file

@ -18,7 +18,7 @@ import (
"context" "context"
"testing" "testing"
pb "./genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ocgrpc"

View file

@ -0,0 +1 @@
vendor/

View file

@ -1,25 +1,20 @@
FROM golang:1.10-alpine as builder FROM golang:1.10-alpine as builder
RUN apk add --no-cache \ RUN apk add --no-cache ca-certificates git && \
ca-certificates \ wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
git chmod +x /go/bin/dep
WORKDIR /src/microservices-demo/shippingservice
# get known dependencies
RUN go get -d golang.org/x/net/context \
google.golang.org/grpc \
google.golang.org/grpc/reflection \
go.opencensus.io/exporter/stackdriver \
go.opencensus.io/plugin/ocgrpc \
go.opencensus.io/trace \
cloud.google.com/go/profiler
ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice
WORKDIR /go/src/$PROJECT
# restore dependencies
COPY Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY . . COPY . .
# get other dependencies RUN go install .
RUN go get -d ./...
RUN go build -o /shippingservice .
FROM alpine as release FROM alpine as release
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=builder /shippingservice /shippingservice COPY --from=builder /go/bin/shippingservice /shippingservice
ENV APP_PORT=50051 ENV APP_PORT=50051
EXPOSE 50051 EXPOSE 50051
ENTRYPOINT ["/shippingservice"] ENTRYPOINT ["/shippingservice"]

View file

@ -1,23 +1,81 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "cloud.google.com/go"
packages = [
"compute/metadata",
"internal/version",
"monitoring/apiv3",
"profiler",
"trace/apiv2"
]
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
version = "v0.25.0"
[[projects]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
packages = [
".",
"propagation"
]
revision = "37aa2801fbf0205003e15636096ebf0373510288"
version = "v0.5.0"
[[projects]] [[projects]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
"proto", "proto",
"protoc-gen-go/descriptor",
"ptypes", "ptypes",
"ptypes/any", "ptypes/any",
"ptypes/duration", "ptypes/duration",
"ptypes/timestamp" "ptypes/empty",
"ptypes/struct",
"ptypes/timestamp",
"ptypes/wrappers"
] ]
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0" version = "v1.1.0"
[[projects]]
branch = "master"
name = "github.com/google/pprof"
packages = ["profile"]
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
[[projects]]
name = "github.com/googleapis/gax-go"
packages = ["."]
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
version = "v2.0.0"
[[projects]]
name = "go.opencensus.io"
packages = [
".",
"internal",
"internal/tagencoding",
"plugin/ocgrpc",
"plugin/ochttp",
"plugin/ochttp/propagation/b3",
"stats",
"stats/internal",
"stats/view",
"tag",
"trace",
"trace/internal",
"trace/propagation"
]
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
version = "v0.14.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = [ packages = [
"context", "context",
"context/ctxhttp",
"http/httpguts", "http/httpguts",
"http2", "http2",
"http2/hpack", "http2/hpack",
@ -25,7 +83,31 @@
"internal/timeseries", "internal/timeseries",
"trace" "trace"
] ]
revision = "a0f8a16cb08c06df97cbdf9c47f4731ba548c33c" revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
[[projects]]
branch = "master"
name = "golang.org/x/oauth2"
packages = [
".",
"google",
"internal",
"jws",
"jwt"
]
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
[[projects]]
branch = "master"
name = "golang.org/x/sync"
packages = ["semaphore"]
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -48,11 +130,57 @@
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0" version = "v0.3.0"
[[projects]]
branch = "master"
name = "google.golang.org/api"
packages = [
"googleapi/transport",
"internal",
"iterator",
"option",
"support/bundler",
"transport",
"transport/grpc",
"transport/http"
]
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
[[projects]]
name = "google.golang.org/appengine"
packages = [
".",
"internal",
"internal/app_identity",
"internal/base",
"internal/datastore",
"internal/log",
"internal/modules",
"internal/remote_api",
"internal/socket",
"internal/urlfetch",
"socket",
"urlfetch"
]
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
version = "v1.1.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "google.golang.org/genproto" name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"] packages = [
revision = "2a72893556e4d1f6c795a4c039314c9fa751eedb" "googleapis/api/annotations",
"googleapis/api/distribution",
"googleapis/api/label",
"googleapis/api/metric",
"googleapis/api/monitoredres",
"googleapis/devtools/cloudprofiler/v2",
"googleapis/devtools/cloudtrace/v2",
"googleapis/monitoring/v3",
"googleapis/rpc/errdetails",
"googleapis/rpc/status",
"protobuf/field_mask"
]
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
[[projects]] [[projects]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
@ -64,31 +192,35 @@
"codes", "codes",
"connectivity", "connectivity",
"credentials", "credentials",
"credentials/oauth",
"encoding", "encoding",
"encoding/proto", "encoding/proto",
"grpclog", "grpclog",
"internal", "internal",
"internal/backoff", "internal/backoff",
"internal/channelz", "internal/channelz",
"internal/envconfig",
"internal/grpcrand", "internal/grpcrand",
"internal/transport",
"keepalive", "keepalive",
"metadata", "metadata",
"naming", "naming",
"peer", "peer",
"reflection",
"reflection/grpc_reflection_v1alpha",
"resolver", "resolver",
"resolver/dns", "resolver/dns",
"resolver/passthrough", "resolver/passthrough",
"stats", "stats",
"status", "status",
"tap", "tap"
"transport"
] ]
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8" revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.13.0" version = "v1.14.0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "69c1f60bc47384c5523aa2d0d897f9d8e36194105e0b321186b34f50ac5468e5" inputs-digest = "3f4776192cec97ef87c4d20a52c9752d106a298befc139e5bca176bf915ed63b"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View file

@ -25,17 +25,29 @@
# unused-packages = true # unused-packages = true
[[constraint]]
name = "cloud.google.com/go"
version = "0.25.0"
[[constraint]]
name = "contrib.go.opencensus.io/exporter/stackdriver"
version = "0.5.0"
[[constraint]] [[constraint]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
version = "1.1.0" version = "1.1.0"
[[constraint]]
name = "go.opencensus.io"
version = "0.14.0"
[[constraint]] [[constraint]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
[[constraint]] [[constraint]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
version = "1.13.0" version = "1.14.0"
[prune] [prune]
go-tests = true go-tests = true

View file

@ -2,6 +2,12 @@
The Shipping service provides price quote, tracking IDs, and the impression of order fulfillment & shipping processes. The Shipping service provides price quote, tracking IDs, and the impression of order fulfillment & shipping processes.
## Local
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only
## Build ## Build
From repository root, run: From repository root, run:

View file

@ -22,14 +22,14 @@ import (
"time" "time"
"cloud.google.com/go/profiler" "cloud.google.com/go/profiler"
"go.opencensus.io/exporter/stackdriver" "contrib.go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/trace" "go.opencensus.io/trace"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/reflection" "google.golang.org/grpc/reflection"
pb "./genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice/genproto"
) )
const ( const (

View file

@ -19,7 +19,7 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
pb "./genproto" pb "github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice/genproto"
) )
// TestGetQuote is a basic check on the GetQuote RPC service. // TestGetQuote is a basic check on the GetQuote RPC service.