title: Gopls only works if I execute vim or vscode with sudo in Macos Big Sur
body: <p>For some reason, whenever I execute a Go file with vscode or vim (using coc), I'd get errors such as &quot;could not import fmt&quot;, unless I execute both editors with sudo, as shown in images below:</p>
  <p>Without sudo:
  <a href="https://i.stack.imgur.com/JvTmr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JvTmr.png" alt="Without sudo" /></a></p>
  <p>With sudo (as you see, I even get documentation about functions):
  <a href="https://i.stack.imgur.com/NsFk2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NsFk2.png" alt="With sudo" /></a></p>
  <p>I'm aware that this might be a permissions issue, but I don't know how to fix this.</p>
  <p>This is my go env:</p>
  <pre><code>GO111MODULE=&quot;&quot;
  GOARCH=&quot;arm64&quot;
  GOBIN=&quot;&quot;
  GOCACHE=&quot;/Users/beepstreet/Library/Caches/go-build&quot;
  GOENV=&quot;/Users/beepstreet/Library/Application Support/go/env&quot;
  GOEXE=&quot;&quot;
  GOFLAGS=&quot;&quot;
  GOHOSTARCH=&quot;arm64&quot;
  GOHOSTOS=&quot;darwin&quot;
  GOINSECURE=&quot;&quot;
  GOMODCACHE=&quot;/Users/beepstreet/go/pkg/mod&quot;
  GONOPROXY=&quot;&quot;
  GONOSUMDB=&quot;&quot;
  GOOS=&quot;darwin&quot;
  GOPATH=&quot;/Users/beepstreet/go&quot;
  GOPRIVATE=&quot;&quot;
  GOPROXY=&quot;https://proxy.golang.org,direct&quot;
  GOROOT=&quot;/opt/homebrew/Cellar/go/1.16.3/libexec&quot;
  GOSUMDB=&quot;sum.golang.org&quot;
  GOTMPDIR=&quot;&quot;
  GOTOOLDIR=&quot;/opt/homebrew/Cellar/go/1.16.3/libexec/pkg/tool/darwin_arm64&quot;
  GOVCS=&quot;&quot;
  GOVERSION=&quot;go1.16.3&quot;
  GCCGO=&quot;gccgo&quot;
  AR=&quot;ar&quot;
  CC=&quot;clang&quot;
  CXX=&quot;clang++&quot;
  CGO_ENABLED=&quot;1&quot;
  GOMOD=&quot;/dev/null&quot;
  CGO_CFLAGS=&quot;-g -O2&quot;
  CGO_CPPFLAGS=&quot;&quot;
  CGO_CXXFLAGS=&quot;-g -O2&quot;
  CGO_FFLAGS=&quot;-g -O2&quot;
  CGO_LDFLAGS=&quot;-g -O2&quot;
  PKG_CONFIG=&quot;pkg-config&quot;
  GOGCCFLAGS=&quot;-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/45/phdw7kg55g39w7jq9vg95m700000gn/T/go-build1507809915=/tmp/go-build -gno-record-gcc-switches -fno-common&quot;
  </code></pre>