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
3
votes
2 answers

Not able to watch go files after installing Compile Daemon

Installed using, go get github.com/githubnemo/CompileDaemon and go install github.com/githubnemo/CompileDaemon When I try to run it using -> CompileDaemon --compile="./folderName" It gives -> zsh: command not found: CompileDaemon Note: I'm using…
3
votes
2 answers

Golang Module problem--package xxx/xxxx is not in GOROOT

so here is what my directory is: go |-src |-ppppppSample |-newFolderOne |-firstSample.go |-hello.go |-go.mod and here is the content of hello.go package main import ( "fmt" jjj…
3
votes
1 answer

How to make go search for packages in GOPATH while importing a package?

package main import ( "fmt" "controller/userhandler" //not able to import this custom package "github.com/gin-gonic/gin" "net/http" …
3
votes
1 answer

Go 1.11 ignores the `vendor` directory, the errors give the impression the directory is never even looked at

I'm having the issue of Go 1.11.4 ignoring the vendor directory of the project I'm in. When trying to run various commands, I get the following errors, even though the paths referenced are clearly present in the vendor directory. The error message…
cnst
  • 25,870
  • 6
  • 90
  • 122
3
votes
1 answer

Code in directory expects import

I have a package which is forked from a repository myproject. Inside the project, I want to use some functions from sha3 package, however, I need to first add a go file to sha3 package which contains some extra functionalities. I want to include…
A23149577
  • 2,045
  • 2
  • 40
  • 74
3
votes
3 answers

go ignoring vendor directory

Everything I read about the vendor directory gives me the understanding that if I have a directory: $GOPATH/src/vendor And put my dependencies in there (I am using godeps), when doing go run, go should check in that directory first. If I run my…
Joakim
  • 11,468
  • 9
  • 44
  • 50
2
votes
2 answers

hyperledger fabric - "go": executable file not found in $PATH

I 'm new to Hyperleger Fabric and trying to done examples from Using the Fabric test network documentation. I'm stuck on the phase of starting a chaincode on the channel. I am getting error located below even though I have adjusted paths properly. I…
2
votes
1 answer

When should you set the $GOPATH variable?

Can anyone explain when to set $GOPATH? I know it's in the default, C:\Users\Username\go, location, but what if all my coding projects live in Z: ?
2
votes
0 answers

vim-go: permission denied installing 'gopls'

I'm trying to setup the vim-go in a work environment but I don't have permission to install the gopls using: GoInstallBinaris or go get golang.org/x/tools/gopls@latest I'm getting this: /path/go/bin/gopls: permission denied Is there a way to fix…
Marcos Vidolin
  • 186
  • 4
  • 21
2
votes
3 answers

spf13/cobra can't download binary to $GOPATH/bin

I want to use spf13/cobra on my project. spf13/cobra: A Commander for modern Go CLI interactions typed install command result $ go get -u github.com/spf13/cobra/cobra go: downloading github.com/spf13/cobra v1.0.0 go: downloading…
nabeen
  • 434
  • 3
  • 12
2
votes
2 answers

Installing a package to GOPATH in directory with go.mod

I would like to install a package to GOPATH using go get. This became tricky with go tooling migrated to go mod support. There is no problem outside of the project directory (=directory with go.mod file). In the project directory, I would expect…
zdebra
  • 948
  • 8
  • 22
2
votes
2 answers

What is the reason to have GOPATH set to my workspace?

I read everywhere that my GOPATH must be set to my workspace. If I do that and use go get to get packages from for example GitHub, they are all added to my workspace though, which I don't find particularly useful because it clutters my workspace. In…
kramer65
  • 50,427
  • 120
  • 308
  • 488
2
votes
1 answer

Golang download and '$GOPATH not set'

I downloaded Golang 1.11.1, but in the terminal when I type go version, I get: go version go1.6.2 darwin/amd64. When I type which go in the terminal, I get: /usr/local/bin/go I can see in /usr/local that there is a go directory, and when I open the…
johndisk
  • 187
  • 1
  • 9
2
votes
1 answer

golang vendor path cannot find package

I'm building the example program from github.com/tarm/serial. Case 1: It builds ok if the above repo is checked out into $GOPATH/src/github.com/tarm/serial. Case 2: If the repo is moved under $GOPATH/src/vendor/github.com/tarm/serial the go build…
minghua
  • 5,981
  • 6
  • 45
  • 71
2
votes
1 answer

GOPATH in declarative Jenkinsfile

I'm setting up a Jenkins multibranch pipeline for our Go mono repo at work. How do I set the GOPATH so the go tool can find where Jenkins has fetched the repo? I've tried setting it with the environment syntax, like so: pipeline { agent { …
bordeltabernacle
  • 1,603
  • 5
  • 24
  • 46