R
R
rhaegal2019-01-24 22:38:19
linux
rhaegal, 2019-01-24 22:38:19

How to make go work with files not in the home directory?

Hello!
There is a dedicated section. I want to specify one of its directories as GOPATH. When running the executable file in the terminal, an error occurs that access is denied.
If GOPATH contains a directory from the home directory, then everything works.
I tried to change the rights to the executable file, I made a symbol. link in the home directory - did not help.
Tell me, how can I make go work not in the home directory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ninazu, 2019-02-07
@Ninazu

That's how it works! But on the condition that you do not download modules in GOPATH, since by itself you will need write permissions for this.

GOROOT=/usr/local/go
GOPATH=/root
/usr/local/go/bin/go build -o /tmp/test $HOME/go/src/awesomeProject/main.go
/tmp/test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question