在Mac OS x中构建从Dep迁移到Go模块的Go项目时出错

Go version in my local is: go1.11.2 darwin/amd64 I tried to upgrade the go version in a project which was in go1.10

These are the steps I followed:

export GO111MODULE=on

go mod init

go mod tidy

rm -rf vendor/

go build

When I tried to build I get the following error

net clang: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' clang: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

I am running this on macOS Mojave.

After immediate googling and stack overflowing I tried xcode-select --install and xcode-select --switch /Library/Developer/CommandLineTools/ which didn't help either.

Even after upgrading software I am still facing this error. :(

However I was able to successfully build and run the go project through docker.

Any help would be most appreciated.