<p>I am trying to create an operator using operator-sdk.</p>
<p>I have installed opeator-sdk on my mac OS.</p>
<p>My Environment Details :</p>
<p>go version <strong>go1.15.12 darwin/amd64</strong></p>
<p>operator-sdk version: <strong>&quot;v1.7.2&quot;, commit: &quot;6db9787d4e9ff63f344e23bfa387133112bda56b&quot;, kubernetes version: &quot;v1.19.4&quot;, go version: &quot;go1.16.3&quot;, GOOS: &quot;darwin&quot;, GOARCH: &quot;amd64&quot;</strong></p>
<p>I am trying to create an operator using command -</p>
<pre><code>operator-sdk init hello-operator
</code></pre>
<p>I have enabled GO111MODULE.</p>
<p>When I am trying to run opeator-sdk init , I am getting following error.</p>
<pre><code>Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
Get controller runtime:
$ go get sigs.k8s.io/controller-runtime@v0.8.3
# container/list
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# crypto/internal/subtle
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# unicode/utf8
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# internal/race
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# k8s.io/apimachinery/pkg/selection
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# encoding
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# unicode/utf16
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# internal/nettrace
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# math/bits
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# runtime/internal/sys
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# internal/unsafeheader
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# unicode
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# vendor/golang.org/x/crypto/internal/subtle
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# crypto/subtle
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# vendor/golang.org/x/crypto/cryptobyte/asn1
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# golang.org/x/sys/internal/unsafeheader
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# runtime/internal/atomic
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# google.golang.org/protobuf/internal/flags
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# github.com/google/go-cmp/cmp/internal/flags
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# k8s.io/utils/integer
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# k8s.io/utils/buffer
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# internal/cpu
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# k8s.io/apimachinery/pkg/types
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# sync/atomic
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
# runtime/cgo
compile: version &quot;go1.15.6&quot; does not match go tool version &quot;go1.15.12&quot;
Error: failed to initialize project: unable to scaffold with &quot;base.go.kubebuilder.io/v3&quot;: exit status 2

FATA[0003] failed to initialize project: unable to scaffold with &quot;base.go.kubebuilder.io/v3&quot;: exit status 2
</code></pre>
<p>Does anybody has any idea about this?</p>
<p>Thanks in advance.</p>

Rajendra Gosavi
<p>The bellow commands show how you can run and scaffold an operator with the <code>operator-sdk</code> CLI tool. As of writing the latest version is v1.20.0. It covers some of the pitfalls such as setting the correct GO environment variables and installing the gcc for some OS. I tried it with <code>Ubuntu 18.04.3 LTS (Bionic Beaver)</code></p>
<pre class="lang-sh prettyprint-override"><code>#golang
echo &quot;--- Installing golang ---&quot;

GOVERSION=1.17.9
GOTAR=go$GOVERSION.linux-amd64.tar.gz
wget https://dl.google.com/go/$GOTAR
sudo tar -xvf $GOTAR
rm $GOTAR

sudo mv go /usr/local/bin

#gcc (used by operator-sdk CLI)
echo &quot;--- Installing gcc ---&quot;

sudo apt update
sudo apt install -y build-essential
sudo apt-get install manpages-dev

#operator-sdk
echo &quot;--- Installing operator-sdk ---&quot;

curl -Lo ./operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.20.0/operator-sdk_linux_amd64
chmod +x ./operator-sdk
sudo mv ./operator-sdk /usr/local/bin/operator-sdk

#environment variables
export GOROOT=/usr/local/bin/go
export PATH=$GOROOT/bin:$PATH

#verify versions
go version
operator-sdk version

#scaffold and run the HelloWorld operator
sudo -s
mkdir hello-operator
chmod 777 hello-operator
cd hello-operator

operator-sdk init --domain example.com --repo github.com/example/memcached-operator

operator-sdk create api --group example --version v1alpha1 --kind HelloWorld --resource --controller

make manifests
make run
</code></pre>
