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

go build not looking in $GOPATH

I have set $GOPATH, and importing some part of my source code which is present in $GOPATH/src. Package I need to import is written by me and stored in GOPATH/src I have named it as otelkafkago and it's path is GOPATH/src/otelkafkago I have one more…
Kshitij Patil
  • 86
  • 1
  • 8
0
votes
3 answers

Problem in setting the value of GOPATH on windows machine

My GOROOT path :- C:\Go I have set GOPATH to :- C:\Users\kunal\go But when I import modules (like github.com/gorilla/mux) inside VS Code. VS Code prompts me this error :- could not import github.com/gorilla/mux (cannot find package…
0
votes
1 answer

Go pkg/mod vs pkg/windowsamd_64 on go build

I am beginner in go and facing difficulty in understanding go/pkg folder.As suggested by documentation it contains pkg/mod and pkg/windowsamd_64. pkg/windowsamd_64 for storing compiled files. What happens if I have a file importing some external…
0
votes
1 answer

How to distinct what dependencies are downloadable?

I use this code to get a list of dependencies imported in a single Go source file: // GetFileImports returns all the imports from the Golang source code file. func GetFileImports(filepath string) ([]string, error) { fset := token.NewFileSet() …
zergon321
  • 210
  • 1
  • 10
0
votes
0 answers

can't load package: C:\Go\src\"application"\db.go:10:2: non-standard import "github.com/boltdb/bolt" in standard package "application"

I'm new to coding so I'm sure my mistake is something simple. I'm trying to install an application from github.com/benbjohnson/roommate. I have installed go and am able to get the file. go get github.com/boltdb/bolt/... However, when I try to…
0
votes
1 answer

Getting full path to a package source from the package import path

Currently I have a parameter like str := "github.com/pkg/errors". I need the full path to the package. Currently how I achieve this is by using build.Default.GOPATH+"/src/"+str. Is there a native non hacky way of resolving the full path to an import…
Coyote
  • 2,454
  • 26
  • 47
0
votes
2 answers

GOPATH not being automatically set?

I'm installing Golang on my MacBook. According to multiple sources (example), Golang 1.8 and onwards automatically sets GOPATH. If I run the command go env gopath in Terminal, nothing is returned. Does this mean the GOPATH variable is not set? I…
Jessica
  • 1,621
  • 2
  • 18
  • 34
0
votes
1 answer

GOPATH in Hyperledger Fabric

I'm going through the Hyperledger Fabric documentation at https://hyperledger-fabric.readthedocs.io/en/release-1.2/prereqs.html and I've noticed that in the section "Getting Started" you start of with the prerequisites. So basically, installing…
0
votes
1 answer

golang runtime package sets filepaths from the system on which it was built

I've a simple go code, that uses the runtime package as follows: package main import ( "runtime" "fmt" ) func bar() { pc := make([]uintptr, 1000) n := runtime.Callers(0, pc) frames := runtime.CallersFrames(pc[:n]) for { …
dibyendu
  • 515
  • 1
  • 5
  • 16
0
votes
1 answer

How to merge similar multi-package projects in go

Several organizations distribute variants of the same project, and we regularly pull changes from one another. It would be great if we could eventually merge code repositories and maybe, maybe have a common source tree managed by a consortium. …
user3188445
  • 4,062
  • 16
  • 26
0
votes
2 answers

`gcloud app deploy` command picking the wrong GOPATH

Trying to deploy my GO application with Cloud SQL using gcloud app deploy but build is failing every time with package not found error. Not sure where it is picking the GOPATH from. Is it possible to change the GOPATH in google cloud engine. Step…
Amar Jain
  • 1,698
  • 1
  • 14
  • 11
0
votes
1 answer

Wy my GOPATH/src contains few directories just after installed?

I've just installed Golang on my machine, and I set up GOPATH. But when I navigate to my go/src I see that src folder contains ./sourcegraph.com, ./golang.org and ./github.com. Also GOPATH/bin and GOPATH/pkg also no empty. So I have several…
Ksoze
  • 47
  • 6
0
votes
1 answer

How to add go code into an existing project

I am pretty new to go. We are currently splitting some microservices off of our monolithic Django+python web app and we have decided to do at least some of them in go. The problem is that the sources for the services are supposed to live in the same…
Mad Wombat
  • 14,490
  • 14
  • 73
  • 109
0
votes
1 answer

goclipse error "resource doesn't have a corresponding go package"

I check in questions database and find this: link but problem doesn't solve. My pc have windows 10 and eclipse Neon.3 Release (4.6.3), goclipse is installed, my set for Go are: Go installation: C:\Go Eclipse GOPATH: C:\Go\workspace tools path…
mx88
  • 27
  • 1
  • 1
  • 7
0
votes
2 answers

whats the sense of having all projects in a single GOPATH workspace?

Why does it makes sense? I can think of many reasons i want many workspaces: I work for two companies. I have home projects and work projects. I have multiple go versions. I'm working on two versions of a library
Jas
  • 14,493
  • 27
  • 97
  • 148