package io/fs is not in GOROOT while building the go project

Issue

I don’t have much experience in go but I have been tasked to execute a go project 🙂

So i need to build the go project and then execute it

Below is the error when i build the go project. Seems to be some dependency(package and io/fs) is missing

transform/transform.go:13:2: package embed is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/embed)
pkg/util/fs.go:4:2: package io/fs is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/io/fs)

my go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<XXXXX>/Library/Caches/go-build"
GOENV="/Users/<XXXXX>/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<XXXXX>/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/<XXXXX>/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.8/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<location to the project>/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5h/9qptf0sx3c12226jnqt75q8r0000gp/T/go-build648466970=/tmp/go-build -gno-record-gcc-switches -fno-common"

Solution

This package requires go v1.16, please upgrade your go version or use the appropriate docker builder.

Answered By – Oleg Butuzov

Answer Checked By – Jay B. (GoLangFix Admin)

Leave a Reply

Your email address will not be published.