Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GOPATH error in windows "GOPATH entry is relative; must be absolute path: "

Tags:

go

I am new to GO and getting an error when initializing GOPATH in windows. In my project folder is

C:\Users\kamin\Documents\pm-manager

and i am try to set path in environment variable (GOPATH)but it is getting an error go: GOPATH entry is relative; must be absolute path: ":/cygdrive/c/Users/kamin/Documents/pm-manager\r\r". Run 'go help gopath' for usage.

like image 638
Sandun Tharaka Avatar asked Mar 09 '16 06:03

Sandun Tharaka


2 Answers

Ran into same problem. Fix is quite simple: just specify the drive in front of the entire path name. The issue occurred because I was following the instructions on Go "Getting Started" page and set GOPATH=%HOMEPATH%\Work . The problem was that %HOMEPATH% was defined as a relative path (\Users\MyName), and so GOPATH now pointed to \Users\MyName\Work . All I needed to do was set GOPATH=c:\Users\MyName\Work and the error goes away.

like image 179
LNI Avatar answered Nov 08 '22 22:11

LNI


I encountered the same problem. My go version is go1.9.1 windows/amd64. However I fixed the problem by deleting the simucolon end of the GOPATH. enter image description here

like image 7
pigLoveRabbit520 Avatar answered Nov 08 '22 23:11

pigLoveRabbit520