Re: [go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-08 Thread Nitish Saboo
rg/doc/go1.13#version-validation > and the current formats and when they are used are in the help pages > https://golang.org/cmd/go/#hdr-Pseudo_versions > > On Sun, Apr 5, 2020 at 2:49 PM Nitish Saboo > wrote: > > > > Hi Sean, > > > > Thank you for your respon

Re: [go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-05 Thread Nitish Saboo
Hi Sean, Thank you for your response. I hope you meant '*yes*' for both the questions that I had postedam I right? Thanks, Nitish On Sat, Apr 4, 2020 at 8:39 PM Sean Liao wrote: > yes > > On Sat, Apr 4, 2020, 17:07 Nitish Saboo wrote: > >> Hi Sean, >> >&g

Re: [go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-04 Thread Nitish Saboo
y, April 1, 2020 at 2:07:19 PM UTC+2, Nitish Saboo wrote: >> >> Hi, >> >> I created go.mod file from two different go versions 1.12 and 1.13: >> >> module /home/nsaboo/project >> >> go 1.13 >> >> require ( >> github.com/aws/a

Re: [go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-03 Thread Nitish Saboo
Hi, I have already gone through this doc. The thing is I am getting two different pseudo versions for two different go versions. Are you saying I should get pseudo version v0.0.0 for both the go versions? Thanks, Nitish On Fri, 3 Apr 2020, 21:16 Sean Liao, wrote: >

Re: [go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-03 Thread Nitish Saboo
Hi, Can someone please guide me on this ? Thanks, Nitish On Thu, Apr 2, 2020 at 12:50 PM Nitish Saboo wrote: > Hi, > > Apologies forgot to mention, I am treying to migrate from go deps to go > modules. > Following is what is present in the Godeps for aws-sdk-go dependency &g

[go-nuts] Re: Pseudo version showing different in go1.12 and go1.13

2020-04-02 Thread Nitish Saboo
lease let me know what am I missing here? Thanks, Nitish On Wednesday, April 1, 2020 at 5:37:19 PM UTC+5:30, Nitish Saboo wrote: > > Hi, > > I created go.mod file from two different go versions 1.12 and 1.13: > > module /home/nsaboo/project > > go 1.13 > > requ

[go-nuts] Pseudo version showing different in go1.12 and go1.13

2020-04-01 Thread Nitish Saboo
Hi, I created go.mod file from two different go versions 1.12 and 1.13: module /home/nsaboo/project go 1.13 require ( github.com/aws/aws-sdk-go v1.8.3-0.20170325041625-2150862edc16 github.com/go-ini/ini v1.55.0 // indirect github.com/jmespath/go-jmespath v0.3.0 // indirect

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-30 Thread Nitish Saboo
Hi, Requesting valuable inputs on this. Thanks, Nitish On Thu, Mar 26, 2020 at 5:08 PM Nitish Saboo wrote: > Hi Tamas, > > 1) There is no such option '--heap_inuse'. We have an -*-inuse_space* > option. Is this what you are talking about? > > nsaboo@ubuntu:~/Desktop/memp

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-26 Thread Nitish Saboo
orrect me if I am missing something here. Thanks, Nitish On Wed, Mar 25, 2020 at 12:16 AM Tamás Gulácsi wrote: > You've requested the total allocated space (--alloc_space), not only the > heap used (--heap_inuse, or no flag). > So that 17GiB is the total allocated size, does NOT include the

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-24 Thread Nitish Saboo
profiling was not correct ..is it ? Please let me know where am I going wrong? Thanks, Nitish On Tue, Mar 24, 2020 at 5:32 PM Nitish Saboo wrote: > Hi, > > >>There is no root analysis available in Go. Read the paper I linked to. > > Sorry I did not get you. Which pa

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-24 Thread Nitish Saboo
> On Mar 23, 2020, at 9:12 AM, Nitish Saboo > wrote: > >  > Hi, > > I used something like the following to generate a memprof for 100 minutes > > func main() { > flag.Parse() > if *cpuprofile != "" { > f, err := os.Create(*cpuprofile) >

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-23 Thread Nitish Saboo
available memory? Hence, asking if the above process is the correct way of gathering the memory profile. Thanks, Nitish On Fri, Mar 13, 2020 at 6:22 PM Michael Jones wrote: > hi. get the time at the start, check the elapsed time in your infinite > loop, and trigger the write/exit

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

2020-03-20 Thread Nitish Saboo
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 19, 2020 at 10:21:31 AM UTC-4, Nitish Saboo wrote: > >&g

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-19 Thread Nitish Saboo
ess is > consuming lots of memory it’s on the C side. > > On Mar 19, 2020, at 7:55 AM, Nitish Saboo > wrote: > >  > Hi Michael, > > I used something like this to generate a mem-prof for 60 minutes > > func main() { > flag.Parse() > if *cpuprofile != ""

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

2020-03-19 Thread Nitish Saboo
typical way to use go build is to build without specifying individual > files. If you are using CGO, I would certainly recommend that you do it by > building as a package, just to keep things simple. Not that CGO is ever > simple. > > > On Wednesday, March 18, 2020 at 10:27:19 AM

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-19 Thread Nitish Saboo
o (pprof) Can you please share some commands or any link which I can refer to to analyze the data? Thanks, Nitish On Fri, Mar 13, 2020 at 6:22 PM Michael Jones wrote: > hi. get the time at the start, check the elapsed time in your infinite > loop, and trigger the write/exit after a minute,

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

2020-03-18 Thread Nitish Saboo
ial 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 mai

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

2020-03-18 Thread Nitish Saboo
t; "os" "path" "unsafe" ) Please let me know what am I missing here? Thanks, Nitish On Wed, Mar 18, 2020 at 7:20 PM Nitish Saboo wrote: > Hi Gregor, > > Got your point.Thank you for your response. > That explains why the binaries have different names p

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

2020-03-18 Thread Nitish Saboo
all `.go`-files in the > directory. `node.c` and `node.h` are likely built because of `cgo` > directives in `a.go`. > > The compiler and linker did exactly as you told them to. > On 18.03.20 14:17, Nitish Saboo wrote: > > Hi, > > > > *Case 1 -- * > I have a pr

[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

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-18 Thread Nitish Saboo
t is remains constant after a while it is most likely not a memory leak. > It is done what surprising that the memory consumption in a steady state > would be 4x the equivalent C program. > > On Mar 17, 2020, at 9:21 AM, Nitish Saboo > wrote: > >  > Hi Robert, > > T

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-17 Thread Nitish Saboo
he race detector - I’m > guessing that it will report a race on the Go global. > > On Mar 16, 2020, at 2:46 PM, Robert Engels wrote: > > In the single Go routine, use LockOSThread(). Then it was always be > accessed on the same thread removing the memory synchronization problems. >

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
an I fix this issue? Thanks, Nitish On Mon, Mar 16, 2020 at 8:17 PM Nitish Saboo wrote: > Hi Robert, > > Sorry I did not understand your point completely. > I have a global variable patterndb on C side and It is getting called from > a single goroutine every 3 mins. Why do I nee

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
variable every time and free it ...right ? Thanks, Nitish On Mon, Mar 16, 2020 at 8:10 PM Robert Engels wrote: > Yes, you have a shared global variable you need to synchronize. > > On Mar 16, 2020, at 9:35 AM, Nitish Saboo > wrote: > >  > Hi, > > Are you sayin

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
Hi, Are you saying it is working as expected? Thanks, Nitish On Mon, Mar 16, 2020 at 7:42 PM Volker Dobler wrote: > On Monday, 16 March 2020 14:25:52 UTC+1, Nitish Saboo wrote: >> >> Hi, >> >> I upgraded the go version and compiled the binary against go version 'g

Re: [go-nuts] Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
> > You probably need synchronization or pinning the access routine to a > thread. > > On Mar 16, 2020, at 9:03 AM, Nitish Saboo > wrote: > >  > Hi, > > From reading the code, I assume that the `pattern_db_new()` does some sort > of allocation of a new pa

Re: [go-nuts] Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
. > > From reading the code, I assume that the `pattern_db_new()` does some sort > of allocation of a new pattern DB. I don't see any code releasing the > pattern DB. Is that just missing from your post or something that some > automatic mechanism does? > > If not, that might be

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-16 Thread Nitish Saboo
at 6:22 PM Michael Jones wrote: > hi. get the time at the start, check the elapsed time in your infinite > loop, and trigger the write/exit after a minute, 10 minutes, 100 minutes, > ... > > On Fri, Mar 13, 2020 at 5:45 AM Nitish Saboo > wrote: > >> Hi Michael, >

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-13 Thread Nitish Saboo
small to th GC the urgency to > free it will be low. You need to loop in allocating and see if the memory > grows and grows. > > On Thu, Mar 12, 2020 at 9:22 AM Nitish Saboo > wrote: > >> Hi, >> >> I have compiled my Go binary against go version 'go1.7 linux/

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-12 Thread Nitish Saboo
5)I am just thinking out loud, since I am using go1.7, can that be the reason for the issue of increase in memory usage that might get fixed with latest go versions ? Thanks, Nitish On Tue, Mar 10, 2020 at 6:56 AM Jake Montgomery wrote: > > On Monday, March 9, 2020 at 1:37:00 PM UTC-4, Nitish S

Re: [go-nuts] Re: Mem-Leak in Go method

2020-03-09 Thread Nitish Saboo
ot;some increase in memory" is > not enough to say that you do. > > On Monday, March 9, 2020 at 7:34:31 AM UTC-4, Nitish Saboo wrote: >> >> Hi >> >> Following are my Go code and C header file and C wrapper code >> >> parser.go >>

[go-nuts] Mem-Leak in Go method

2020-03-09 Thread Nitish Saboo
Hi Following are my Go code and C header file and C wrapper code parser.go == var f *os.File func LoadPatternDB(patterndb string) { path := C.CString(patterndb) defer C.free(unsafe.Pointer(path)) C.load_pattern_db(path, (C.key_value_cb)(unsafe.Pointer(C.callOnMeGo_cgo))) } //export

Re: [go-nuts] Pass C struct from Go to C method

2020-03-06 Thread Nitish Saboo
Thankyou Ian for your responses. Thanks, Nitish On Fri, 6 Mar 2020, 21:01 Ian Lance Taylor, wrote: > On Fri, Mar 6, 2020 at 7:18 AM Nitish Saboo > wrote: > > > > > 3) Why is 'fmt.Println(InitStruct)' printing the struct fields even > after freeing the memory ? [b] &g

Re: [go-nuts] Pass C struct from Go to C method

2020-03-06 Thread Nitish Saboo
ter will return the struct fields unless we make it 'nil' explicitly ..am i correct ? 2) Here, C.free() will completely free the memory allocation ...right ? Thanks, Nitish On Fri, Mar 6, 2020 at 7:55 PM Ian Lance Taylor wrote: > On Fri, Mar 6, 2020 at 4:25 AM Nitish Saboo > wrote: > > >

Re: [go-nuts] Pass C struct from Go to C method

2020-03-06 Thread Nitish Saboo
<<<<<<<<<<<<<<< '&{0x4b7cb0 5 [0 0 0 0]}' got printed C.reload_pattern_db(path, InitStruct) <<<<<<<<<. '0x9031d40' got printed } InitStruct is a global variable.I am calling C functions 'initialize_engine' an

Re: [go-nuts] Pass C struct from Go to C method

2020-03-04 Thread Nitish Saboo
lor wrote: > On Wed, Mar 4, 2020 at 3:57 AM Nitish Saboo > wrote: > > > > I have CGO project. > > > > Following is my C header file and Go code > > > > syslog-node.h > > === > > > > #ifndef _TEST_H_ > > #define _TEST_H_ > &

[go-nuts] Pass C struct from Go to C method

2020-03-04 Thread Nitish Saboo
Hi, I have CGO project. Following is my C header file and Go code syslog-node.h === #ifndef _TEST_H_ #define _TEST_H_ #include typedef void (*key_value_cb)(const char* key, const char* value, size_t value_len, int work); typedef struct Foo{ key_value_cb cb; int data;

Re: [go-nuts] Re: Getting '[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffff04d07885 pc=0x7fe62f2d2922]' during cgo_call

2020-02-17 Thread Nitish Saboo
020. február 17., hétfő 16:33:42 UTC+1 időpontban Nitish Saboo a > következőt írta: >> >> Hi, >> >> These are my Go and C functions.I cannot explicitly garbage collect the C >> method before use, not sure if that is the issue. >> The first line in the 'match' m

Re: [go-nuts] Re: Getting '[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffff04d07885 pc=0x7fe62f2d2922]' during cgo_call

2020-02-17 Thread Nitish Saboo
Hi, How can runtime.Keepalive be helpful here ? Thanks, Nitish On Mon, Feb 17, 2020 at 9:14 PM K.S. Bhaskar wrote: > See whether runtime.Keepalive (https://golang.org/pkg/runtime/#KeepAlive) > helps. > > Regards > – Bhaskar > > On Monday, February 17, 2020 at 10:33:42 A

Re: [go-nuts] Re: Getting '[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffff04d07885 pc=0x7fe62f2d2922]' during cgo_call

2020-02-17 Thread Nitish Saboo
/2020/schedule/event/dragonscgo/); > slides at > https://docs.yottadb.com/Presentations/200202-1DragonsofCGOFOSDEM.pdf > > Regards > – Bhaskar > > On Monday, February 17, 2020 at 9:33:00 AM UTC-5, Nitish Saboo wrote: >> >> Hi, >> >> This is my go env: >>

[go-nuts] Getting '[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffff04d07885 pc=0x7fe62f2d2922]' during cgo_call

2020-02-17 Thread Nitish Saboo
Hi, This is my go env: nsaboo@ubuntu:~$ go version go version go1.12.4 linux/amd64 nsaboo@ubuntu:~$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/nsaboo/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/nsaboo/Documents/goworkspace" GOPROXY=""

[go-nuts] Compilation of CGO project

2020-02-12 Thread Nitish Saboo
Hi , I have A CGO project.While compiling the project I am getting the following error: In file included from lib/../deps/syslog/syslog-ng-3.25.1/lib/logmsg/logmsg.h:31:0, [07:38:51][shellscript] from lib/syslog-node.c:9: [07:38:51][shellscript]

Re: [go-nuts] Multiple processes in parallel for cgo service

2019-12-07 Thread Nitish Saboo
Hi Brian, I understand by running the service as containers is one route through which we can achieve this. My query is if I want to avoid that route , is there a way to achieve this using Go code to define multiple instance and run them independently? Thanks, Nitish On Sat, Dec 7, 2019 at 1:52

Re: [go-nuts] Multiple processes in parallel for cgo service

2019-12-06 Thread Nitish Saboo
On Fri, Dec 6, 2019 at 11:11 AM Ian Lance Taylor wrote: > On Thu, Dec 5, 2019 at 2:41 AM Nitish Saboo > wrote: > > > > I am having a cgo(go + c) service.Is it possible to run multiple > processes of the same service in parallel ? > > Well, it depends on what the service

[go-nuts] Multiple processes in parallel for cgo service

2019-12-05 Thread Nitish Saboo
Hi, I am having a cgo(go + c) service.Is it possible to run multiple processes of the same service in parallel ? Thanks, Nitish -- 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,

Re: [go-nuts] How to mock functions in Go ?

2019-09-20 Thread Nitish Saboo
Tried running you code, it's failing: --- FAIL: TestF (0.00s) test.go:43: got ubuntu, want testing FAIL On Fri, Sep 20, 2019 at 4:07 PM Mhd Shulhan wrote: > > > > On 20 Sep 2019, at 17.21, Nitish Saboo wrote: > > > > I have a function in Go that I want to uni

Re: [go-nuts] How to mock functions in Go ?

2019-09-20 Thread Nitish Saboo
wrote: > On Thu, 1 Aug 2019 05:09:54 -0700 (PDT) > Nitish Saboo wrote: > > > Hi, > > > > How can we mock a function in Go like os.Hostname() or os.Getwd() ? > > Any framework or Library that we can use for mocking the function > > calls ? > &g

[go-nuts] How to mock functions in Go ?

2019-08-01 Thread Nitish Saboo
Hi, How can we mock a function in Go like os.Hostname() or os.Getwd() ? Any framework or Library that we can use for mocking the function calls ? Thanks, Nitish -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] Tools or debug options for debugging 'Error in `bin/main': double free or corruption (fasttop)' in cgo

2019-07-14 Thread Nitish Saboo
original question. Your situation does not match either of those > possibilities. > > > On Sun, Jul 14, 2019 at 8:03 AM Nitish Saboo > wrote: > >> Hi, >> >> Can some please share the details of tools or Debug options to debug the >> following error

Re: [go-nuts] Tools or debug options for debugging 'Error in `bin/main': double free or corruption (fasttop)' in cgo

2019-07-14 Thread Nitish Saboo
14, 2019 at 8:39 PM Jan Mercl <0xj...@gmail.com> wrote: > On Sun, Jul 14, 2019 at 5:03 PM Nitish Saboo > wrote: > > > Can some please share the details of tools or Debug options to debug the > following error in cgo: > > Log allocations, log frees. From the log you'l

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-14 Thread Nitish Saboo
Hi, Apologies to the experts who have been kind enough to help me on this issue. I will try to come up with a small, complete reproducible test case for this issue. Thanks, Nitish On Sun, Jul 14, 2019 at 6:36 PM Nitish Saboo wrote: > HI Ian, > > func (obj SyslogParser) LoadPatte

[go-nuts] Tools or debug options for debugging 'Error in `bin/main': double free or corruption (fasttop)' in cgo

2019-07-14 Thread Nitish Saboo
Hi, Can some please share the details of tools or Debug options to debug the following error in cgo: Error in `bin/main': double free or corruption (fasttop) Thanks, Ntish -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-14 Thread Nitish Saboo
rn_db(patterndbpath, (*C.Accumulatedparams)(unsafe.Pointer(InitStruct)), C.int(workerId)) > } > In my code there is one calloc call producing a pointer but I am not freeing up calloc pointer.I am freeing up 'patterndbpath' pointer. Thanks, Nitish On Sat, Jul 13, 2019 at 8:34 PM Ian Lance Tay

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-13 Thread Nitish Saboo
ode mentioned ?I did not understand this point. Can you please clarify this point ? Thans, Nitish On Fri, Jul 12, 2019 at 11:42 PM Ian Lance Taylor wrote: > On Fri, Jul 12, 2019 at 10:53 AM Nitish Saboo > wrote: > > > > Thanks for pointing it out.I am a beginner with Go and CGO an

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-12 Thread Nitish Saboo
your code > (unseen by us) yourself to see what that is. I think so anyway. Maybe Ian > is so smart that he can debug this for you by ESP. ;-) > > Michael > > On Fri, Jul 12, 2019 at 8:15 AM Nitish Saboo > wrote: > >> Hi Ian, >> >> > syslogparser.go &g

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-12 Thread Nitish Saboo
-contained example where we can see all the code. >>>I will try to send a very small, basic code but not sure how to reproduce the issue with that. You seem to be looking at a memory corruption or double free problem. These are normal, ordinary, problems when writing C cod

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-12 Thread Nitish Saboo
syslog-ng methods and just calling a normal C program with multiple go routines ? Please correct me here if I am wrong Thanks, Nitish On Fri, Jul 12, 2019 at 11:00 AM Ian Lance Taylor wrote: > On Thu, Jul 11, 2019 at 8:45 PM Nitish Saboo > wrote: > > > > I have the follow

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-11 Thread Nitish Saboo
_cb)(const char* key, const char* value, size_t value_len, int data); typedef struct Accumulatedparams{ key_value_cb callback; int data; }Accumulatedparams; int load_pattern_db(const char* filename, Accumulatedparams *cb, int workerId); #endif On Fri, Jul 12, 2019 at 12:32 AM Nitish Sabo

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-11 Thread Nitish Saboo
> store[0].callback = (C.key_value_cb)(C.callOnMeGo_cgo) > store[0].data = C.int(1) > C.load_pattern_db(patterndb_path, (*C.Accumulatedparams)(unsafe.Pointer(store[0]))) > } On Fri, 12 Jul 2019, 00:22 Nitish Saboo, wrote: > Hi Ian, > > Can you please guide me with the correct wa

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-11 Thread Nitish Saboo
that is > indeed the case then freeing the memory in Go will cause a dangling > pointer, leading to crashes as you see. > > You should also double-check that each separate goroutine is using a > different "workerId", as duplication of workerId values could > certainly

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-11 Thread Nitish Saboo
?This should make multiple go routines to work...Am I right ? Thanks, Nitish On Thu, Jul 11, 2019 at 9:39 PM Ian Lance Taylor wrote: > On Thu, Jul 11, 2019 at 7:16 AM Nitish Saboo > wrote: > > > > I have the following function 'LoadPatternDB' where I am allocating > memor

[go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-11 Thread Nitish Saboo
Hi, I have the following function 'LoadPatternDB' where I am allocating memory for a C struct.My C struct contains the callback function. 1)I cannot deference the struct in the same func 'LoadPatternDB' because I get the following error when my callback function is called from C code: *signal

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread Nitish Saboo
l need > to construct a more elaborate struct that implements locking and (at > least what I do) a map between callback names and interface{} pointing > to the callbacks sent by the library clients. > > On Wed, Jul 10, 2019 at 8:14 AM Nitish Saboo > wrote: > > > > Hi An

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread Nitish Saboo
Hi Andrey, I understand the issue here but how can I pass a callback function in a struct to C code.I need a struct because I want to pass and an extra parameter 'userdata' as well that I would require back as part of callback. Thanks, Nitish On Wed, Jul 10, 2019 at 4:39 PM andrey mirtchovski

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread Nitish Saboo
Hi Tamas, I made it *C.Foo but still getting the error. main.go === type Callback struct { Func func(*C.char , *C.char , C.size_t, C.int) UserData int32 } Calling C code in the following manner = C.initialize_engine(pattern_db, module_path,

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread Nitish Saboo
, _Ctype_int) in field value ./main.go:166:137: cannot use _Ctype_int(1) (type _Ctype_int) as type int32 in field value makefile:6: recipe for target 'main' failed make: *** [main] Error 2 Can someone please guide me here ? Thanks, Nitish On Wed, Jul 10, 2019 at 1:03 PM Nitish Saboo wrote: > Hi

[go-nuts] Passing Struct from Go to C

2019-07-10 Thread Nitish Saboo
Hi, I am trying to pass a Struct from Go to C (this is cgo).I m passing a callback function in that struct that will be called from C code to Go. main.go === type Callback struct { Func func(*C.char , *C.char , C.size_t, C.int) UserData int32 } Calling C code in the following manner

[go-nuts] go build vs go install in cgo

2019-06-28 Thread Nitish Saboo
HI , In case of cgo, does go build -v -x main.go and go install -v -x main.go perform the same operation except that go install pushes the binary under /bin. Is the binary that gets created is same ? Thanks, Nitish -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] sudo ./main command throwing error

2019-06-25 Thread Nitish Saboo
HI Michael, Looks like it is still not preserving the env variable: nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ export LD_LIBRARY_PATH=/usr/local/lib/syslog-ng nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ sudo -E bash -c 'echo $LD_LIBRARY_PATH'

[go-nuts] sudo ./main command throwing error

2019-06-24 Thread Nitish Saboo
Hi , I am using cgo in this project where I need the following given .so files. After building the go code, I get the binary 'main'. ubuntu@hexint09-ingest-0693b91d:/opt/tap-parsing/bin$ ls -lrt total 17000 -rwxr-xr-x 1 parsing parsing 17405424 Jun 24 11:14 main '.*/main' works fine whereas

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-10 Thread Nitish Saboo
Hi Ian On Sat, Jun 8, 2019 at 12:21 PM Nitish Saboo wrote: > Hi Ian, > > So I observed a very strange thing.If I leave it out completely then also > the project gets compiled. > I thought that linker file is binding my Go code to the C code.Why am I > not getting any error ?

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-10 Thread Nitish Saboo
Hi Ian, Does the successful compilation makes sure that the Go code is properly linked to the C header files ? Thanks, Nitish On Sat, Jun 8, 2019 at 12:21 PM Nitish Saboo wrote: > Hi Ian, > > So I observed a very strange thing.If I leave it out completely then also > the project g

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-08 Thread Nitish Saboo
019 at 11:54 AM Ian Lance Taylor wrote: > On Fri, Jun 7, 2019 at 8:59 PM Nitish Saboo > wrote: > > > > I have tried the following three scenarios and one of them compiles > successfully that is with -L option. > > Let me know If am I missing something here . > > Y

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
/usr/local/go/pkg/linux_amd64/flag.a packagefile github.com/aws/aws-sdk-go/internal/sdkuri=/home/nsaboo/.cache/go-build/e9/e9ed569988250013b182ac11d21254bc422e26786fd3b1f7ac9dd8f1b478b0ec-d packagefile internal/x/text/transform=/usr/local/go/pkg/linux_amd64/internal/x/text/transform.a EOF mkdir -p $W

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi Ian, > //#cgo CFLAGS: -I./syslog-ng-3.6.2/ > //#cgo LDFLAGS: -L$(SRCDIR)/syslog-node.so. <<<<<<<<<<<<<<<<< Is this what you are saying? Btw..do I need to keep -L flag? Thanks, Nitish On Fri, 7 Jun 2019, 19:07 Ian Lance Taylor, wrote

[go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi, syslogparse.go --- *** package lib //#cgo CFLAGS: -I./syslog-ng-3.6.2/ //#cgo LDFLAGS: syslog-node.so. < //#cgo LDFLAGS: -L/usr/local/lib/ -lsyslog-ng //#cgo LDFLAGS: -L/usr/local/lib/syslog-ng -ldbparser //#cgo

[go-nuts] uncompress a .zz file in Go

2019-05-21 Thread Nitish Saboo
Hi, How to uncompress .zz file in Go? Thanks, Nitish -- 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

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-10 Thread Nitish Saboo
Apologies Marvin. On Thu, May 9, 2019 at 6:53 PM Marvin Renich wrote: > * Nitish Saboo [190508 05:48]: > > Please remove me from the CC on this thread; I am subscribed to the > list. I explicitly set Reply-To, which was not respected, and now I am > getting duplicates of every

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-09 Thread Nitish Saboo
if calling '*i*nitialize_engine' twice is actually instantiating two independent syslog-ng instances or not. Thanks On Thu, May 9, 2019 at 11:12 AM Kurtis Rader wrote: > On Wed, May 8, 2019 at 10:17 PM Nitish Saboo > wrote: > >> Yes, I want (exactly) two instances of syslog-ng

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-08 Thread Nitish Saboo
PU resources for > the mix of work and enough independence (concurrency opportunity) in the > application so that the load can be magically balanced. > > If this is not enough for you then you must have special circumstances. > > On Wed, May 8, 2019 at 2:47 AM Nitish Saboo > wrote:

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-08 Thread Nitish Saboo
he process id of the running syslog-ng engines within the go routine where it spawned the syslog-ng engine ? Thanks On Wed, May 8, 2019 at 3:01 AM Marvin Renich wrote: > * Nitish Saboo [190507 14:07]: > > Thanks Michel for your detailed response. > > I am initialising the syslog e

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-08 Thread Nitish Saboo
On Wed, May 8, 2019 at 3:01 AM Marvin Renich wrote: > * Nitish Saboo [190507 14:07]: > > Thanks Michel for your detailed response. > > I am initialising the syslog engine. > > Do you mean "log/syslog" from the standard library? What does > initialize do? &

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-07 Thread Nitish Saboo
; execute on any core, even on multiple ones in a single execution), the only > thing a goroutine does is decoupling the execution of a portion of code > from the other goroutines. I don't think you need to go deeper into the way > goroutines work to do what you're trying to achieve :) > >

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-07 Thread Nitish Saboo
goroutines will help me initialising two separate parsing engines. Thanks On Tue, May 7, 2019 at 3:09 PM Jan Mercl <0xj...@gmail.com> wrote: > On Tue, May 7, 2019 at 11:27 AM Nitish Saboo > wrote: > > > I want to initialise parsing engines on two different processors. > > Ar

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-07 Thread Nitish Saboo
t; go func() { > s2 = f2() > }() > } > > However in the second solution, if you execute that in the main goroutine > or if you need those two assignments to be done before doing something > else, you might want to use synchronisation primitives such as waitgroups.

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
à 13:59, Jan Mercl <0xj...@gmail.com> a écrit : > >> On Mon, May 6, 2019 at 1:39 PM Nitish Saboo >> wrote: >> >> > type Y struct { >> > >> > M string >> > N string >> > >> > } >> > >> > func initalize

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
compilation error. Thanks. On Mon, May 6, 2019 at 4:55 PM Jan Mercl <0xj...@gmail.com> wrote: > On Mon, May 6, 2019 at 1:11 PM Nitish Saboo > wrote: > > > > Hi, > > > > I want a go method to run on multiple cores.The go method is returning > an object. Can we achie

[go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
Hi, I want a go method to run on multiple cores.The go method is returning an object. Can we achieve this using goroutine ? How can I achieve this ? Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] Convert *C.char to array of strings in Go

2019-05-01 Thread Nitish Saboo
I doing it correctly? Thanks On Wed, May 1, 2019 at 4:40 PM Nitish Saboo wrote: > Hi Justin, > > As you had suggested: > > You could use something like this: > https://play.golang.org/p/fcE2UJEUFPy > > That example has the optio

Re: [go-nuts] Convert *C.char to array of strings in Go

2019-05-01 Thread Nitish Saboo
leid: - sentmimetype: Fp5PpR2roT6uPnte47 rcvdfileid: image/gif Please let me know how can I achieve this ? Thanks On Wed, May 1, 2019 at 11:25 AM Nitish Saboo wrote: > Hi, > I have this method: > > func CallBack(key *C.char, value *C.char, value_len C.size_t){ > > } > >

Re: [go-nuts] Convert *C.char to array of strings in Go

2019-04-30 Thread Nitish Saboo
want to split the string into a slice of individual characters. Thanks On Wed, May 1, 2019 at 6:27 AM Justin Israel wrote: > > > On Wednesday, May 1, 2019 at 7:06:47 AM UTC+12, Nitish Saboo wrote: >> >> Apologies.I did this 'strings.Split(C.GoString(*C.char),"")

Re: [go-nuts] Convert *C.char to array of strings in Go

2019-04-30 Thread Nitish Saboo
Apologies.I did this 'strings.Split(C.GoString(*C.char),""). I am getting 'Incompatible types' compilation error. Thanks On Wed, May 1, 2019 at 12:30 AM Nitish Saboo wrote: > Hi, > > I want to convert *C.char to array of strings in Go. > I want to do this because I wa

[go-nuts] Convert *C.char to array of strings in Go

2019-04-30 Thread Nitish Saboo
Hi, I want to convert *C.char to array of strings in Go. I want to do this because I want the first word from the string.Strings are getting appended to *C.char and I want the first word of the string. I am doing it using 'strings.Split(C.GoString(*C.char))[0]', but it is giving error. Can

Re: [go-nuts] Pass value from C code to GO code(CGO)

2019-04-29 Thread Nitish Saboo
Hi Tamás, If I return LogMessage type of object from C code, what type of object should be there on Go side to receive the return value because the Go side doesn't have a LogMessage object ? Thanks On Mon, Apr 29, 2019 at 7:14 PM Tamás Gulácsi wrote: > LogMessage *match(...) { > ... > return

[go-nuts] Integrate Go Code with Node.js

2019-04-29 Thread Nitish Saboo
Hi, Can someone please guide me with the references or steps to integrate Go Code with Node.js ? Thanks, Nitish -- 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

Re: [go-nuts] Pass value from C code to GO code(CGO)

2019-04-29 Thread Nitish Saboo
at 6:32 PM Ian Lance Taylor wrote: > On Fri, Apr 26, 2019 at 4:41 AM Nitish Saboo > wrote: > > > > Thanks for the info. Jan.My main issue is how can I access the value on > Go side after some manipulation within the C code ? > > You do it exactly as though you passed

Re: [go-nuts] Pass value from C code to GO code(CGO)

2019-04-26 Thread Nitish Saboo
Thanks for the info. Jan.My main issue is how can I access the value on Go side after some manipulation within the C code ? Thanks On Fri, Apr 26, 2019 at 4:28 PM Jan Mercl <0xj...@gmail.com> wrote: > On Fri, Apr 26, 2019 at 12:54 PM Nitish Saboo > wrote: > > > Can I pass

Re: [go-nuts] Pass value from C code to GO code(CGO)

2019-04-26 Thread Nitish Saboo
Hi Jan, Can I pass a pointer to a value from Go to C, do some manipulation on it within the C code and access the value from Go after the C code executes ? Thanks On Fri, Apr 26, 2019 at 4:09 PM Jan Mercl <0xj...@gmail.com> wrote: > On Fri, Apr 26, 2019 at 12:34 PM Nitish Saboo

[go-nuts] Pass value from C code to GO code(CGO)

2019-04-26 Thread Nitish Saboo
Hi, I want to call C code from GO code.Once the C code gets executed I want to pass the value back to the GO code. Can someone please guide me as in how to pass value back from C code to the GO code. Thanks -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Parsing Raw Syslog messages

2019-04-26 Thread Nitish Saboo
ou will have a LogParts structure you can use. > > On Apr 25, 2019, at 12:48 PM, Nitish Saboo > wrote: > > Hi Robert, > > If the package parses raw syslog msgs according to rfc3164, I have few > questions: > > 1)Will the output of the parsed msg will be a structure

  1   2   >