Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to run go program in windows 10 #40237

Closed
Rani1406 opened this issue Jul 16, 2020 · 5 comments
Closed

Not able to run go program in windows 10 #40237

Rani1406 opened this issue Jul 16, 2020 · 5 comments

Comments

@Rani1406
Copy link

What version of Go are you using (go version)?

$ go version 
go version go1.14.5 windows/amd64

Does this issue reproduce with the latest release?

No

What operating system and processor architecture are you using (go env)?

Windows 10 Enterprise edition , Processor-->intel core i5 7300U CPU

go env Output
$ go env
C:\Users\x6rmahad>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\x6rmahad\AppData\Local\go-build
set GOENV=C:\Users\x6rmahad\AppData\Roaming\go\env
set GOEXE=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=linux
set GOPATH=C:\Users\x6rmahad\Project
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\x6rmahad\AppData\Local\Temp\go-build110527706=/tmp/go-build -gno-record-gcc-switches

What did you do?

run the command
$ go run main.go

What did you expect to see?

output of the application

What did you see instead?

exec: "C:\Users\x6rmahad\AppData\Local\Temp\go-build670588414\b001\exe\main": file does not exist

@davecheney
Copy link
Contributor

Thank you for raising this issue. This issue commonly arises on windows platforms. https://golang.org/doc/faq#virus

@Rani1406
Copy link
Author

In environment variables GOOS is linux Changed to windows issue resolved.

@davecheney
Copy link
Contributor

Ahh, of course. My mistake, I should have spotted that the executable did not end in .exe

@masbaehr
Copy link

If someone like me stumbles across this issue. This is what you need to set:

image

@ZekeLu
Copy link
Contributor

ZekeLu commented Apr 22, 2021

@masbaehr It's better to use go env to check and manage golang environment variables. And for a fresh install, GOARCH/GOOS should have been set correctly and you don't need to change them in OS environment variables.

@golang golang locked and limited conversation to collaborators Apr 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants