Trouble with Go - windows

I decided to download go last night and see what it was all about. Trouble is, I can't get the damn thing to function. I downloaded the program, created a workspace, tried using the go install command, and nothing. I have my workspace located at C:\go\src\gocode in which is my hello.go file. I tried manually setting the GOPATH variable to this location via setx GOPATH C:\go\src\gocode, but no luck. Can anyone possibly point me in the right direction?

The Go project provides two installation options for Windows users
(besides installing from source): a zip archive that requires you to
set some environment variables and an MSI installer that configures
your installation automatically.
MSI installer
Open the MSI file(https://code.google.com/p/go/wiki/Downloads?tm=2)
and follow the prompts to install the Go tools. By default, the
installer puts the Go distribution in c:\Go.
The installer should put the c:\Go\bin directory in your PATH
environment variable. You may need to restart any open command prompts
for the change to take effect.
Zip archive
Download the zip(https://code.google.com/p/go/wiki/Downloads?tm=2)
file and extract it into the directory of your choice (we suggest
c:\Go).
If you chose a directory other than c:\Go, you must set the GOROOT
environment variable to your chosen path.
Add the bin subdirectory of your Go root (for example, c:\Go\bin) to
your PATH environment variable.
Setting environment variables under Windows
Under Windows, you may set environment variables through the
"Environment Variables" button on the "Advanced" tab of the "System"
control panel. Some versions of Windows provide this control panel
through the "Advanced System Settings" option inside the "System"
control panel.
This is from : http://golang.org/doc/install

For a quick way to install golang on windows, try the MSI installer. The installer will only add the C:\Go\bin directory to your PATH, you need to setup the GOPATH manually in your environement settings.
From the golang site:
Under Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.
Then just add a variable name GOPATH with the right location. You should choose a location different from GOROOT to ensure you don't mix standard package with yours.

Based on your preferences and requirements, try this:
In windows command console, try enter the following line,
including the quote marks shown, and then hit ENTER key:
setx PATH "c\go\bin;C:\go\src\gocode"

Related

How to move ".android" folder in win 10 to another place?

.android folder is keeping recteating inside user folder.
I saw tip about setting AnDROID_SDK_HOME but it is deprecated and variable is removed as soon as I start studio.
Sdk is located at E:\programms\androidsdk
ANDROID_HOME is supposed to be deprecated, not ANDROID_SDK_HOME. Testing on Android Studio 4.0.1, the environment variable ANDROID_SDK_HOME is honored and works correctly.
Ensure you are setting the environment variable properly as a user variable on Windows 10:
Start -> Edit the system environment variables -> Environment Variables -> User variables for <username>
An alternative solution (if the above is not working) is to use symbolic links, of which there are two methods (both accomplishing the same goal):
CMD: Using Windows Command Prompt, which may require Administrator privileges
mklink /D E:\Android\.android C:\Users\<username>\.android
GUI: Link Shell Extension
This will effectively enable you to store your .android folder at E:\Android\.android, but still support applications referencing C:\Users\<username>\.android. Note that some applications may encounter issues with symbolic links; your mileage may vary.

Install patch file in Redmine for windows

I want to install a patch file in Windows server for redmine. When executing in cmd:
patch -p0 < file.patch
I get the error: patch commmand not found
Any ideas?
Patch takes a patch file containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions.
It's native to unix/linux os-es, but for Windows, you need to install patch.exe and add it to system's or user's environment variable PATH
Probably best way is to install
http://gnuwin32.sourceforge.net/packages/patch.htm
On Windows it differs from version to version, but it looks somewhat like this:
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab
In the Advanced section, click the Environment Variables button.
Then, in the Environment Variables window, edit the Path variable in the Systems Variable.
Add or modify the path lines with the paths you wish your console to access. Directories are separated with a semicolon as shown below.
C:\Program Files\; C:\Windows\System32
Example of path location in windows : C:\util\patch\

How do I install gradle on Windows 10?

I tried some ways with the path thing, but it did not work. When I edit the path in the System variables it opens up all the paths, not like in tutorials, where I should just put the ;%GRADLE_HOME%\bin at the end.
Download Gradle and unzip it to where you want it installed.
Then in Windows Search, search for "System" and then select: System (Control Panel)
Click the Advanced system settings link.
Click Environment Variables
Then click New button under user variable and add GRADLE_HOME to variable name and path pointing to the root directory of unpacked files from the Gradle to variable value.
In System variable section select Path and then click the Edit button.
In next window click New button and add path pointing to the bin directory of unpacked files from the Gradle.
If you are window user then Scoop will be the best option to installs the tools you know and love. Scoop is simply a command line installer.
simply run this commandscoop install gradle
But first you need to install scoop using powershell command
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Note: if you get an error you might need to change the execution policy (i.e. enable Powershell) with following command
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
In case you're here and none of these answers "helped", try restarting the shell program.
I just spent more than an hour and I just had to restart my console window to do the trick.
Download Gradle and unzip it to where you want it installed. Then open your USER variables window for your user (similar to what you show) and create a GRADLE_HOME variable with a path pointing to the root directory of your downloaded Gradle distribution. Then add it to the PATH in your USER variables with something like:
%PATH%;%GRADLE_HOME%\bin
Notice that I have prepended the existing PATH variable onto the new one. You don't want to remove what's already there. Also, your image shows something else added to the path. You will want to add that on to the line above, something like:
%PATH%;%YOUR_OTHER_STUFF%;%GRADLE_HOME%\bin
So that it won't be lost either.
This is what I have done on Windows for years. Other options are to use something like http://sdkman.io/; however, that requires extra work on Windows since it's really meant for OSes with a real terminal.
choco install gradle in shell/cmd.
of course, you gotta install the chocolatey first from here
Chocolatey - the package manager for Windows.

Don't get GraphViz and phpDocumentor to work

I'm trying to create a php documentation on my local XAMPP host (on Windows 7) with phpDocumentor.phar (v2.). It gives me (after parsing all the files) this error:
Unable to find the dot command of the GraphViz package. Is GraphViz correctly installed and present in your path?
I searched a lot, but nothing helps. What does 'path' means? If I open a command box at any location I can start the dot.exe (which gives me no output but waiting prompt). In my environment path variable the bin folders is added. GraphViz is installed correct in Program Files and runs standalone.
What could I do or check?
In order to get GraphViz running properly with a Windows based phpdoc installation, just put the GraphViz program directory (c:\some\path\graphviz\release\bin) to the Windows Path system variable.
In order to do this, follow these steps (Win7, please provide your OS version if this doesn't apply to your situation):
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button.
Different directories are separated with a semicolon:
C:\Program Files;C:\Winnt;C:\Winnt\System32
It will most likely look a bit different in your enviroment, so please just take this for an example. Just add the GraphViz Path at the end like this:
C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\somefolder\graphviz\release\bin
I'm not too sure if you have to reboot your system after changing this value. You had to do this in the old days of Win2k, and I just don't know if this still applies to modern Windows versions. It surely doesn't hurt!
After this, phpdoc should be able to find the dot command.
The steps to resolve this error are:
download Windows Packages from
https://graphviz.gitlab.io/_pages/Download/Download_windows.html
Just install it
add c:\Program Files\Graphviz*\dot.exe or c:\Program Files (x86)\Graphviz*\dot.exe to your environment variable PATH
run phpdoc
Re-start your machine & run phpdoc (if still shows the same error message)

How to compile a Go package on Windows?

The documentation is all for Mac OS X and Linux, and I wish to know how to compile a Go package on the Windows platform. On Windows, I do not know how to write the make file and which tool to use to make it.
It seems that there is not a tool named make or go make to use with the installation file of Go development tools.
Compiling a Go package on Windows is like compiling a Go package on Linux or Mac OS X. Use the go build command. There is no make file.
Here are some instructions.
Getting Started
How to Write Go Code
Compile packages and dependencies
There are no more Makefiles needed in Go, so the make tool isn't necessary. You also do not need cygwin.
If you do not seem to have a valid go command in your windows shell, then try following the official docs on installing Go for windows
Zip archive
Extract the zip file to the directory of your choice (we suggest
c:\Go).
If you chose a directory other than c:\Go, you must set the GOROOT
environment variable to your chosen path.
Add the bin subdirectory of your Go root (for example, c:\Go\bin) to
to your PATH environment variable.
MSI installer (experimental)
Open the MSI file and follow the prompts to install the Go tools. By
default, the installer puts the Go distribution in c:\Go.
The installer should put the c:\Go\bin directory in your PATH
environment variable. You may need to restart any open command prompts
for the change to take effect.
Setting environment variables under Windows
Under Windows, you may set environment variables through the
"Environment Variables" button on the "Advanced" tab of the "System"
control panel. Some versions of Windows provide this control panel
through the "Advanced System Settings" option inside the "System"
control panel.
The last section is important. Your windows PATH environment variable needs to have C:\Go\bin, so that you will have go in your path.
from: Golang windows, a complete setup guide, http://noypi-linux.blogspot.com/2014/07/golang-windows-complete-setup-guide.html
1) download ZIP
Get the latest code from: http://golang.org/dl/
2) extract ZIP
Extract zip to example C:\local\dev\go
3) create a gopath directory,
Gopath is where third parties will be stored. Example if you will
execute a "go get github.com/somelib", this library will be stored in
gopath. Create a c:\local\dev\gopath
4) set the environmental variables
open System Properties->Advanced->Environmental Variables
GOROOT=C:\local\dev\go
GOBIN=%GOROOT%\bin
GOPATH=c:\local\dev\gopath
5) add your gobin to PATH
append C:\local\dev\go\bin to PATH
6) test
6.1) create the path "C:\local\dev\gopath\src\myfirstproject"
6.2) create the main.go file "C:\local\dev\gopath\src\myfirstproject\main.go"
package main
import "fmt"
func main() {
fmt.Println("Hi foobar")
}
6.2) you can now build the project anywhere example,
6.2.1) open cmd.exe
6.2.2) cd c:\temp
6.2.3) go build myfirstproject
6.2.4) run myfirstproject.exe
7) get a few libraries
7.1) you can download some free git, svn, and hg for windows
7.2) once you have them you can now do "go get -u github.com/somelib"
8) get an IDE
download liteide
congrats!

Resources