runnerw.exe: CreateProcess failed with error 216 with a simple Hello World

The full error message:

runnerw.exe: CreateProcess failed with error 216: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

 

I've already searched and looked into this thread but it has no use to me since I am using the package main. GOPATH and GODIR are properly set.

 

The code:

package main

import "fmt"


func main() {
fmt.Printf("Hello, world.\n")

}


15 comments
Comment actions Permalink

Hi,

What go version you use? Can you run `go version` in the terminal?

0
Comment actions Permalink

Hello, here it is:
C:\Users\Federico>go version
go version go1.10.3 windows/amd64

 

The GoLand version is 181.5281.38 from this 15 June.

0
Comment actions Permalink

Please attach entire output of GoLand. Also could you please attach or send me to zolotov at jetbrains.com logs? You can collect them with `Help | Compress and show in <file browser>` action.

0
Comment actions Permalink

I've solved the issue apparently, the problem was an improper workspace directory hierarchy as I had my main.go into /src/main.go.

When I moved it to /src/test/main/main.go it compiled successfully. However the generated .exe is placed next to it instead of /bin 🤔

1
Comment actions Permalink

By default generated *.exe is placed in temp directory and removed right after execution finished. Output directory can be configured via `Run | Edit configurations... | <your run configuration> | Output directory`.

0
Comment actions Permalink

Oh ok! I thought that GoLand honored the GOPATH convention mentied here by default https://golang.org/doc/code.html#Workspaces 

0
Comment actions Permalink

GoLand honors GOPATH convention but the convention has nothing to do with creating binaries while compiling. E.g. `go build` put binaries in the working directory.

As I said by default binary is not stored at all, putting it in GOPATH/bin will give you nothing but polluting your PATH. Still, you have a mechanism to store binary anywhere you want.

0
Comment actions Permalink

The problem was in `-i` parameter. For some reason go build generated corrupted binary if run with `-i`.

To avoid using the parameter in GoLand, it can be removed in all already created run configurations and in default ones: `Run | Edit configurations… | Defaults | Go Build | Go tool arguments` and `Run | Edit configurations… | Defaults | Go Test | Go tool arguments`.

0
Comment actions Permalink

Had the same problem and Federico's solution worked for me as well, thanks :)

0
Comment actions Permalink

@Marius can you please explain what steps have you applied to fix the problem? As Alexander wrote above, the IDE honors the Go Workspace, so we should understand what happens in order to prevent it from happening to other users. Thank you.

0
Comment actions Permalink

This will also happen if you leave the package name something other than main yet the GO plugin at least will set the package name to the file name. I'm also new to GO config so maybe this is something common knowledge. Though is there anyway possible to turn off the prevention of me typing imports. Though it might be put there to avoid me form importing something it cant find and if I call it in the code it auto imports. I think that is extremely frustrating to someone new.

2
Comment actions Permalink

YES, Are you new to GO , try to rename package name to main and try.

package main
6
Comment actions Permalink

Changing the package name to main, only in the code level, fixed this error for me.

 

0
Comment actions Permalink

Not sure why it wasn't mentioned if you use go build it will put the binary in the same folder, but go install will place it in the bin folder.

0
Comment actions Permalink

> Not sure why it wasn't mentioned if you use go build it will put the binary in the same folder, but go install will place it in the bin folder.

 

This is covered in the Go documentation, https://golang.org/doc/code.html and here https://golang.org/cmd/go/ as well as typing ` go help build ` and related commands.

0

Please sign in to leave a comment.