Skip to content

Commit bb55118

Browse files
authored
make mockgen local (#152)
- 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
1 parent 3657a2f commit bb55118

File tree

3 files changed

+21
-62
lines changed

3 files changed

+21
-62
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ unexport GOFLAGS
44
# Add OSDCTL `./bin/` dir to path for goreleaser
55
# This will look for goreleaser first in the local bin dir
66
# but otherwise can be installed elsewhere on developers machines
7-
export PATH := bin:$(PATH)
7+
BASE_DIR=$(shell pwd)
8+
export PATH:=$(BASE_DIR)/bin:$(PATH)
9+
SHELL := env PATH=$(PATH) /bin/bash
10+
811

912
all: format mod build test
1013

@@ -16,9 +19,10 @@ fmt:
1619
@git diff --exit-code .
1720

1821
OS := $(shell go env GOOS | sed 's/[a-z]/\U&/')
22+
ARCH := $(shell go env GOARCH)
1923
.PHONY: download-goreleaser
2024
download-goreleaser:
21-
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
25+
GOBIN=${BASE_DIR}/bin/ go install github.com/goreleaser/goreleaser@latest
2226

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

3539
release:
36-
goreleaser release --rm-dist
40+
./bin/goreleaser release --rm-dist
3741

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

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

5660
test:
5761
go test ${BUILDFLAGS} ./... -covermode=atomic -coverpkg=./...

go.mod

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ go 1.16
55
require (
66
github.com/aws/aws-sdk-go v1.38.35
77
github.com/deckarep/golang-set v1.7.1
8-
github.com/fsnotify/fsnotify v1.4.9 // indirect
9-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
108
github.com/golang/mock v1.5.0
11-
github.com/golang/protobuf v1.5.2 // indirect
12-
github.com/google/uuid v1.2.0 // indirect
13-
github.com/grokify/html-strip-tags-go v0.0.0-20200322061010-ea0c1cf2f119 // indirect
149
github.com/imdario/mergo v0.3.12 // indirect
1510
github.com/kr/text v0.2.0 // indirect
1611
github.com/onsi/gomega v1.13.0
@@ -26,16 +21,12 @@ require (
2621
github.com/sirupsen/logrus v1.6.0
2722
github.com/spf13/cobra v1.1.3
2823
github.com/spf13/pflag v1.0.5
29-
github.com/stretchr/testify v1.7.0 // indirect
3024
go.uber.org/multierr v1.6.0 // indirect
3125
go.uber.org/zap v1.16.0 // indirect
32-
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
33-
golang.org/x/mod v0.4.2 // indirect
3426
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
3527
google.golang.org/appengine v1.6.7 // indirect
3628
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
3729
gopkg.in/yaml.v2 v2.4.0
38-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
3930
k8s.io/api v0.18.5
4031
k8s.io/apimachinery v0.18.5
4132
k8s.io/cli-runtime v0.18.3

0 commit comments

Comments
 (0)