Not able to run go commands with normal user

Hi,
I successfully installed Go using brew install go command and I can see the version.

Lakshminarayanas-MacBook-Pro:$ go version 
go1.22.5 darwin/arm64

If I run any go simple code with printing Hello, it’s throwing permission denied error.

Lakshminarayanas-MacBook-Pro:LearnGo bharadwajsattaru$ go run test.go 
failed to initialize build cache at /Users/bharadwajsattaru/Library/Caches/go-build: mkdir /Users/bharadwajsattaru/Library/Caches/go-build/00: permission denied

If I use sudo go run file.go , then it’s working fine.Can someone please help me to execute these commands without sudo ?

output of go env

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/bharadwajsattaru/Library/Caches/go-build'
GOENV='/Users/bharadwajsattaru/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/bharadwajsattaru/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/bharadwajsattaru/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.5/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.5/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/pn/f_6sx_c10pz1nwf_48h8j91c0000gn/T/go-build46492072=/tmp/go-build -gno-record-gcc-switches -fno-common'

Thanks.

It’s a permissions issue. Check out this answer for a fix:

This resolved my issue.
Thank you @Dean_Davidson