A
A
Alexander Ivanov2018-10-12 17:47:34
go
Alexander Ivanov, 2018-10-12 17:47:34

How to correctly set gopath on ubuntu 18?

The import of local files does not work (ala under-inheritance)
5bc0b2f8a71f4725223289.png
go does not pick up local files, as far as I understand this is due to $GOPATH, but whatever I prescribe it still does not want to run or deletes from import or sees but starts with errors.
the project itself is located at /home/user/www/go-test

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oniestel, 2018-10-12
@cimonlebedev

Probably the problem is in the contents of GOPATH. A typical GOPATH includes:
$GOPATH/src/ - for sources
$GOPATH/pkg/ - build binaries
$GOPATH/bin/ - run binaries
Accordingly, you should have the following structure:
$GOPATH/src/go-test
$GOPATH /src/go-test/models
If using your current GOPATH then
/home/user/go/src/go-test
/home/user/go/src/go-test/models

A
Artur Bordenyuk, 2018-10-12
@HighQuality

You can now use go version 1.11 with modules and start deprecating GOPATH
https://github.com/golang/go/wiki/Modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question