Z
Z
ZaurK2018-05-22 18:16:50
go
ZaurK, 2018-05-22 18:16:50

How does the install command work?

I'm watching one lecture on creating web applications in the go language and I don't understand one moment. Perhaps this is not even so much related to the language, but to the bash commands. The following folder structure C:\code\src\firstapp\main.go is created there, after which, being in the C:\code> directory, the go install firstapp command goes and the C:\code\bin directory appears with the firstapp.exe file inside. I'm trying to repeat this, the only difference is that I have all this on my desktop in the folder C:\Users\zz\Desktop\go_project\web\
As a result, I get some kind of error
can't load package: package firstapp: cannot find package "firstapp" in any of:
C:\Go\src\firstapp (from $GOROOT)
C:\gopath\src\firstapp (from $GOPATH)
The $GOROOT and $GOPATH variables are set to the C:\Go\ and C:\gopath directories, respectively. Can you please tell me if these variables need to be changed, if so, where should they point to?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pavlyuk, 2018-05-22
@ZaurK

You do not need to change the variables, but move your project inside C:\gopath\src\
If you put the files containing the main package in the C:\gopath\src\firstapp folder, you can build the project throughgo build firstapp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question