Exe not generated under windows

12 views
Skip to first unread message

saravanan b

unread,
Dec 11, 2017, 1:59:32 PM12/11/17
to mgo-users
Hello All,

I am new to go lang and mgo as well. I am facing problem in compiling the mgo.v2 on windows 10. Below are the details,
Go lang Version:
PS D:\Go\src> go version
go version go1.9.1 windows/amd64


Mgo version :
mgo.v2

PS D:\Go\my> go build .\ConnectDB.go
PS D:\Go\my> ls
-a----       11-12-2017     23:56           1254 ConnectDB.go
-a----       11-12-2017     23:07            568 ConnPool.go
-a----       23-10-2017     20:23        1935872 hello.exe

ConnectDB.exe file is not generated. Any help or suggestion is highly appreciated.

Note: I dont know this is the correct form that i am posting my query. If i am wrong please direct me to correct path.

Thanks in  advance.

Regards,
Saravanan B


Diego Medina

unread,
Dec 11, 2017, 2:11:44 PM12/11/17
to mgo-users
Hi,

This is more of a go question than mgo, but the short version is. when you build a go program (not just file), go build will look for any file(s) with package "main" and build an exe (in windows), and it will put code from any other file and other package that is called from package main.

so, you don't really go build one by one the files, you "go build" your whole program. Which gets the name of the containing folder (unless you pass parameters but don't do that)

Hope that helps.

Diego

saravanan b

unread,
Dec 12, 2017, 9:23:12 AM12/12/17
to mgo-users
Hi Diego,

First, i want to thank you for replying on my query. As you pointed out that i messed up with the package name of my file ConnectDB.go

Correct package name is package main , but i messed up with package DB.

Thanks for the reply.

Regards,
Saravanan B

Diego Medina

unread,
Dec 12, 2017, 1:26:47 PM12/12/17
to mgo-users
Glad you got it working Saravanan.
Reply all
Reply to author
Forward
0 new messages