4
4
4utka_pyan2017-11-12 23:05:46
go
4utka_pyan, 2017-11-12 23:05:46

How to correctly specify the path to GO?

Did according to the manual https://losst.ru/ustanovka-go-ubuntu installation of go was successful, go version says that it costs 1.9
It became unclear from the moment the test file was created

First, let's create a working folder for the sources in the home folder:

mkdir ~/work/src/hello/
$ cd~/work/src/hello/

Go is installed in a folder usr/local/goso where should I create the folder work/src/hello? At the root, i.e. on the same level as usr, in local, or in go?
Next, we need to tell Go where our project folder is located.
For this, the GOPATH variable is used:
This line can be added to /etc/profile so that we do not need to enter

export GOPATH=$HOME/work/
$HOME is like the user's home directory, but I'm sitting as root as a result in my profile:
5a08a7dbdec52280389514.png
And when the go install hello command, an error occurs:
5a08a80711d90061550223.png
And why do we use the command go install helloand not go build hello.go?
And how do you deal with paths?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Pavlov, 2017-11-12
@4utka_pyan

Here: https://golang.org/doc/install

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question