如何在Go子目录中构建程序?

I have directory structure below. So server.go is in the main dir , and client.go in client sub directory (both are in package main). When I do ' go get -u ...' I have only server.go compiled under the name of MyGoProgram which is fine (executable in $GOPATH/bin)

MyGoProgram
client/client.go
server.go

How do I compile client.go ?

It's important to match your go directory to the structure described here: https://golang.org/doc/code.html

so you should have:

{$GOPATH}/bin
         /pkg
         /src/MyGoProgram/server.go
                         /client/client.go

cd to {$GOPATH} and run the command go install ./src/MyGoProgram the executable will be created at /bin/MyGoProgram.exe