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

Installation Issues on MacOS

I just came to know about Go and I installed it from here for MacOS, it went well but when I tried to setup my go workspace "https://golang.org/doc/install#macos" i followed this tutorial: https://www.youtube.com/watch?v=5qI8z_lB5Lw, But after…
-2
votes
1 answer

Cannot find nested package

I have a project with the following structure: myapp/ -services/ -services/ -exch.go -services.go -server.go Having $GOPATH set to /home/dev/dev/go this is how server.go names it's package and imports: //server.go package…
ntonnelier
  • 1,539
  • 3
  • 23
  • 49
-2
votes
1 answer

Bash command to find parent GOPATH

I am trying to write a script to process some code in a GOPATH. The code may be nested multiple directories deep. I'll be running my script in an environment where GOPATH doesn't exist. What's a simple way in shell to find the GOPATH from a nested…
Drew LeSueur
  • 19,185
  • 29
  • 89
  • 106
-2
votes
2 answers

What is the programming paradigm behind the $GOPATH, what does it do?

As someone new to Golang, I'm somewhat perplexed by the notion of the $GOPATH. The only thing in my experience that it reminds me of is the "System Folder Path" (C:\Windows, C:\Program Files) on Microsoft Windows machines- is it somehow conceptually…
smatthewenglish
  • 2,831
  • 4
  • 36
  • 72
-2
votes
1 answer

go test import errors

I've cloned go source code using git clone https://go.googlesource.com/go into my ~/godev/ directory. My $GOPATH is ~/gocode I installed go using the installer If I cd into ~/godev/go/src/net/http and run go test, I get these…
lf215
  • 1,185
  • 7
  • 41
  • 83
-3
votes
2 answers

Can't import a Go module

I'm learning Go ad I'm trying to build go file: package main import ( "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "net/http" ) func main() { r := chi.NewRouter() r.Use(middleware.Logger) r.Get("/",…
Vad Sim
  • 266
  • 8
  • 21
-3
votes
1 answer

Can I set the GOPATH using the go command line tool?

I would like to set GOPATH using the go tool upon compilation, just like adding an include path in C/++. I want the gopath to be used only within a certain project. Can this be done without setting an environment variable?
Serket
  • 3,785
  • 3
  • 14
  • 45
-3
votes
1 answer

GO: error while importing my go file

This is the project structure /bruteforce --/src ----/services ------/bruteforce.go ----/start ------/workergenerator.go In bruteforce.go i used "package services", and in workergenerator.go "package main". Now, i wrote a simple…
Simon
  • 95
  • 1
  • 11
-5
votes
1 answer

GOPATH entry is relative must be Absolut path ,How can solve it

go: GOPATH entry is relative; must be absolute path: "%Jittu%\go". For more details see: 'go help gopath
1 2 3 4 5 6
7