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
FROM golang:1.10 as builder
WORKDIR /src/microservices-demo/cartservice/probe
COPY probe/ .
RUN go get -d ./...
RUN 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/cartservice/probe
WORKDIR /go/src/$PROJECT
COPY probe/Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY ./probe ./
RUN go build -o /cartservice_probe .
# 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"
"time"
pb "./genproto"
pb "github.com/GoogleCloudPlatform/microservices-demo/src/cartservice/probe/genproto"
"go.opencensus.io/plugin/ocgrpc"
"google.golang.org/grpc"
)
@ -38,7 +37,6 @@ func main() {
grpc.WithBlock(),
grpc.WithTimeout(time.Second*3),
grpc.WithInsecure(),
grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
)
if err != nil {
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
RUN apk add --no-cache ca-certificates git
WORKDIR /go/src/checkoutservice
RUN apk add --no-cache ca-certificates git && \
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 . .
# get remaining dependencies
RUN go get -d ./...
RUN go build -gcflags='-N -l' -o /checkoutservice .
FROM alpine as release

View file

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

View file

@ -29,6 +29,10 @@
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"
@ -47,7 +51,7 @@
[[constraint]]
name = "google.golang.org/grpc"
version = "1.13.0"
version = "1.14.0"
[prune]
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"
"cloud.google.com/go/profiler"
"contrib.go.opencensus.io/exporter/stackdriver"
"github.com/google/uuid"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/trace"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
pb "checkoutservice/genproto"
money "checkoutservice/money"
pb "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto"
money "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/money"
)
const (

View file

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

View file

@ -19,7 +19,7 @@ import (
"reflect"
"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} }

View file

@ -1,32 +1,17 @@
FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates git
WORKDIR /go/src/frontend
RUN apk add --no-cache ca-certificates git && \
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
RUN go get -d github.com/google/uuid \
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
ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/frontend
WORKDIR /go/src/$PROJECT
# copy go-only part of the build
COPY *.go ./
COPY ./genproto ./genproto
COPY ./money ./money
# fetch other dependencies might not have listed above (ideally noop)
RUN go get -d ./...
# restore dependencies
COPY Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY . .
RUN go install .
# ---
FROM alpine as release
RUN apk add --no-cache ca-certificates \
busybox-extras net-tools bind-tools

View file

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

View file

@ -29,6 +29,10 @@
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"
@ -59,7 +63,7 @@
[[constraint]]
name = "google.golang.org/grpc"
version = "1.13.0"
version = "1.14.0"
[prune]
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 (
"fmt"
"frontend/money"
"html/template"
"net/http"
"os"
@ -27,7 +26,8 @@ import (
"github.com/pkg/errors"
"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 (

View file

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

View file

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

View file

@ -19,7 +19,7 @@ import (
"reflect"
"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} }

View file

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

View file

@ -0,0 +1 @@
vendor/

View file

@ -1,20 +1,16 @@
FROM golang:1.10-alpine as builder
RUN apk add --no-cache \
ca-certificates \
git
WORKDIR /src/microservices-demo/productcatalogservice
# get known dependencies
RUN go get -d google.golang.org/grpc \
google.golang.org/grpc/codes \
google.golang.org/grpc/status \
go.opencensus.io/plugin/ocgrpc \
go.opencensus.io/trace \
go.opencensus.io/exporter/stackdriver \
cloud.google.com/go/profiler
RUN apk add --no-cache ca-certificates git && \
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/productcatalogservice
WORKDIR /go/src/$PROJECT
# restore dependencies
COPY Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY . .
# get remaining dependencies
RUN go get -d ./...
RUN go build -o /productcatalogservice .
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"
"time"
pb "./genproto"
pb "github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto"
"cloud.google.com/go/profiler"
"contrib.go.opencensus.io/exporter/stackdriver"
"github.com/golang/protobuf/jsonpb"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/plugin/ocgrpc"
"go.opencensus.io/trace"
"google.golang.org/grpc"

View file

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

View file

@ -0,0 +1 @@
vendor/

View file

@ -1,25 +1,20 @@
FROM golang:1.10-alpine as builder
RUN apk add --no-cache \
ca-certificates \
git
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
RUN apk add --no-cache ca-certificates git && \
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/shippingservice
WORKDIR /go/src/$PROJECT
# restore dependencies
COPY Gopkg.* ./
RUN dep ensure --vendor-only -v
COPY . .
# get other dependencies
RUN go get -d ./...
RUN go build -o /shippingservice .
RUN go install .
FROM alpine as release
RUN apk add --no-cache ca-certificates
COPY --from=builder /shippingservice /shippingservice
COPY --from=builder /go/bin/shippingservice /shippingservice
ENV APP_PORT=50051
EXPOSE 50051
ENTRYPOINT ["/shippingservice"]

View file

@ -1,23 +1,81 @@
# 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 = [
"proto",
"protoc-gen-go/descriptor",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/timestamp"
"ptypes/empty",
"ptypes/struct",
"ptypes/timestamp",
"ptypes/wrappers"
]
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
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]]
branch = "master"
name = "golang.org/x/net"
packages = [
"context",
"context/ctxhttp",
"http/httpguts",
"http2",
"http2/hpack",
@ -25,7 +83,31 @@
"internal/timeseries",
"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]]
name = "golang.org/x/text"
@ -48,11 +130,57 @@
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/rpc/status"]
revision = "2a72893556e4d1f6c795a4c039314c9fa751eedb"
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"
@ -64,31 +192,35 @@
"codes",
"connectivity",
"credentials",
"credentials/oauth",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"reflection",
"reflection/grpc_reflection_v1alpha",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
"transport"
"tap"
]
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
version = "v1.13.0"
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
version = "v1.14.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "69c1f60bc47384c5523aa2d0d897f9d8e36194105e0b321186b34f50ac5468e5"
inputs-digest = "3f4776192cec97ef87c4d20a52c9752d106a298befc139e5bca176bf915ed63b"
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -25,17 +25,29 @@
# 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 = "go.opencensus.io"
version = "0.14.0"
[[constraint]]
branch = "master"
name = "golang.org/x/net"
[[constraint]]
name = "google.golang.org/grpc"
version = "1.13.0"
version = "1.14.0"
[prune]
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.
## Local
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only
## Build
From repository root, run:

View file

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

View file

@ -19,7 +19,7 @@ import (
"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.