I have installed Visual Studio Code and the Go extension on an offline computer and now I need to install the dependencies on that computer.
How can I do it please?
Note: If both of your online and offline PCs have the same OS and architecture, simply copy the $GOPATH directory and you are good to go.
(Note: Replace all $GOPATH with %GOPATH% for Windows OS)
Online
Go to the Go tools that the Go extension depends on, and follow instructions for your OS:
An example for dlv:
go get -u -v github.com/go-delve/delve/cmd/dlv
An example for The Language Server:
go get -u -v golang.org/x/tools/cmd/gopls
That is all.
Offline
For the offline installation you need first copy these files to the offline computer and just run e.g.:
cd $GOPATH/src/github.com/go-delve/delve/cmd/dlv
go install
Repeat steps 1 and 2 for all the packages you need, or simply have a clean GOPATH/src on first PC then compress all, then copy the compressed file and uncompress it then run go install for all packages you need to install.
Go Tools:
Online
The easiest way to install is to run:
go get -u golang.org/x/tools/...
Offline copy
You can also manually git clone the repository to:
$GOPATH/src/golang.org/x/tools
Related
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
I have a really large project I want to upload. I am the author of below question.
Git Push remote: fatal: pack exceeds maximum allowed size
So following this person's guidance, I want to install git-sizer on my repository and use it.
https://github.com/github/git-sizer
Here are the steps I took so far:
Installed golang on Windows using the installer
https://golang.org/doc/install
Followed instructions on github page and put in windows cmd:
go get github.com/github/git-sizer
This downloaded a bin folder and pkg folder to my directory. In the bin folder I see git-sizer.exe
Now the instructions on Github say "Either add $GOPATH/bin to your PATH, or copy the executable file (git-sizer or git-sizer.exe) to a directory that is already in your PATH."
I apologize, but what does this mean??? I want to use git-sizer on Visual Studio Code. I tried google searching and also searching on YouTube how to use this. I have git-bash installed on Visual Studio Code.
I'm utterly confused and feel helpless. My English is fine, but I don't understand these instructions. Maybe it's because I don't know Go or because I'm weak in this area.
Could someone please tell me what to do in order to use this tool on Windows + VS Code with git bash installed? In a simple manner that I can follow?
Thanks
You should not need to use Go in order to benefit from git-sizer
As stated in "Getting Started"
Go to the releases page and download the ZIP file corresponding to your platform. (for example: git-sizer-1.3.0-windows-amd64.zip)
Unzip the file.
Move the executable file (git-sizer or git-sizer.exe) into your PATH.
That way, no need to build from source. You can start using it right away.
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.
How to connect Visual Studio Code on mac with Team Foundation Server(TFS).
Or any other way to connect with tfs?
This are the steps to effectively connect a TFS (TFVC) Repository to your VS Code on Mac:
INSTALL THE SOFTWARE
Install Visual Studio Code for Mac (currently here: https://code.visualstudio.com/download).
Install the TFS extension for VS Code: Go to the Extensions tab in VS Code, Search for TFS and install.
Install TEE-CLC. Follow this guide: https://www.youtube.com/watch?v=VPNaEIVZfr0&feature=youtu.be.
CREATE A LOCAL TFVC WORKSPACE IN YOUR MAC
Now you need to have a local TFVC Workspace on your machine. If you don't have one (as it was my case), you need to create it. The following steps are partially extracted from https://stackoverflow.com/a/21785438/2816119.
Create a local folder where you are going to download and locally store the source code.
Open a Terminal window.
Create a local workspace from your terminal window with the following command:
tf workspace -new MyWorkspace -collection:<<<http://full.URL.of/your/repository>>>
Map your repository folder to your local folder with the following command:
tf workfold -map '$/your/repository/folder/path' /your/local/folder/path -collection:<<<http://full.URL.of/your/repository>>> -workspace:MyWorkspace
If everything went well, you'll see a new sub-folder ".tf" in your local folder.
Open your local folder with VS Code. If everything went well you'll se after a few seconds the TFVC icons in the bottom bar:
GET THE SOURCE CODE
To get the source code you'll need to go to the Source Control Tab -> Ellipsis (...) button -> Sync.
Once you press it you'll see a progress bar moving in the Source Control Tab and you'll see how the source code is downloaded to your local folder.
ENJOY
Now you can use your TFVC repository as described in their guides.
If something is not clear or you have questions please let me know. I'll try to help you :-)
Get the software
tee-clc (can be installed with HomeBrew), which depends on
Java 6, 7, or 8 (see How to install Java 8 on Mac -- as of this writing, Java 9 will not work.)
Create a workspace using tee-clc ("tf")
Tell tee-clc to remember your credentials (in OSX's Keychain) by adding this line to your .bash_profile. Then close and reopen your terminal or just paste the same command.
export TF_AUTO_SAVE_CREDENTIALS=0
Accept the EULA.
tf eula
Create a workspace.
tf workspace -new MyCoolWorkspace -collection:https://my-server.example.com/tfs/DefaultCollection
Map a path on the server to a local folder.
tf workfold -map '$/Path/To/Folder' /path/to/your/local/folder -collection:https://your-server.example.com/tfs/DefaultCollection -workspace:MyCoolWorkspace
Get the code and store your password. Make sure you type your actual username; if you enter your_username here it may get stored in the OSX Keychain and tee-clc is really dumb about replacing it later.
cd /path/to/your/local/folder
tf get -login:your_username
If it works, it will download your code to that folder. You can also use the other commands.
Use the Azure Repos Extension on VS Code
Get the Azure Repos extension.
Add the following settings (CMD+,):
{
"tfvc.location": "/usr/local/bin/tf",
"tfvc.restrictWorkspace": true
}
Type which tf in Terminal to find out what the value for location should be. I'm not sure if "restrictWorkspace" is necessary. I got it from a comment on Github while I was troubleshooting.
Finally, open the folder containing your code. From the command palette (⌘+⇧+P) type Team: Signin. If that works, you can start using the other features in the plugin.
GIT
VS Code ships with a Git source control manager (SCM) extension. Most of the source control UI and work flows are common across SCM extensions.
More details please refer this tutorial:Using Version Control in VS Code
Note: VS Code will leverage your machine's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.
TFVC
You can connect to TFVC using the Visual Studio Team Services extension since version 1.116.0 (2017/04/12).
Note: You need Team Foundation Server 2015 Update 2 or later.
Check the below link. It is working fine for me
How to use TFS on a Mac
Steps to be followed:
Step 1: Install Eclipse
Step 2: Download and install the TFS everywhere plugin
Step 3: Checkout your solution using the eclipse to a local folder
Step 4: Open the solution in Visual studio and make the code changes
Step 5: Open eclipse and commit your changes.
I made a golang app on my machine that uses cron. On my machine, I
"go get github.com/robfig/cron"
to download and install dependency then in my app I
"import cron "github.com/rk/go-cron""
the app works fine and runs the way I want. I then upload it to the server where it's supposed to run and try to "go get github.com/robfig/cron" as I did on my machine, but then it gave me this
I downloaded and installed github but still the same result. I'm guessing the problem is with github on my server machine
I am new to golang and andy kind of help would be greatly appreciated. Thanks.
What you need to install is git. It is the version control system (VCS) used by GitHub.
The native GitHub application does not provide the command line tools used by Go.
Git can be found and downloaded at http://git-scm.com/downloads
Once installed, make sure you have the path to the Git cmd folder in your %PATH% environment variable.
You can check this by running the command: echo %PATH%
On a Windows installation, you might find it located here:
C:\Program Files (x86)\Git\cmd