Skip to content

Commit

Permalink
Use go modules for dependencies (#43)
Browse files Browse the repository at this point in the history
* Use go modules for dependencies

* PR feedback: put back include in Makefile
It is necessary for travis because it uses Makefile targets in build-harness

* PR Feedback: Fix .travis.yml
Since make targets are based on go modules, travis.yml
definition needs to change appropriately to no longer
use godep and glide.
  • Loading branch information
bernata authored Nov 6, 2020
1 parent db8ccea commit 14ca4c0
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 36 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: required

language: go
go:
- 1.9.x
- 1.14.x

addons:
apt:
Expand All @@ -20,14 +20,10 @@ services:
install:
- make init
- make travis/docker-login
- make go/deps-build
- make go/deps-dev
- make go-get

script:
- make go/deps
- make go/test
- make go/lint
- make lint
- make go/build-all
- ls -l release/
- make docker/build
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13.11 as builder
FROM golang:1.14.3 as builder
RUN mkdir -p /go/src/github.com/cloudposse/prometheus-to-cloudwatch
WORKDIR /go/src/github.com/cloudposse/prometheus-to-cloudwatch
COPY . .
Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
SHELL = /bin/bash

PATH:=$(PATH):$(GOPATH)/bin

include $(shell curl --silent -o .build-harness "https://raw.githubusercontent.com/cloudposse/build-harness/master/templates/Makefile.build-harness"; echo .build-harness)

.PHONY : go-build
go-build:
CGO_ENABLED=0 go build -v -o "./dist/bin/prometheus-to-cloudwatch" *.go

## Lint code
lint: $(GO) vet
$(call assert-set,GO)
find . ! -path "*/vendor/*" ! -path "*/.glide/*" -type f -name '*.go' | xargs -n 1 golint

.PHONY : go-get
go-get:
go get
## Vet code
vet: $(GO)
$(call assert-set,GO)
find . ! -path "*/vendor/*" ! -path "*/.glide/*" -type f -name '*.go' | xargs $(GO) vet -v


.PHONY : go-build
go-build: go-get
CGO_ENABLED=0 go build -v -o "./dist/bin/prometheus-to-cloudwatch" *.go
21 changes: 0 additions & 21 deletions glide.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/cloudposse/prometheus-to-cloudwatch

go 1.14

require (
github.com/aws/aws-sdk-go v1.35.21 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/prometheus/common v0.14.0 // indirect
)
Loading

0 comments on commit 14ca4c0

Please sign in to comment.