From edea4a2a361f93e6d23bb56e2c31dcde17495619 Mon Sep 17 00:00:00 2001
From: Ian Howell <ian.howell0@gmail.com>
Date: Wed, 20 Jan 2021 09:38:31 -0600
Subject: [PATCH] Suppress the "go command not found" message

When a make target is run, make will try to find the GOBIN using a go
command. If go isn't installed, the user sees the message:

  /bin/bash: go: command not found

This can be confusing, especially when a docker-image target is being
run. This change suppresses that message.

Change-Id: Ie27a4a82a3692db60445601febf3bd51f956d575
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 0fa66c96b..ec3a86bf0 100644
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,10 @@ GIT_MODULE          ?= opendev.org/airship/airshipctl/pkg/version
 GO_FLAGS            := -ldflags '-extldflags "-static"' -tags=netgo -trimpath
 GO_FLAGS            += -ldflags "-X ${GIT_MODULE}.gitVersion=${GIT_VERSION}"
 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
-ifeq (,$(shell go env GOBIN))
-GOBIN = $(shell go env GOPATH)/bin
+ifeq (,$(shell go env GOBIN 2> /dev/null))
+GOBIN = $(shell go env GOPATH 2> /dev/null)/bin
 else
-GOBIN = $(shell go env GOBIN)
+GOBIN = $(shell go env GOBIN 2> /dev/null)
 endif
 
 BINDIR              := bin