Cant configure IDE
Downloaded Go, compiling code by similar app.go was successfully. But i cant run code from GoLand. It always sends me to "Edit configuration", but dont know how to configure there, i am raging cause zero youtube guides, how to edit GoLand exactly.
My system settings.
System Variables:
GOPATH C:\Users\username\Programming\Go
GOROOT C:\Go\
User variables:
Path -> C:\Go\bin
is it true?
PS.
At first starting GoLand I chose path of SDK ofcourse.
Please sign in to leave a comment.
Now i deleted GoLand, trying to install again true
+ i dont know, if i need to choose "update path" and "add projects as folder" while installing. Sorry for my english
Please attach the screenshot of the run configuration you're trying to run (Edit configurations dialog).
Please wait at bit, i am installing IDE again
now i dont want to do that alone, can u tell what i have to do now?
Well, you clicked `Configure GOPATH`, right? Configure it :) Add paths that you want to use as GOPATH for this project or for entire IDE.
Project GOPATH - my path of project, its ok.
But what is Global GOPATH?)
Previous time(before deleting ide), i configured it, but after click run, i were getting error(dont remember exactly), only i guess, it was ERROR 206
> Project GOPATH - my path of project, its ok.
On the screenshot there are no paths added to Project GOPATH.
Btw, your project root is not valid GOPATH, it doesn't contain src directory in it.
> But what is Global GOPATH?)
Global is the one that will be used for any project opened in GoLand.
haha, man thank you. Cant believe that i am so stupid)0
okey next problem(LOL): how to configure run?)
Just put proper package name (main instead of src) and GoLand will suggest you running the file via green arrow nearby main function. Also, all runs will be available in the right click menu on files and directories.
I think these tutorials would help you: https://www.jetbrains.com/help/go/install-and-set-up-product.html
I deleted that project.
New Project: FirstProject->app.go.
I have to Add Configuration -> + -> Go Build(yes?) ?
I deleted that project.
New Project: FirstProject->app.go.
I have to Add Configuration -> + -> Go Build(yes?) ?
I saw that tutorial(i dont understand it)
Come on, I can't help you if you remove IDE and projects all the time.
> I have to Add Configuration -> + -> Go Build(yes?) ?
When i use Intellij Idea, i just creating project in directory of all Java projects, and have no problems like that -_-.
You don't have any problems right now as well, all you need is copy-paste the hello world.
I mean if you name the main function in Java as `MyNameFunction` instead of `main`, it won't be run, right? Do you consider this as the same problem?
> No, you don't have to do it. As I said, just make a proper Hello world and you'll see the green arrow nearby the main function. I the previous example you had the wrong package name.
i didnt set package, it was done automatically)
yes now i changed it on "main" and it works)
so now i`ll always can run any program? or i have to change every package on "main" ?
> I mean if you name the main function in Java as `MyNameFunction` instead of `main`, it won't be run, right? Do you consider this as the same problem?
yes it wont) but i dont need to name my package as function, i have to name it as package(if not packages in project, so i dont even need "package")
> so now i`ll always can run any program?
There cannot be "any" program. Only main package is runnable. It's a language restriction.
Couple useful links for learning Go: https://golang.org/doc/code.html, https://tour.golang.org/welcome/1
oh)
i guess i understood)
I dont need many project directories?
i can just create once and have many codes in one directory(in src .go and in bin .exe files?
thank you, man
If you mean GOPATH, then yes, usually people use the single one for all projects. But it's not necessary.
Also, there is Go modules approach (https://github.com/golang/go/wiki/Modules) that does not require GOPATH at all.
Anyway, organizing the code topic is beyond IDE support and I recommend you to consult on language-specific forums like https://groups.google.com/forum/#!forum/golang-nuts or Gopher slack.
del
thank you man
There is a very descriptive error message on the screenshot.
You set Files field to .../app.go and .../src/app.go, there is no .../app.go file in your project, only .../src/app.go.
> There is a very descriptive error message on the screenshot
its ok)
i dont know why but when i moved app.go to src, it changed package main to package src)