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
2
votes
1 answer

Why is $GOPATH often set in ~/.bashrc and ~/.bash_profile instead of ~/.profile?

In Go's wiki page on Github, it is told to be set in ~/.bash_profile: https://github.com/golang/go/wiki/Setting-GOPATH In this StackOverflow question most of the top voted answers suggested to be set in the ~/.bashrc file: how do I SET the GOPATH…
Depressed Duda
  • 147
  • 1
  • 1
  • 8
2
votes
1 answer

Golang 1.8 glide vendor folder ignoring

I'm working in Go version 1.8, Glide for package dependency and my project structure is /Users/myName/go bin/ pkg/ src/ main.go vendor/ github.com/ gaoling.org/ all my packages are installed in…
Harish
  • 141
  • 2
  • 14
2
votes
2 answers

Systemd doesn't detect GOPATH (run without binary file)

I wrote simple systemd service-file goserver.service: [Unit] Description=Goserver [Service] ExecStart=/usr/bin/go run /home/denis/goserver/index.go [Install] WantedBy=multi-user.target But when I try to run service and get status: $ sudo…
1
vote
0 answers

How to ignore a directory or a file while running goimports?

I have the following project structure proejct/ ├── README.md ├── go.mod ├── go.sum ├── src │ ├── delivery │ │ ├── grpc │ │ │ ├── index.go │ │ │ ├── pb │ │ │ │ ├── project.pb.go │ │ │ │ └── another.pb.go │ │ │ …
mrpandey
  • 627
  • 2
  • 9
  • 17
1
vote
1 answer

Building go/src packages from golang/go Github Repository

Asking to see what the appropriate workaround is for building individual go packages from the go/std library when working on a github repo fork. The issue encountered is summarized by the following error when building for example the src/go/parser…
Brian Anderson
  • 109
  • 1
  • 4
1
vote
1 answer

Go server not showing IntelliSense of internal imports

I'm using golang and GoLand(Jetbrains)IDE for development on UBUNTU. My Go path is /usr/local/go and my Project Directory is at /Home/GoLandProjects with bin, src, pkg directories and my project directory. go version go1.16.7 linux/amd64 My GOPATH…
Zain Ur Rehman
  • 287
  • 3
  • 14
1
vote
1 answer

GOPATH/GOROOT setup for Hyperledger fabric chaincode

I have done basic setup in Hyperledger Fabric 1.4.7 and made all peer's to join the channel. After exploring chaincode in golang, I started trying chaincode install command and I was facing issue's in this step. error Error: error getting chaincode…
Dev
  • 92
  • 7
1
vote
1 answer

What is $GOPATH[i] and $GOPATH[d]?

A section of the Go Modules Reference describes some rules for minimal module compatibility. There is a list of conditions in this section and two of them look like this: No $GOPATH[i]/src/$modpath/$vn/$suffix directory exists (for any root…
Andrew Savinykh
  • 25,351
  • 17
  • 103
  • 158
1
vote
2 answers

How to config a simple Go project

I'm trying to follow the Writing an intepreter in Go book, by Thorsten Ball, and in the first chapter he establish this simple scheme file /Users/myuser/projects/monkey/token/token.go file /Users/myuser/projects/monkey/lexer/lexer.go file…
John Smith
  • 83
  • 10
1
vote
1 answer

Difficulty installing go buffalo using go mod on windows

I am very new to golang. I am trying to work with the gomod. Trying to explore the go buffalo framework. But finding a bit of difficulty in installing that. What I have done: I saw that go get is nomore supported for buffalo and so switched to go…
Sayan Dey
  • 771
  • 6
  • 13
1
vote
1 answer

go env shows the GOPATH do not match

I use go env to check the GOPATH: $ go…
user7693832
  • 6,119
  • 19
  • 63
  • 114
1
vote
0 answers

Unexpected directory layout after moving project into new directory

I was working on a Go project in a directory that was not in my GOPATH. I was using relative imports. I am trying to move the project into my GOPATH so I can stop using relative imports, but I keep getting unexpected directory layout errors. I've…
mii
  • 11
  • 1
1
vote
1 answer

VS Code: module and GOPATH usage and settings

I recently rearranged my VS Code workspace. Before rearranging it I had no problems neither with Go modules nor $GOPATH. Now I have adopted the much beloved hexagonal project layout as I find it quite organized and I like it a lot better than what I…
Stroboscopio
  • 150
  • 3
  • 11
1
vote
1 answer

Kallax: package is not in any of the go paths

I have tried to use kallax. When I tried to run that, I caught an error like this: panic: parseutil: package is not in any of the go paths goroutine 1 [running]: gopkg.in/src-d/go-kallax.v1/generator.glob..func1(0x890120, 0xc00015af60) …
A.Smith
  • 165
  • 1
  • 8
1
vote
0 answers

beego binary is installed an absurd path and 'bee new' command doesn't work

I installed almost 10 days ago golang in my Ubuntu 18.04.01 Server Edition: go version go version go1.10.4 linux/amd64 The GOPATH set in .bashrc is this: export GOPATH=$HOME/go export PATH=${PATH}:${GOPATH}/bin and I've been using golang since…
user2315094
  • 759
  • 3
  • 16
  • 29