-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable go modules #124
Merged
Merged
Enable go modules #124
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d62168f
move to go modules from Glide (#57)
stevesloka 06c8698
fix Makefile to use go modules (#57)
stevesloka bc7c80a
update README.md for repo move to envoyproxy/ratelimit (#57)
stevesloka 2522547
update docker-compose to work with go modules (#57)
stevesloka 4ebca9e
update Dockerfile for go modules (#57)
stevesloka e4d005f
update travis for go 1.14 (#57)
stevesloka 870b332
Fix up review comments by removing unused references from Makefile an…
stevesloka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,8 @@ cover.out | |
bin/ | ||
.idea/ | ||
vendor | ||
cert.pem | ||
key.pem | ||
private.pem | ||
redis-per-second.conf | ||
redis.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
FROM golang:1.10.4 AS build | ||
WORKDIR /go/src/github.com/lyft/ratelimit | ||
FROM golang:1.14 AS build | ||
WORKDIR /ratelimit | ||
|
||
ENV GOPROXY=https://proxy.golang.org | ||
COPY go.mod go.sum /ratelimit/ | ||
RUN go mod download | ||
|
||
COPY src src | ||
COPY script script | ||
COPY vendor vendor | ||
COPY glide.yaml glide.yaml | ||
COPY glide.lock glide.lock | ||
COPY proto proto | ||
|
||
RUN script/install-glide | ||
RUN glide install | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/ratelimit -ldflags="-w -s" -v github.com/lyft/ratelimit/src/service_cmd | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/ratelimit -ldflags="-w -s" -v github.com/envoyproxy/ratelimit/src/service_cmd | ||
|
||
FROM alpine:3.8 AS final | ||
FROM alpine:3.11 AS final | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=build /usr/local/bin/ratelimit /bin/ratelimit | ||
COPY --from=build /go/bin/ratelimit /bin/ratelimit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
ifeq ("$(GOPATH)","") | ||
$(error GOPATH must be set) | ||
endif | ||
export GO111MODULE=on | ||
MODULE = github.com/envoyproxy/ratelimit | ||
|
||
SHELL := /bin/bash | ||
GOREPO := ${GOPATH}/src/github.com/lyft/ratelimit | ||
|
||
.PHONY: bootstrap | ||
bootstrap: | ||
script/install-glide | ||
glide install | ||
go get github.com/golang/mock/[email protected] | ||
|
||
.PHONY: bootstrap_tests | ||
bootstrap_tests: | ||
cd ./vendor/github.com/golang/mock/mockgen && go install | ||
define REDIS_STUNNEL | ||
cert = private.pem | ||
pid = /var/run/stunnel.pid | ||
|
@@ -33,6 +27,7 @@ redis.conf: | |
echo "$$REDIS_STUNNEL" >> $@ | ||
redis-per-second.conf: | ||
echo "$$REDIS_PER_SECOND_STUNNEL" >> $@ | ||
|
||
.PHONY: bootstrap_redis_tls | ||
bootstrap_redis_tls: redis.conf redis-per-second.conf | ||
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \ | ||
|
@@ -51,27 +46,27 @@ docs_format: | |
.PHONY: fix_format | ||
fix_format: | ||
script/docs_fix_format | ||
go fmt $(shell glide nv) | ||
go fmt $(MODULE)/... | ||
|
||
.PHONY: check_format | ||
check_format: docs_format | ||
@gofmt -l $(shell glide nv | sed 's/\.\.\.//g') | tee /dev/stderr | read && echo "Files failed gofmt" && exit 1 || true | ||
@gofmt -l $(shell go list -f '{{.Dir}}' ./...) | tee /dev/stderr | read && echo "Files failed gofmt" && exit 1 || true | ||
|
||
.PHONY: compile | ||
compile: | ||
mkdir -p ${GOREPO}/bin | ||
cd ${GOREPO}/src/service_cmd && go build -o ratelimit ./ && mv ./ratelimit ${GOREPO}/bin | ||
cd ${GOREPO}/src/client_cmd && go build -o ratelimit_client ./ && mv ./ratelimit_client ${GOREPO}/bin | ||
cd ${GOREPO}/src/config_check_cmd && go build -o ratelimit_config_check ./ && mv ./ratelimit_config_check ${GOREPO}/bin | ||
mkdir -p ./bin | ||
go build -mod=readonly -o ./bin/ratelimit $(MODULE)/src/service_cmd | ||
go build -mod=readonly -o ./bin/ratelimit_client $(MODULE)/src/client_cmd | ||
go build -mod=readonly -o ./bin/ratelimit_config_check $(MODULE)/src/config_check_cmd | ||
|
||
.PHONY: tests_unit | ||
tests_unit: compile | ||
go test -race ./... | ||
go test -race $(MODULE)/... | ||
|
||
.PHONY: tests | ||
tests: compile | ||
go test -race -tags=integration ./... | ||
go test -race -tags=integration $(MODULE)/... | ||
|
||
.PHONY: docker | ||
docker: tests | ||
docker build . -t lyft/ratelimit:`git rev-parse HEAD` | ||
docker build . -t envoyproxy/ratelimit:`git rev-parse HEAD` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, not terribly familiar with go modules. Why is this needed in docker but not in the makefile for local builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a mirror that can be used to speed up module downloads. We use it in Contour.