Goimports not working

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"

Hey! You always can install manually
Download go archive

sudo tar -xvf go1.x.linux-amd64.tar.gz
sudo mv go /usr/local
nano ./~profile (or ~./profile)

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
source ./~profile

Sorry for mistakes in commands no linux machine now)
and all works!

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.