Skip to content

Commit

Permalink
Improvement on make install-terraformrc goal
Browse files Browse the repository at this point in the history
Newer go installations doesn't require to explicitly set up the GOPATH.
To make managing the GOHOME more flexible the `install-terraformrc` and `check-go` targets have been improved.
  • Loading branch information
Viktor Csomor committed Dec 19, 2024
1 parent be3b4b4 commit 199a1f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .terraformrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
provider_installation {

dev_overrides {
"cloudera/cdp" = "/Users/_USERNAME_/go/bin"
"cloudera/cdp" = "__GOHOME__/bin"
}

# For all other providers, install them directly from their origin provider
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

GO_FLAGS:=""
TESTARGS:=""
GOPATH ?= $(shell go env GOPATH)

all: check-go test main

check-go:
ifndef GOPATH
ifeq ($(GOPATH),)
$(error GOPATH not defined, please define GOPATH. Run "go help gopath" to learn more about GOPATH)
else
@echo "The GOPATH is OK: $(GOPATH)"
endif

# Run tests
Expand Down Expand Up @@ -49,8 +52,8 @@ install: main
go install .

# for local development
install-terraformrc:
cp -iv .terraformrc ~/.terraformrc && sed -i -e 's/_USERNAME_/$(USER)/g' ~/.terraformrc
install-terraformrc: check-go
cp -iv .terraformrc ~/.terraformrc && sed -i -e 's%__GOHOME__%${GOPATH}%g' ~/.terraformrc

# Make a release
release: test testacc docs
Expand Down

0 comments on commit 199a1f7

Please sign in to comment.