Visual studio code and vagrant integration - go

I am using MacOS and vagrant for Go development. I don't want install any development packages like Go, npm etc. on my host machine (MacOS). All of dev softwares installed on vagrant.
But there is a problem with vscode-go plugin, Because it requires few go packages like go vet, goimport etc. those packages installed on remote host (vagrat)
So how can I say to vscode that run these commands on remote host?

Make a nfs share on the GOPATH environment variable in vagrant. On your Mac define also a GOPATH env variable. That way vscode can install the tools on your vagrant.
Although not sure this covers Mac vs Linux binaries.
Another approach might be too create bash aliases/functions which invoke the command over ssh.
I wrote a blog post on how to set up vscode on windows. I would really recommend to install tools natively. Go tooling is small, super fast and doesn't add lot of bloat to your system. E.g. PHP ads lots of crap etc.
https://marcofranssen.nl/start-on-your-first-golang-project/
Might clarify some stuff for you.

Related

Can I install linux headers package as non-root?

Ubuntu 20.04 - is it possible to install the Linux headers package as non-root? Perhaps to a different directory under $HOME somewhere?
The reason for asking is I would like to have an Jenkins job that periodically fetches and, if necessary, installs the latest version before building a driver against those headers. The Jenkins job will run as a non-root user, so I don't really want to mess with passwords or keys if I can do the whole thing with 'normal' user permissions.
(I have thought about using DKMS, but the machines where the driver will be installed are very restricted and we can't install build tools on them.)
Thanks.

Create gopls.exe for offline Windows computer on a Mac

I am trying to set up Go on my offline Windows computer, using Visual Studio Code. I have successfully installed VS Code, Go, etc., but am running into trouble installing the Go tools. Unfortunately putting my Windows computer online isn't an option.
The most important tool for me is gopls the Go Language Server tool that provides hover, autocomplete, etc., and will really boost productivity.
I have tried various things, including:
Copying the binary file from $GOROOT/bin/gopls from my Internet-connected Mac to Windows.
Cloning the gopls repo from Github and rebuilding gopls for Windows as covered here by running go build -o gopls.exe main.go.
However I get the following error:
Couldn't start client gopls
Copying the cloned repo to my offline computer and running go install does not work as there are other dependencies needed to fully build and install gopls.
Another tool, staticcheck, provides precompiled binaries for all platforms here.
I have two questions:
Is there a publicly available repo/mirror/site that provides ready-made, downloadable binaries for the main set of Go tools for Windows?
Is there a way that the Go tools can be built for a Windows OS?
The bug on this was setting the environment variable correctly.
To give exact steps:
Browse to your Go src directory: $GOPATH/src/golang.org/x/
Clone Go tools repo: git clone https://github.com/golang/tools.git
cd tools/gopls.
Run GOOS=windows GOARCH=386 go build -o gopls.exe main.go to compile a binary file for gopls that is compatible on Windows.
Repeat steps 3 and 4 for each tool you need to install.
Ref: https://github.com/golang/go/wiki/WindowsCrossCompiling

How to install applications on a windows docker container?

I'm trying to create a Docker container based on the abrarov/msvc-2019 (windows based) image and I need to install additional programs such as Conan.
In the Dockerfile, what do I need to write in it to be able to install Conan? I can't just use something like "apt install" since Windows doesn't support anything of the sort. I can't find anything online about this.
I tried downloading the .exe installer locally and copy it inside the container, and then run the .exe during the building of the image. Something like this :
COPY conan-win-32_1_33_0.exe C:\\
RUN conan-win-32_1_33_0.exe;
But the image doesn't finish building and it's just stuck in the RUN part.
The most recommended way is using pip:
pip install conan
Another official ways are listed on download page. But as you listed, Windows installer is the another way.
For Windows you still can try Chocolatey, but it's not maintained by Conan team.
In the past we tried something similar and worked, a MSVC 15 Docker image with Conan. However, due Visual Studio license, we can't build images for distribution. You could fork the project and use it for your own propose.

Migrate Anaconda packages to `venv` virtual environment

I have installed Anaconda recently in a new Windows computer. I have no experience with managing installed packages in Windows, but in Linux. I created a new project with PyCharm and chose to use as interpreter Python 3.7 that I installed separate from the Python 3.6 version that Anaconda comes with. Now I want to be able to use Anaconda modules such as numpy or pandas in my PyCharm Project, that is using a virtual environment set up in a PyCharmProjects folder.
I fail to understand how exactly should I do it. What is that I have to copy or run to migrate the Python packages installed in Conda to my Virtual environment created from a clean independent install of Python 3.7? When I try to import them they don't work. Do I have to create a new project and migrate the files or can I do it without that?
Edit
Also, I am very unclear about how I can run Python36 that Anaconda installed. There is no conda command in Windows and python runs python27. How do I do this?
So it seems that using Python in Windows goes a bit differently than in Linux/MacOS. In order to change the default version that runs when python command is executed, one has to run the command regedit and Find (Ctrl+F) Python.exe, and change the path to default Python interpreter that one wants to use. Python installed by Anaconda can be found in Anaconda's folder in C:\ProgramData (if installation was for all users, if not its probably in some other folder in C:\Users\[User].
As for the other part of the question, I'm not sure but I think packages have to be re-installed in the virtual environment, unless you know how to copy the files one by one. Also, it's important to be careful with the version compatibility. In my case, the two Python installations are different versions, so it might not work the trick to copy the files. Other option is to change where the interpreter runs; if in that folder the packages are installed, the installation will succeed. You can also change Python's path to find packages; but that is something that must be done programatically and is not very handy to have to be running those lines of code each time.
When creating a project (or even when the project is already created) you can choose to change the interpreter to Anaconda's Python, even if you are not using conda as a package manager, but virtualenv by Python. That'd be the trick for me. Aditionally, PyCharm also natively integrates package installation into the virtual environment in a GUI menu.
If anyone has a better answer/explanation, I'm looking forward to getting to know it, but in the meanwhile that is the conclusion I have arrived to.

How do I configure RubyMine 5 to edit remote files over SSH

I've got sort of a simple problem, but I can't seem to find any conclusive answers on the web. So, I have Ubuntu Server running in VirtualBox with Ruby and Rails installed.
What I want to do, is edit the files in the VM over SSH using RubyMine 5.0 on the Windows host machine (just like I can in Eclipse).
The problem is I can't find how to do that. I'm pretty sure it can be done, because I've found some related articles on the web, but none of them show me how I can configure RubyMine to do that.
I've searched every option in the menu and I can't figure it out by myself, so a "to the point" explanation would really be of help.
Thanks
There is no way to do this natively in RubyMine. My solution is to mount the remote filesystem to a local folder using sshfs.
Linux you can get sshfs through your package manager.
OSX you can get it here make sure to install both OSX fuse and SSHFS. The version on HomeBrew did not work for me on OSX 10.9.4 so I recommend using the packages from the link.
Windows you can use win-sshfs, I've had good results using Chocolaty to install win-sshfs
To use on Linux/OSX:
Open your terminal.
mkdir MountFolder
sshfs user#server.com:/path/to/project MountFolder/
To use on Windows:
Use the GUI.
After you've mounted the remote file system open RubyMine and select Open Directory and browse to the project.
This is the best solution I can come up with until JetBrains supports it natively.

Resources