Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 18 days ago.
Improve this question
i have enabled the go modules integration according to this docs .
https://www.jetbrains.com/help/go/create-a-project-with-go-modules-integration.html#enable-go-modules-in-a-project
but yet again as you can see in image below . goland keep throwing error on some code i have
as you can see in image i have that execlise package but it keep giving error . not only that i have some error on other files
That happens sometimes with IDEs, from my experience it may happen because of at least three reasons.
first: the differences between package versions in your go.sum, you should empty the go.sum and run go mod tidy command.
Second: the version you’re using is older or newer than what you’re expecting, so the package does not support these methods or didn’t include them. so you should set the exact version of the package. (I suggest you read the documentation of the package in this case)
Third: your IDE has got some problems with the caches. for solving this: you should click on file -> invalidate caches to rebuild your IDE caches.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
For example, I have a project with following structure:
hello
- packageA
- subDirA
- Afile1.go
- Afile2.go
- packageB
- Bfile.go
- Bfile2.go
- packageC
- main.go
- subdirC
- xx.json
- packageD
-xx.go
How can I build them and get an executable file xxx on Linux platform, so that I can directly call them by ./xxxx?
Short answer: go build
You can run go help build to learn more on how to use it. For example, it's possible that you'll want to provide a specific path to go build, or build with ./.... It depends on the exact layout of your project.
I strongly recommend you to read some official Go documentation pages first:
Getting started with Go
How to write Go code
Work through the examples in these pages (and the other pages they lead to); this will answer most of your questions. The second link, in particular, talks about properly using go build and go install to build your projects.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I'm currently learning golang, I'm using windows
I've installed VSCode's Go extension.
When I hover over new package added by goimports in VSCode, I get the error
could not import io/ioutil (cannot find package "io/ioutil" in any of
C:\Users\<username>\go\src\io\ioutil (from $GOROOT)
C\src\io\ioutil (from $GOPATH)
\Users\<username>\go\src\io\ioutil (from $GOPATH))compiler
I have installed go in C:\Users\<username>\go. When I check the directory C:\Users\<username>\go\src\io\ioutil it exists(the ioutil.go file is present as well).
It's a package in go's standard library, yet it is not detected by the extension. I have to reload VSCode for it to work. Also when I compile the code using go build or go run command, the code compiles.
You should install Go somewhere else than C:\Users\<username>\go as that is also default GOPATH. Having GOPATH (a directory where your user modules are installed) in same place as GOROOT (a directory where Go itself is installed) will cause a lot of different problems and confuse many tools.
Either completely remove current installation and re-install Go somewhere else (recommended) or point your GOPATH somewhere else.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I read that go libraries no longer are forced to be saved under the GOPATH directory.
Do I have to modify libraries that are older or this just works for all libraries now assuming you have the correct version of Go?
A project using Go modules doesn't need to be under GOPATH (but you still need one for the package cache). A project using Go modules can import any library, whether or not that library uses Go modules.
A project NOT using Go modules must reside under GOPATH.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on a new Golang application which involves some proprietary code and also includes some open sources packages. The code will be part of an enterprise GitHub repository.
We don't plan to keep using the latest versions of the open source packages and would want to keep a stable version of the packages. In this context what is the best way to organize the code? From what I have read so far the best way to put the opensource packages into the Vendors directory.
In any case, a clear project layout is something we want to have in the beginning to keep things simple in the long run.
If you are using a version of Go < 1.11, you can take a look at dep for dependency management :
a dep init will generate the layout (see Creating a New Project)
a Gopkg.lock file will handle specific revisions for each dependency, thus ensuring the stability of your build (instead of having different developers using different versions of the same dependency, depending on when they go get that dependency).
However, if you are using a version of Go >= 1.11, as #oren points out in the comments section (credits to him), you'd probably want to use Go modules instead, as it is now introduced in the Go tool chain.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a few questions about approach for installation of Julia.
1) Julia installation then Atom.
2) JuliaPro installation.
Both approaches seem to result in having Julia on Atom Editor. Juno seems to come along with installation process and first run.
What would be big difference between two approaches? Does JuliaPro include extra packages that are preinstalled?
What might be disadvantages for not using JuliaPro?
Many thanks in advance.
JuliaPro comes with a lot of packages installed. Juno through its normal installation comes bare, but you can add the packages with Pkg.add. JuliaPro has an easy download for MKL-support and easy GPL-free versions, but with standard Julia it requires building from source. JuliaPro has a version with enterprise support, while standard Julia does not. Basically, if you want an easy installation with a bunch of standard stuff or have some enterprise needs, then JuliaPro can be a good option. I personally prefer the freedom of the standard installation.