如何确定哪个Go版本用于编译二进制文件

When I run the command

go build

I end up with an application that's too large, doesn't run and with lots of errors.

I'm using the same source as someone else that's teaching me. I'm too embarrassed to ask him these questions. I understand the different OS make a difference, but should it affect the actual program and how it works?

How do I find out what version of Go was used and which compiler was used on a already-compiled application? It's just a app file.

By doing go build you are creating a binary for the go program in that current folder.

Update

Once a binary file is created you cannot determine what version of Go was used to create the binary.

To Find the version of GO used for compiling use a debugger like gdb or others. Here is an awesome blog about the same.

And you can inspect the file with

file mybinary

to get info like the type of binary and like which OS it is supposed to run on.

eg : ELF files run on Linux
Mach-O files run on Mac etc...

However you can cross compile your Go code with

GOOS=linux go build

so this creates a binary for linux (ELF file) even though i run Go on Mac / Windows