Skip to content

Commit

Permalink
make mockgen local (#152)
Browse files Browse the repository at this point in the history
- use full path to ./bin so mockgen-works
    - make goreleaser local aswell (now not pulling from releases, but
    installs)
    - force not using global goreleaser: the PATH now forces using the local
      binaries and not the global ones, unless you delete them
  • Loading branch information
georgettica authored Nov 2, 2021
1 parent 3657a2f commit bb55118
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 62 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ unexport GOFLAGS
# Add OSDCTL `./bin/` dir to path for goreleaser
# This will look for goreleaser first in the local bin dir
# but otherwise can be installed elsewhere on developers machines
export PATH := bin:$(PATH)
BASE_DIR=$(shell pwd)
export PATH:=$(BASE_DIR)/bin:$(PATH)
SHELL := env PATH=$(PATH) /bin/bash


all: format mod build test

Expand All @@ -16,9 +19,10 @@ fmt:
@git diff --exit-code .

OS := $(shell go env GOOS | sed 's/[a-z]/\U&/')
ARCH := $(shell go env GOARCH)
.PHONY: download-goreleaser
download-goreleaser:
mkdir -p ./bin && curl -sSLf https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_${OS}_x86_64.tar.gz -o - | tar --extract --gunzip --directory ./bin goreleaser
GOBIN=${BASE_DIR}/bin/ go install github.com/goreleaser/goreleaser@latest

# CI build containers don't include goreleaser by default,
# so they need to get it first, and then run the build
Expand All @@ -33,7 +37,7 @@ build:
goreleaser build --rm-dist --snapshot

release:
goreleaser release --rm-dist
./bin/goreleaser release --rm-dist

vet:
go vet ${BUILDFLAGS} ./...
Expand All @@ -51,7 +55,7 @@ mockgen: ensure-mockgen
@git diff --exit-code -- ./pkg/provider/aws/mock

ensure-mockgen:
go get github.com/golang/mock/mockgen@v1.5.0
GOBIN=${BASE_DIR}/bin/ go install github.com/golang/mock/mockgen@v1.5.0

test:
go test ${BUILDFLAGS} ./... -covermode=atomic -coverpkg=./...
9 changes: 0 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ go 1.16
require (
github.com/aws/aws-sdk-go v1.38.35
github.com/deckarep/golang-set v1.7.1
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/grokify/html-strip-tags-go v0.0.0-20200322061010-ea0c1cf2f119 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/onsi/gomega v1.13.0
Expand All @@ -26,16 +21,12 @@ require (
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.16.0 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.18.5
k8s.io/apimachinery v0.18.5
k8s.io/cli-runtime v0.18.3
Expand Down
Loading

0 comments on commit bb55118

Please sign in to comment.