Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Jakob Borg
On 20 Jan 2019, at 20:20, Tycho Andersen mailto:ty...@tycho.ws>> wrote: That's how I have it now. The problem with this is that in the face of modules, it re-writes the go.mod and go.sum files to not include the deps of the binary it's not currently building, so you end up with a bunch of

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Jinwoo Lee
On Sun, Jan 20, 2019 at 11:20 AM Tycho Andersen wrote: > On Sun, Jan 20, 2019 at 11:18:38AM -0800, Jinwoo Lee wrote: > > It looks like "go build ./cmd/..." works when there's only one directory > > under cmd. When there are multiple directories there, the command doesn't > > generate any

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Jinwoo Lee
On Sun, Jan 20, 2019 at 11:33 AM Jan Mercl <0xj...@gmail.com> wrote: > > > > On Sun, Jan 20, 2019 at 8:22 PM Jinwoo Lee wrote: > > > It looks like "go build ./cmd/..." works when there's only one directory > under cmd. When there are multiple directories there, the command doesn't > generate any

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Jan Mercl
On Sun, Jan 20, 2019 at 8:22 PM Jinwoo Lee wrote: > It looks like "go build ./cmd/..." works when there's only one directory under cmd. When there are multiple directories there, the command doesn't generate any binaries for me. It works on all sub directories. But `go build` puts the binary

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Jinwoo Lee
It looks like "go build ./cmd/..." works when there's only one directory under cmd. When there are multiple directories there, the command doesn't generate any binaries for me. I would just do $ go build ./cmd/foo $ go build ./cmd/bar They create binaries in the current directory so you don't

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-20 Thread Tycho Andersen
On Sun, Jan 20, 2019 at 11:18:38AM -0800, Jinwoo Lee wrote: > It looks like "go build ./cmd/..." works when there's only one directory > under cmd. When there are multiple directories there, the command doesn't > generate any binaries for me. > > I would just do > > $ go build ./cmd/foo > $ go

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-19 Thread Tycho Andersen
On Fri, Jan 18, 2019 at 09:54:51PM -0500, Ian Denhardt wrote: > You could just do: > > go build ./cmd/... > cp ./cmd/foo/foo ./ > cp ./cmd/bar/bar ./ > > ..and wrap it up in a script. go build doesn't seem to produce binaries, though? In any case, Paul's suggestion in a sibling mail works well

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-19 Thread Paul Jolly
Perhaps the most idiomatic way of achieving this is: GOBIN=$PWD go install ./cmd/{foo,bar} go install is also more efficient than go build because it will only perform the link step if the target is out of date. I'm no expert with make, so I don't know how this sort of approach maps back onto

Re: [go-nuts] multiple binaries from a single directory with go modules?

2019-01-18 Thread Ian Denhardt
You could just do: go build ./cmd/... cp ./cmd/foo/foo ./ cp ./cmd/bar/bar ./ ..and wrap it up in a script. Quoting Tycho Andersen (2019-01-17 17:47:35) > Hi everyone, > > I'm trying to get an existing project which outputs multiple binaries > to work with go modules. The package follows