go build doesn't make executable file

7,573 views
Skip to first unread message

Boris

unread,
Nov 8, 2012, 1:22:09 PM11/8/12
to golan...@googlegroups.com
I have these files and directories (names changed to obfuscate):

src/
  agent/
     mysql/mysql-agent.go
  client/
     client.go

When I cd to src/ and say "go build agent/mysql/mysql-agent.go" I get mysql-agent executable. When I say "go build client/client.go" I get nothing. I assume this is because it would try to create executable named "client" which is existing directory. But when I cd to client/ and say "go build client.go" I still get nothing. And when I stay in src/ and say "go build -o client-executable client/client.go" I still get nothing. In all cases "go build" outputs nothing and exit status is 0.

Do I do something wrong?

Boris

unread,
Nov 8, 2012, 1:28:22 PM11/8/12
to golan...@googlegroups.com
I found the problem. When I say "go run client/client.go" I get

go run: cannot run non-main package

I did not have "package main" in that file :-) Sorry for the noise.

Dustin Sallings

unread,
Nov 8, 2012, 1:45:14 PM11/8/12
to golan...@googlegroups.com
Boris <boris.s...@gmail.com> writes:

> When I cd to src/ and say "go build agent/mysql/mysql-agent.go" I get
> mysql-agent executable. When I say "go build client/client.go" I get
> nothing. I assume this is because it would try to create executable
> named "client" which is existing directory. But when I cd to client/
> and say "go build client.go" I still get nothing. And when I stay in
> src/ and say "go build -o client-executable client/client.go" I still
> get nothing. In all cases "go build" outputs nothing and exit status
> is 0.

What package is client?

--
dustin

Boris Solovyov

unread,
Nov 8, 2012, 2:22:38 PM11/8/12
to golan...@googlegroups.com
yes, that was the problem, it was not package main. Fixed :-)
Reply all
Reply to author
Forward
0 new messages