Skip to content
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

Switch to go modules #11

Merged
merged 4 commits into from
Jan 13, 2020
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
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- repo: git://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-fmt
- id: go-vet
- id: go-imports
- id: validate-toml
- repo: local
hooks:
- id: go-mod-tidy
name: 'go mod tidy'
entry: custom-hooks/go-mod-tidy.sh
files: '(\.go)|(\.mod)|(\.sum)$'
language: 'script'
description: "Runs `gofmt`, requires golang"
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
# Builder #
###########

FROM golang:1.11-alpine AS builder
FROM golang:1.12-alpine AS builder

RUN apk add --no-cache git

COPY . $GOPATH/src/github.com/rb3ckers/trafficmirror
COPY . /build

WORKDIR $GOPATH/src/github.com/rb3ckers/trafficmirror
WORKDIR /build

RUN set -ex \
&& go get -u -v github.com/golang/dep/cmd/dep \
&& dep ensure -v \
&& GOOS=linux GOARCH=amd64 go build -o /build/trafficmirror

RUN /build/trafficmirror --help
Expand Down
17 changes: 0 additions & 17 deletions Gopkg.lock

This file was deleted.

8 changes: 0 additions & 8 deletions Gopkg.toml

This file was deleted.

11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ The list command should become:

## Error behavior
While a target is available and responding to requests it will keep on receiving mirrored data. However when it starts failing, either returning errors or maybe it is down, the target will temporarily not receive any traffic anymore. After a minute (see the `retry-after` option) it will be retried with a single request, if this succeeds it will start receiving traffic again. If a target is persistently failing for 30 minutes (see `fail-after` option) it will be automatically removed from the set of targets and will need to be added manually again if the situation has been resolved.


# Developing
This repository uses Pre-commit to run some basic go linting and checks. Please install it when developing.
```
brew install pre-commit # install pre-commit if you haven't already
pre-commit install # install the hooks in your local clone
```
12 changes: 0 additions & 12 deletions build-env.sh

This file was deleted.

4 changes: 4 additions & 0 deletions custom-hooks/go-mod-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
set -e

go mod tidy
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/rb3ckers/trafficmirror

go 1.12

require github.com/sony/gobreaker v0.4.1
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/sony/gobreaker v0.4.1 h1:oMnRNZXX5j85zso6xCPRNPtmAycat+WcoKbklScLDgQ=
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=