Re: [go-nuts] Avoid forcing my module users' to carry dependencies from code that live under the same repo just as examples/ debugging purposes.

2023-04-14 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2023-04-14 at 14:01 +0800, Jim Idle wrote:
> You might start with this repo:
> 
> https://github.com/golang-standards/project-layout
> 
> This is not an 'official' standard, though it does encapsulate the
> things that are standard go such as the internal directory. 
> 
> Personally I avoid its recommendation to use a directory 'pkg' to
> store your module code as it makes the import path quite strange. But
> for a main you can look at the cmd directory or the internal
> directory. You will not go too far wrong by following this guide.
> 
> Jim

It's worth noting this issue in that repo:
https://github.com/golang-standards/project-layout/issues/117

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c66f416360824816fa1c9415126c78969beaad9b.camel%40kortschak.io.


[go-nuts] cgo Compiling C files housed in different directory than Go files

2023-04-14 Thread Palash B


Hello folks.

I am working on writing an Interpreter (for my own programming language) 
which is written in C and I want to build a Go API for my interpreter.

My current directory structure is something like this
...
 cpank/*.c 
cpank/stdlib/*.c 
cpank/ext/*.c 
cpank/ext/*.h 
cpank/include/*.h 
goapi/api.go 
... 

cpank/*.c contains the core files, stdlib contains source for standard 
library, ext curently contains 2 files xxhash.c and xxhash.h but can and 
will contain more files later.

I have tried putting the go file in main cpank directory but it fails. If I 
directly include the c files, cgo throws duplicate errors. Only thing that 
works is copying all c files from cpank, stdlib, ext and the include 
directory into the goapi directory.

Is there any way to tell cgo to compile this, this and that files like we 
use with normal c projects.

How do I make this work?

Any help or suggestions will be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ed40c292-5c57-4d0d-bff0-666c965e81a4n%40googlegroups.com.