Hello. I am quite new to golang so this might seem as a silly question, but how do you use goimports?
I’m using Ubuntu 14.04 and have installed golang using ~$ sudo apt-get install golang-go
And now I am trying to get the goimports tool but I’m constantly getting this: package runtime/trace: unrecognized import path "runtime/trace"
I believe there might be something wrong my environment variables but I’m not sure what. This is the output for go env: GOARCH="amd64" GOBIN="" GOCHAR="6" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/nedsteven/go" GORACE="" GOROOT="/usr/lib/go" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" TERM="dumb" CC="gcc" GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread" CXX="g++" CGO_ENABLED="1"
If you already installed the golang in your machine, you can follow this steps command in your terminal. It works on Linux and Mac machine.
// Your goproject folder
# mkdir project
// e.g your workspace is in your home directory
# export GOPATH=$HOME/User/project
// here, app is where your main.go located
# mkdir -p project/src/github.com/proj/app
// Create a main.go file
# touch project/src/github.com/proj/app/mcsag.go
# go install github.com/proj/app
// You can also add you exec app in bin path.
# export PATH=$HOME/User/project/bin:$PATH
// and run
# app