Questions tagged [gopath]

The GOPATH environment variable is used to specify directories outside of $GOROOT that contain the source for Go projects and their binaries.

See the go command and go/build package documentation for more details.

99 questions
0
votes
1 answer

Resolve GOPATH value (Go 1.8+)

In Go 1.8+ the GOPATH environment variable is optional. When not set, GOPATH defaults to $HOME/go. Is there a variable or function in some standard library package that will show the final value of GOPATH (I'm hoping for something like…
Michael Whatcott
  • 5,603
  • 6
  • 36
  • 50
-1
votes
1 answer

How to fix wrong variables "go env GOROOT"?

I made a mistake: go env -w GOROOT=/Users/apple/Documents/testProject/GXB_be:/usr/local/go I set a wrong path as a variable of go env. This makes it almost impossible for me to use the go env command in the vscode terminal,so I cannot directly use…
baitao C
  • 21
  • 1
-1
votes
1 answer

Trouble with using gorilla/mux package in mac

I am trying to learn how to build a webserver using go and mux. I am importing mux to the main.go file as import github.com/gorilla/mux. However, when I am trying to run the code. I get the following error no required module provides package…
Michio Kaku
  • 49
  • 1
  • 6
-1
votes
1 answer

golang compile simple app module not found (GOPATH?)

just started with go, got stuck on a very simple application (from here https://golang.org/doc/tutorial/call-module-code) when I try to compile the hello.go: ... hello.go:6:5: cannot find module providing package example.com/greeting ... The env is…
-1
votes
1 answer

Use GOPATH in golang makefile or init go mod first?

I'm learning to write Golang makefile and got some confused me because some examples they config GO env such as GOOS, GOPATH, GOBASE before building. But normally I can use go mod init to create go module and in Makefile use go build to build my…
Quang
  • 135
  • 2
  • 9
-1
votes
1 answer

Go install copying permission denied

When running go install on my cmd folder I get the error: go install cmd/go: copying /var/folders/wh/9y99138n2w1bvcwxz3tbb8zw0000g n/T/go-build195667123/b150/exe/a.out: open /usr/local/go/bin/go: permission denied It looks like my env variables…
Jacob B
  • 694
  • 10
  • 21
-1
votes
2 answers

Cannot use Go Commands of go libraries. [$GOBIN or $GOPATH problem, Windows]

When I get go libraries from github, I can use them in code. But I cannot use their commands. For example, after "go get annie", I try to use its command, e.g."annie bebe.be/be/bebe". But I get "The term 'annie' is not recognized as the name of a…
Bekassyl
  • 45
  • 7
-1
votes
1 answer

When running go env GOPATH is shown as something different than what I have set in my environment variables?

First of all I'm really new to Go. I've been struggling with this issue for about a week now and its driving me crazy (because of this issue its not recognizing my packages). I have set up my GOPATH in environment variables: When I run go env at…
sam2013
  • 21
  • 1
  • 4
-1
votes
1 answer

Installing gota package in go workspace

I'm writing this away from my code so fingers crossed. I've recently started learning Go from a Python background. I've set up my workspace (Linux Mint OS) so: GOPATH=$HOME/go GOROOT=/usr/local/go Where under $HOME i have a dir called go and 3…
Alesi Rowland
  • 379
  • 2
  • 16
-1
votes
2 answers

installed 'go1.13.3.darwin-amd64.pkg' on mac os. Set GOPATH, PATH, GOROOT env variables. But Go doestn't seem to be installed

I installed go1.13.3.darwin-amd64.pkg on Mac. I set env variables in ~/.bash_profile GOPATH = $HOME/gocode GOROOT = /usr/local/go PATH = $PATH:$GOPATH/bin saved the edits with source /.bash_profile. Checked go version on terminal. But i don't see a…
pretty08
  • 137
  • 3
  • 11
-1
votes
1 answer

goapp test not working,getting error "GOPATH must be absolute" while it is absolute

I'm tying to write tests for my google cloud app. I read the documents and it seems the only way to run the test locally is the running the command goapp test in the test package directory. But when I run the command I get the error go: GOPATH entry…
Mohi_k
  • 11
  • 8
-1
votes
1 answer

Is this a valid Go path config?

I've placed my path variables as follows: export GOROOT=/usr/local/go export GOPATH=$HOME/Professional/Sch/Fabric/go export GOBIN=/usr/local/go/bin export PATH=$PATH:$GOROOT/bin:$GOPATH/bin I've placed these lines in both ~/.profile and ~/.bashrc…
Anon E Mous
  • 251
  • 2
  • 10
-1
votes
1 answer

`go get` command fails: unrecognized import path "_/"

Basically, my question is, why is it putting an underscore in front of my import path? It says import path does not begin with hostname which I'm assuming is because it starts with an underscore. I read somewhere this may have something to do with…
FyZyX
  • 185
  • 1
  • 11
-1
votes
2 answers

GOPATH interpreted differently when calling directly versus Python subprocess

I recently found a fix for Python getpass not working on Windows: Python not working in the command line of git bash Or at least that was the last thing I remember about changing my python configurations. (This is for Python 3.6.1 on Windows 10) Now…
Cit5
  • 400
  • 5
  • 19
-1
votes
1 answer

golang error when serving static files

I can't figure out this error in go lang when executing a template panic: open templates/*.html: The system cannot find the path specified. another problem is that my public folder can't be served from css and I don't know why. code: package…
Ahmed Nader
  • 151
  • 5
  • 19