Re: [go-nuts] go build output depending on project structure

2020-03-20 Thread Nitish Saboo
Thank you Ian and Jake for the response. Sure Ian, will go through it. Thanks, Nitish On Thu, Mar 19, 2020 at 11:11 PM Ian Lance Taylor wrote: > It might help to read > https://golang.org/cmd/go/#hdr-Package_lists_and_patterns, including > the paragraph starting "As a special case, if the

Re: [go-nuts] go build output depending on project structure

2020-03-19 Thread Ian Lance Taylor
It might help to read https://golang.org/cmd/go/#hdr-Package_lists_and_patterns, including the paragraph starting "As a special case, if the package list is a list of .go files from a single directory," Ian On Thu, Mar 19, 2020 at 8:59 AM Jake Montgomery wrote: > > > > On Thursday, March

Re: [go-nuts] go build output depending on project structure

2020-03-19 Thread Jake Montgomery
On Thursday, March 19, 2020 at 10:21:31 AM UTC-4, Nitish Saboo wrote: > > Hi Jake, > > Is there some reason that you want, or need, to be using go build this > way, by specifying files? Or is it just curiosity about how the tools work? > >>There is no particular reason to use go build by

Re: [go-nuts] go build output depending on project structure

2020-03-19 Thread Nitish Saboo
Hi Jake, Is there some reason that you want, or need, to be using go build this way, by specifying files? Or is it just curiosity about how the tools work? >>There is no particular reason to use go build by specifying the files. I was trying different ways to compile the project and ended up with

Re: [go-nuts] go build output depending on project structure

2020-03-19 Thread Jake Montgomery
Nitish, Is there some reason that you want, or need, to be using go build this way, by specifying files? Or is it just curiosity about how the tools work? The typical way to use go build is to build without specifying individual files. If you are using CGO, I would certainly recommend that you

Re: [go-nuts] go build output depending on project structure

2020-03-18 Thread Nitish Saboo
Hi Gregor, Do you mean like this 'go build -v -x main.go node.c' ? But it does not compile and gives the following output: WORK=/tmp/go-build714119815 named files must be .go files Thanks, Nitish On Wed, Mar 18, 2020 at 7:44 PM Gregor Best wrote: > Hi, > > it looks like my initial reply

Re: [go-nuts] go build output depending on project structure

2020-03-18 Thread Gregor Best
Hi, it looks like my initial reply wasn't entirely correct. It should build if you pass in both the `.go` file and the `.c` file. On 18.03.20 15:02, Nitish Saboo wrote: Hi Gregor, nitish        main.go        node.c        node.h I compiled using 'go build -v -x main.go' But if my cgo

Re: [go-nuts] go build output depending on project structure

2020-03-18 Thread Nitish Saboo
Hi Gregor, nitish main.go node.c node.h I compiled using 'go build -v -x main.go' But if my cgo directive is defined in main.go, this should have compiled successfully..right? But it fails with the following whereas 'go build -v -x' works fine.

Re: [go-nuts] go build output depending on project structure

2020-03-18 Thread Nitish Saboo
Hi Gregor, Got your point.Thank you for your response. That explains why the binaries have different names post compilation. Thanks, Nitish On Wed, Mar 18, 2020 at 7:06 PM Gregor Best wrote: > Hi, > > In both `go build main.go`-examples, you tell the compiler to _only_ build > `main.go`. > >

Re: [go-nuts] go build output depending on project structure

2020-03-18 Thread Gregor Best
Hi, In both `go build main.go`-examples, you tell the compiler to _only_ build `main.go`. In your first example, `main.go` probably imports both `util` and `lib` (you might want to give them less generic names by the way). The go compiler thus knows "to build `main.go`, I need to build both

[go-nuts] go build output depending on project structure

2020-03-18 Thread Nitish Saboo
Hi, *Case 1--* I have a project called 'nitish' where the folder structure looks like the following: nitish main.go util util.go lib node.c node.h a.go When I try compiling this project in the following ways: 1) go