Re: [go-nuts] Cause of SIGBUS panic in gc?

2019-04-29 Thread Justin Israel
On Tue, Apr 30, 2019 at 5:43 PM vaastav anand 
wrote:

> I'd be very surprised if the anonymous goroutine is the reason behind a
> SIGBUS violation.
> So, if I remember SIGBUS correctly, it means that you are issuing a
> read/write to a memory address which is not really addressable or it is
> misaligned. I think the chances of the address being misaligned are very
> low.so it really has to be a non-existent address.
> It can happen if you have try to access memory outside the region mmaped
> into your application.
> If your application has any kind of mmap or shared memory access, I would
> start there.
> In any case your best bet is to somehow reproduce the bug consistently and
> then figure out which memory access is causing the fault.
>

My application isn't doing anything with mmap or shared memory, and my
direct and indirect dependencies don't seem to be anything like that
either. Its limited to pretty much nats.io client, gnatds embedded server,
and a thrift rpc.

It seems so random that I doubt I could get a reproducible crash. So I can
really only try testing this on go 1.11 instead to see if any of the GC
work in 1.12 causes this.


>
>
> On Monday, 29 April 2019 21:59:34 UTC-7, Justin Israel wrote:
>>
>>
>> On Thursday, November 29, 2018 at 6:22:56 PM UTC+13, Justin Israel wrote:
>>>
>>>
>>>
>>> On Thu, Nov 29, 2018 at 6:20 PM Justin Israel 
>>> wrote:
>>>
 On Thu, Nov 29, 2018 at 5:32 PM Ian Lance Taylor 
 wrote:

> On Wed, Nov 28, 2018 at 7:18 PM Justin Israel 
> wrote:
> >
> > I've got a service that I have been testing quite a lot over the
> last few days. Only after I handed it off for some testing to a colleague,
> was he able to produce a SIGBUS panic that I had not seen before:
> >
> > go 1.11.2 linux/amd64
> >
> > The service does set up its own SIGINT/SIGTERM handling via the
> typical siginal.Notify approach. The nature of the program is that it
> listens on nats.io message queues, and receives requests to run tasks
> as sub-processes. My tests have been running between 40-200 of these
> instances over the course of a few days. But this panic occurred on a
> completely different machine that those I had been testing...
> >
> > goroutine 1121 [runnable (scan)]:
> > fatal error: unexpected signal during runtime execution
> > panic during panic
> > [signal SIGBUS: bus error code=0x2 addr=0xfa2adc pc=0x451637]
> >
> > runtime stack:
> > runtime.throw(0xcf7fe3, 0x2a)
> > /vol/apps/go/1.11.2/src/runtime/panic.go:608 +0x72
> > runtime.sigpanic()
> > /vol/apps/go/1.11.2/src/runtime/signal_unix.go:374 +0x2f2
> > runtime.gentraceback(0x, 0x, 0x0,
> 0xc0004baa80, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, ...)
> > /vol/apps/go/1.11.2/src/runtime/traceback.go:190 +0x377
> > runtime.traceback1(0x, 0x, 0x0,
> 0xc0004baa80, 0x0)
> > /vol/apps/go/1.11.2/src/runtime/traceback.go:728 +0xf3
> > runtime.traceback(0x, 0x, 0x0,
> 0xc0004baa80)
> > /vol/apps/go/1.11.2/src/runtime/traceback.go:682 +0x52
> > runtime.tracebackothers(0xc00012e780)
> > /vol/apps/go/1.11.2/src/runtime/traceback.go:947 +0x187
> > runtime.dopanic_m(0xc00012e780, 0x42dcc2, 0x7f83f6ffc808, 0x1)
> > /vol/apps/go/1.11.2/src/runtime/panic.go:805 +0x2aa
> > runtime.fatalthrow.func1()
> > /vol/apps/go/1.11.2/src/runtime/panic.go:663 +0x5f
> > runtime.fatalthrow()
> > /vol/apps/go/1.11.2/src/runtime/panic.go:660 +0x57
> > runtime.throw(0xcf7fe3, 0x2a)
> > /vol/apps/go/1.11.2/src/runtime/panic.go:608 +0x72
> > runtime.sigpanic()
> > /vol/apps/go/1.11.2/src/runtime/signal_unix.go:374 +0x2f2
> > runtime.gentraceback(0x, 0x, 0x0,
> 0xc0004baa80, 0x0, 0x0, 0x7fff, 0x7f83f6ffcd00, 0x0, 0x0, ...)
> > /vol/apps/go/1.11.2/src/runtime/traceback.go:190 +0x377
> > runtime.scanstack(0xc0004baa80, 0xc31270)
> > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:786 +0x15a
> > runtime.scang(0xc0004baa80, 0xc31270)
> > /vol/apps/go/1.11.2/src/runtime/proc.go:947 +0x218
> > runtime.markroot.func1()
> > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:264 +0x6d
> > runtime.markroot(0xc31270, 0xc00047)
> > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:245 +0x309
> > runtime.gcDrain(0xc31270, 0x6)
> > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:882 +0x117
> > runtime.gcBgMarkWorker.func2()
> > /vol/apps/go/1.11.2/src/runtime/mgc.go:1858 +0x13f
> > runtime.systemstack(0x7f83f7ffeb90)
> > /vol/apps/go/1.11.2/src/runtime/asm_amd64.s:351 +0x66
> > runtime.mstart()
> > 

Re: [go-nuts] Cause of SIGBUS panic in gc?

2019-04-29 Thread vaastav anand
I'd be very surprised if the anonymous goroutine is the reason behind a 
SIGBUS violation.
So, if I remember SIGBUS correctly, it means that you are issuing a 
read/write to a memory address which is not really addressable or it is 
misaligned. I think the chances of the address being misaligned are very 
low.so it really has to be a non-existent address.
It can happen if you have try to access memory outside the region mmaped 
into your application.
If your application has any kind of mmap or shared memory access, I would 
start there.
In any case your best bet is to somehow reproduce the bug consistently and 
then figure out which memory access is causing the fault.



On Monday, 29 April 2019 21:59:34 UTC-7, Justin Israel wrote:
>
>
> On Thursday, November 29, 2018 at 6:22:56 PM UTC+13, Justin Israel wrote:
>>
>>
>>
>> On Thu, Nov 29, 2018 at 6:20 PM Justin Israel > > wrote:
>>
>>> On Thu, Nov 29, 2018 at 5:32 PM Ian Lance Taylor >> > wrote:
>>>
 On Wed, Nov 28, 2018 at 7:18 PM Justin Israel >>> > wrote:
 >
 > I've got a service that I have been testing quite a lot over the last 
 few days. Only after I handed it off for some testing to a colleague, was 
 he able to produce a SIGBUS panic that I had not seen before:
 >
 > go 1.11.2 linux/amd64
 >
 > The service does set up its own SIGINT/SIGTERM handling via the 
 typical siginal.Notify approach. The nature of the program is that it 
 listens on nats.io message queues, and receives requests to run tasks 
 as sub-processes. My tests have been running between 40-200 of these 
 instances over the course of a few days. But this panic occurred on a 
 completely different machine that those I had been testing...
 >
 > goroutine 1121 [runnable (scan)]:
 > fatal error: unexpected signal during runtime execution
 > panic during panic
 > [signal SIGBUS: bus error code=0x2 addr=0xfa2adc pc=0x451637]
 >
 > runtime stack:
 > runtime.throw(0xcf7fe3, 0x2a)
 > /vol/apps/go/1.11.2/src/runtime/panic.go:608 +0x72
 > runtime.sigpanic()
 > /vol/apps/go/1.11.2/src/runtime/signal_unix.go:374 +0x2f2
 > runtime.gentraceback(0x, 0x, 0x0, 
 0xc0004baa80, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, ...)
 > /vol/apps/go/1.11.2/src/runtime/traceback.go:190 +0x377
 > runtime.traceback1(0x, 0x, 0x0, 
 0xc0004baa80, 0x0)
 > /vol/apps/go/1.11.2/src/runtime/traceback.go:728 +0xf3
 > runtime.traceback(0x, 0x, 0x0, 
 0xc0004baa80)
 > /vol/apps/go/1.11.2/src/runtime/traceback.go:682 +0x52
 > runtime.tracebackothers(0xc00012e780)
 > /vol/apps/go/1.11.2/src/runtime/traceback.go:947 +0x187
 > runtime.dopanic_m(0xc00012e780, 0x42dcc2, 0x7f83f6ffc808, 0x1)
 > /vol/apps/go/1.11.2/src/runtime/panic.go:805 +0x2aa
 > runtime.fatalthrow.func1()
 > /vol/apps/go/1.11.2/src/runtime/panic.go:663 +0x5f
 > runtime.fatalthrow()
 > /vol/apps/go/1.11.2/src/runtime/panic.go:660 +0x57
 > runtime.throw(0xcf7fe3, 0x2a)
 > /vol/apps/go/1.11.2/src/runtime/panic.go:608 +0x72
 > runtime.sigpanic()
 > /vol/apps/go/1.11.2/src/runtime/signal_unix.go:374 +0x2f2
 > runtime.gentraceback(0x, 0x, 0x0, 
 0xc0004baa80, 0x0, 0x0, 0x7fff, 0x7f83f6ffcd00, 0x0, 0x0, ...)
 > /vol/apps/go/1.11.2/src/runtime/traceback.go:190 +0x377
 > runtime.scanstack(0xc0004baa80, 0xc31270)
 > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:786 +0x15a
 > runtime.scang(0xc0004baa80, 0xc31270)
 > /vol/apps/go/1.11.2/src/runtime/proc.go:947 +0x218
 > runtime.markroot.func1()
 > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:264 +0x6d
 > runtime.markroot(0xc31270, 0xc00047)
 > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:245 +0x309
 > runtime.gcDrain(0xc31270, 0x6)
 > /vol/apps/go/1.11.2/src/runtime/mgcmark.go:882 +0x117
 > runtime.gcBgMarkWorker.func2()
 > /vol/apps/go/1.11.2/src/runtime/mgc.go:1858 +0x13f
 > runtime.systemstack(0x7f83f7ffeb90)
 > /vol/apps/go/1.11.2/src/runtime/asm_amd64.s:351 +0x66
 > runtime.mstart()
 > /vol/apps/go/1.11.2/src/runtime/proc.go:1229
 >
 > Much appreciated for any insight.

 Is the problem repeatable?

 It looks like it crashed while tracing back the stack during garbage
 collection, but I don't know why since the panic was evidently able to
 trace back the stack just fine.

>>>
>>>
>>> Thanks for the reply. Unfortunately it was rare and never happened in my 
>>> own testing of thousands of runs of this service. The colleague that saw 
>>> this crash on one of his workstations was not able to repro it after 
>>> attempting another run of 

[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread vaastav anand
It could be due to some anti-virus scanner deleting files.
Here is the relevant issue : https://github.com/golang/go/issues/26195

On Monday, 29 April 2019 22:02:33 UTC-7, Avetis Sargsian wrote:
>
> I set GOTMPDIR to E:\temp folder
>>
> and here is the result 
>
> PS F:\GoWorckspace\src\hello> go install
> open E:\temp\go-build447177998\b001\exe\a.out.exe: The system cannot find 
> the file specified.
>
> PS F:\GoWorckspace\src\hello> go build
> open E:\temp\go-build140959642\b001\exe\a.out.exe: The system cannot find 
> the file specified. 
>
> PS F:\GoWorckspace\src\hello> go run hello.go
> open E:\temp\go-build609689226\b001\exe\hello.exe: The system cannot find 
> the file specified.
>  
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread Avetis Sargsian

>
> I set GOTMPDIR to E:\temp folder
>
and here is the result 

PS F:\GoWorckspace\src\hello> go install
open E:\temp\go-build447177998\b001\exe\a.out.exe: The system cannot find 
the file specified.

PS F:\GoWorckspace\src\hello> go build
open E:\temp\go-build140959642\b001\exe\a.out.exe: The system cannot find 
the file specified. 

PS F:\GoWorckspace\src\hello> go run hello.go
open E:\temp\go-build609689226\b001\exe\hello.exe: The system cannot find 
the file specified.
 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] There is definitely a race condition, why it can't be detected by race condition detector?

2019-04-29 Thread jackinwhat
On line 85 in 
https://github.com/golang/go/blob/release-branch.go1.12/src/sync/mutex.go , 
the code " old := m.state " is weired because m.state is read and write by 
different goroutine.
Why it can't be detected by race condition detector.


I write a function Test with race condition problem. 
If put it in src/sync/mutex.go, it can't be detected.
If put it in other package like os.go, it can be detected.
That's weired, anyone has some idea ?


package main
import(
"sync"
"os")
func main(){
sync.Test()// race condition will not detect
os.Test()  // race condition will detect}



func Test(){
a := int32(1)

if race.Enabled {
race.Acquire(unsafe.Pointer())
}

go func(){
atomic.CompareAndSwapInt32(, 1, 4)
}()
_ = a}

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Strange error after adding another sample code

2019-04-29 Thread suntong001
Ah, that's 2nd condition to use tests in package with the "_test" 
as package, which I've forgotten. 

Thanks!

On Monday, April 29, 2019 at 9:04:15 PM UTC-4, vaastav anand wrote:
>
> The issue is that you have multiple package names in the same folder. In 
> this specific case it is easygen and easygen_test.
> You should have 1 package per folder.
> The reason your test files did not raise this issue is because _test.go 
> files are automatically excluded when packages are being compiled. But its 
> not the same case with _execute.go files
>
> On Monday, 29 April 2019 16:18:29 UTC-7, sunto...@gmail.com wrote:
>>
>> What does the following error really means? 
>>
>> can't load package: package ./.: found packages easygen (config.go) and 
>> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
>> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
>> easygen_test (example_execute.go) in /path/to/src/
>> github.com/go-easygen/easygen
>>
>> I'm been adding example tests to my package using the "_test" 
>> as package without any problem. However, the one I've just added,
>>
>> https://github.com/go-easygen/easygen/blob/master/example_execute.g0
>>
>> gives me errors now. and I have no idea why. 
>>
>> Here is how to duplicate the problem. 
>> WIthin the `go-easygen/easygen` folder:
>>
>>
>> $ go test ./... 
>> ok  _/path/to/go-easygen/easygen (cached)
>> ok  _/path/to/go-easygen/easygen/cmd/easygen (cached)
>> ok  _/path/to/go-easygen/easygen/egCal(cached)
>> ok  _/path/to/go-easygen/easygen/egVar(cached)
>>
>>
>> $ mv example_execute.g0 example_execute.go
>>
>>
>> $ go test ./... 
>> can't load package: package ./.: found packages easygen (config.go) and 
>> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
>> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
>> easygen_test (example_execute.go) in /path/to/src/
>> github.com/go-easygen/easygen
>>
>>
>> $ head -1 example_test.go > /tmp/f1
>>
>>
>> $ head -1 example_execute.go > /tmp/f2
>>
>>
>> $ diff /tmp/f1 /tmp/f2 && echo same 
>> same
>>
>>
>>
>> Please help. Thx!
>>
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Facebook web app and go?

2019-04-29 Thread Nathan Fisher
If you’re in AppEngine/GCP territory already there’s CloudDatastore
(NoSQL), Blockstorage, and Memcache which used to all be available in their
free tier. There’s emulators available in the gcloud tool kit that provides
a reasonable local development experience.

Cheers!
Nathan

On Mon, Apr 29, 2019 at 22:12, Miguel Angel Rivera Notararigo <
ntr...@gmail.com> wrote:

> Hi! you could use the standard library, take a look at
> https://golang.org/pkg/net/http and https://golang.org/pkg/html/template/
> packages, should be enough with them. It looks like an embedded database
> fits for your use case, you could use https://github.com/dgraph-io/badger
> or SQLite if you prefer relational databases
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Nathan Fisher
 w: http://junctionbox.ca/

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Facebook web app and go?

2019-04-29 Thread Miguel Angel Rivera Notararigo
Hi! you could use the standard library, take a look at
https://golang.org/pkg/net/http and https://golang.org/pkg/html/template/
packages, should be enough with them. It looks like an embedded database
fits for your use case, you could use https://github.com/dgraph-io/badger
or SQLite if you prefer relational databases

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Strange error after adding another sample code

2019-04-29 Thread vaastav anand
The issue is that you have multiple package names in the same folder. In 
this specific case it is easygen and easygen_test.
You should have 1 package per folder.
The reason your test files did not raise this issue is because _test.go 
files are automatically excluded when packages are being compiled. But its 
not the same case with _execute.go files

On Monday, 29 April 2019 16:18:29 UTC-7, sunto...@gmail.com wrote:
>
> What does the following error really means? 
>
> can't load package: package ./.: found packages easygen (config.go) and 
> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
> easygen_test (example_execute.go) in /path/to/src/
> github.com/go-easygen/easygen
>
> I'm been adding example tests to my package using the "_test" as 
> package without any problem. However, the one I've just added,
>
> https://github.com/go-easygen/easygen/blob/master/example_execute.g0
>
> gives me errors now. and I have no idea why. 
>
> Here is how to duplicate the problem. 
> WIthin the `go-easygen/easygen` folder:
>
>
> $ go test ./... 
> ok  _/path/to/go-easygen/easygen (cached)
> ok  _/path/to/go-easygen/easygen/cmd/easygen (cached)
> ok  _/path/to/go-easygen/easygen/egCal(cached)
> ok  _/path/to/go-easygen/easygen/egVar(cached)
>
>
> $ mv example_execute.g0 example_execute.go
>
>
> $ go test ./... 
> can't load package: package ./.: found packages easygen (config.go) and 
> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
> easygen_test (example_execute.go) in /path/to/src/
> github.com/go-easygen/easygen
>
>
> $ head -1 example_test.go > /tmp/f1
>
>
> $ head -1 example_execute.go > /tmp/f2
>
>
> $ diff /tmp/f1 /tmp/f2 && echo same 
> same
>
>
>
> Please help. Thx!
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Strange error after adding another sample code

2019-04-29 Thread suntong001
What does the following error really means? 

can't load package: package ./.: found packages easygen (config.go) and 
easygen_test (example_execute.go) in /path/to/go-easygen/easygen
cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
easygen_test (example_execute.go) in 
/path/to/src/github.com/go-easygen/easygen

I'm been adding example tests to my package using the "_test" as 
package without any problem. However, the one I've just added,

https://github.com/go-easygen/easygen/blob/master/example_execute.g0

gives me errors now. and I have no idea why. 

Here is how to duplicate the problem. 
WIthin the `go-easygen/easygen` folder:


$ go test ./... 
ok  _/path/to/go-easygen/easygen (cached)
ok  _/path/to/go-easygen/easygen/cmd/easygen (cached)
ok  _/path/to/go-easygen/easygen/egCal(cached)
ok  _/path/to/go-easygen/easygen/egVar(cached)


$ mv example_execute.g0 example_execute.go


$ go test ./... 
can't load package: package ./.: found packages easygen (config.go) and 
easygen_test (example_execute.go) in /path/to/go-easygen/easygen
cmd/easygen/flags.go:12:2: found packages easygen (config.go) and 
easygen_test (example_execute.go) in 
/path/to/src/github.com/go-easygen/easygen


$ head -1 example_test.go > /tmp/f1


$ head -1 example_execute.go > /tmp/f2


$ diff /tmp/f1 /tmp/f2 && echo same 
same



Please help. Thx!


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread 'Xiaohua(Tony) Guan' via golang-nuts
What is the output of your "go build" under the dir?

Please give a pre and after capture.

On Sunday, April 28, 2019 at 6:45:20 AM UTC-7, Avetis Sargsian wrote:
>
> Hi everyone, as you can see from the topic I am new to Go
>
> I follow the instruction on this page 
> https://golang.org/doc/code.html#Workspaces to launch hello.go and face 
> some difficulties
>
> So, I downloded and installed  MSI file  foe 
> Windows
>
> Here is my Go version:
> go version go1.12.4 windows/amd64
>
> my go env:
> set GOARCH=amd64
> set GOBIN=F:\GoWorckspace\bin
> set GOCACHE=C:\Users\Avetis\AppData\Local\go-build
> set GOEXE=.exe
> set GOFLAGS=
> set GOHOSTARCH=amd64
> set GOHOSTOS=windows
> set GOOS=windows
> set GOPATH=F:\GoWorckspace
> set GOPROXY=
> set GORACE=
> set GOROOT=E:\Go
> set GOTMPDIR=
> set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
> set GCCGO=gccgo
> set CC=gcc
> set CXX=g++
> set CGO_ENABLED=1
> set GOMOD=
> set CGO_CFLAGS=-g -O2
> set CGO_CPPFLAGS=
> set CGO_CXXFLAGS=-g -O2
> set CGO_FFLAGS=-g -O2
> set CGO_LDFLAGS=-g -O2
> set PKG_CONFIG=pkg-config
> set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments 
> -fmessage-length=0 
> -fdebug-prefix-map=C:\Users\Avetis\AppData\Local\Temp\go-build714242958=/tmp/go-build
>  
> -gno-record-gcc-switches
>
> GOPATH dir structure is:
> -bin/
> -pkg/
> -src/
>  -hello/
> hello.go
>
>
> hello.go content:
>
>   package main
>
>   import (
>   "fmt"
>   )
>
>   func main() {
>   fmt.Println("Hello World!")
>   }
>
> when I am trying do go install I get this arror:
>  F:\GoWorckspace\src\hello> go install hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build786217674\b001\exe\a.out.exe: 
> The system cannot find the file specified.
>
> I have tried different options, but all of them lead to same error:
>
> PS F:\GoWorckspace\src> go install .\hello\hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build220985190\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go install .\hello
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build247169354\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go install hello
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build365645162\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go build .\hello\hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build274908638\b001\exe\a.out.exe: 
> The system cannot find the file specified.
>
>
> I will appreciate any help on this, thanks!
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread andrey mirtchovski
try setting GOTMPDIR. not sure what this corresponds to on windows,
but it will change where the go tool will create its temp files:

$ go run -x t.go
WORK=/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/go-build126372523
[...]
$ GOTMPDIR=/tmp/go go run -x t.go
WORK=/tmp/go/go-build661115935
[...]

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread Avetis Sargsian
Unfortunately changin GOCACHE variable didn't help
 

> PS F:\GoWorckspace\src\hello> go env
> set GOARCH=amd64
> set GOBIN=F:\GoWorckspace\bin
> set GOCACHE=F:\temp
> set GOEXE=.exe
> set GOFLAGS=
> set GOHOSTARCH=amd64
> set GOHOSTOS=windows
> set GOOS=windows
> set GOPATH=F:\GoWorckspace
> set GOPROXY=
> set GORACE=
> set GOROOT=C:\Go
> set GOTMPDIR=
> set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
> set GCCGO=gccgo
> set CC=gcc
> set CXX=g++
> set CGO_ENABLED=1
> set GOMOD=
> set CGO_CFLAGS=-g -O2
> set CGO_CPPFLAGS=
> set CGO_CXXFLAGS=-g -O2
> set CGO_FFLAGS=-g -O2
> set CGO_LDFLAGS=-g -O2
> set PKG_CONFIG=pkg-config
> set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments 
> -fmessage-length=0 
> -fdebug-prefix-map=C:\Users\Avetis\AppData\Local\Temp\go-build171002686=/tmp/go-build
>  
> -gno-record-gcc-switches
>
 

> PS F:\GoWorckspace\src\hello> go install
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build231890486\b001\exe\a.out.exe: 
> The system cannot find the file specified.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-29 Thread ksbhaskar
Nitish –

As noted, you cannot pass to C a pointer to Go structure. However, Go can 
use pointers C structures that are provided to it. YottaDB passes key-value 
tuples between C and Go, and you can look at working code that does this at 
https://gitlab.com/YottaDB/Lang/YDBGo with further documentation at 
https://docs.yottadb.com/MultiLangProgGuide/goprogram.html

After looking at the code and documentation, if you have specific 
questions, I can get them answered.

Regards
– Bhaskar

On Monday, April 29, 2019 at 3:43:35 PM UTC-4, Tamás Gulácsi wrote:
>
> 2019. április 29., hétfő 17:41:51 UTC+2 időpontban Nitish Saboo a 
> következőt írta:
>>
>> 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
>>
>>
> That depends on what that LogMessage is.
> If it is a struct, then you can get its fields.
> And you can use that pointer in some C functions - this depends on the 
> given API.
>
> If LogMessage is a struct, you may be able to convert it to its Go 
> equivalent - if it is not too complicated (no union, no packing...).
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-29 Thread Tamás Gulácsi
2019. április 29., hétfő 17:41:51 UTC+2 időpontban Nitish Saboo a 
következőt írta:
>
> 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
>
>
That depends on what that LogMessage is.
If it is a struct, then you can get its fields.
And you can use that pointer in some C functions - this depends on the 
given API.

If LogMessage is a struct, you may be able to convert it to its Go 
equivalent - if it is not too complicated (no union, no packing...).

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread Uli Kunitz
There is a problem with your C drive. Go uses it to store temporary files. 
The error messages says it cannot access a file that Go should have created 
there. It's either a full drive or a permission issues. You can change the 
location by changing the GOCACHE variable 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Facebook web app and go?

2019-04-29 Thread daniel . r . kegel
I'm a linux / c++ guy with an itch to try writing a tiny scalable web app.
I suspect golang and google app engine might be a good fit, and have been 
looking for an excuse to try them.

The app would:
- provide a facebook login button
- let user specify a facebook page
- post a message to that page
- use a database to remember state for each user 
- scale to 1,000 users

In my ten minutes of searching, I see:
- https://github.com/huandu/facebook looks like how people use facebook's 
graph api from glang
- https://gobuffalo.io looks like an all-encompassing go web app framework, 
but not particularly google app engine friendly, and
I'd like to avoid having to upload a whole docker image.

It seems clear how one would use huandu/facebook once logged in to 
facebook, but less clear how one would set up a web app to do that from.

Any favorite tutorials for how to get started?

Thanks!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread AndersonQ
Well, I don't have experience in Windows, but I'd suggest you to try:

1) get out of your GOPATH or set GO111MODULES=on
2) go mod init or go mod init hello
3) go mod tidy
4) go run main.go or go build && ./hello

Also, have a look at https://github.com/golang/go/wiki/Modules#quick-start

good luck!

Anderson

On Sunday, 28 April 2019 15:45:20 UTC+2, Avetis Sargsian wrote:
>
> Hi everyone, as you can see from the topic I am new to Go
>
> I follow the instruction on this page 
> https://golang.org/doc/code.html#Workspaces to launch hello.go and face 
> some difficulties
>
> So, I downloded and installed  MSI file  foe 
> Windows
>
> Here is my Go version:
> go version go1.12.4 windows/amd64
>
> my go env:
> set GOARCH=amd64
> set GOBIN=F:\GoWorckspace\bin
> set GOCACHE=C:\Users\Avetis\AppData\Local\go-build
> set GOEXE=.exe
> set GOFLAGS=
> set GOHOSTARCH=amd64
> set GOHOSTOS=windows
> set GOOS=windows
> set GOPATH=F:\GoWorckspace
> set GOPROXY=
> set GORACE=
> set GOROOT=E:\Go
> set GOTMPDIR=
> set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
> set GCCGO=gccgo
> set CC=gcc
> set CXX=g++
> set CGO_ENABLED=1
> set GOMOD=
> set CGO_CFLAGS=-g -O2
> set CGO_CPPFLAGS=
> set CGO_CXXFLAGS=-g -O2
> set CGO_FFLAGS=-g -O2
> set CGO_LDFLAGS=-g -O2
> set PKG_CONFIG=pkg-config
> set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments 
> -fmessage-length=0 
> -fdebug-prefix-map=C:\Users\Avetis\AppData\Local\Temp\go-build714242958=/tmp/go-build
>  
> -gno-record-gcc-switches
>
> GOPATH dir structure is:
> -bin/
> -pkg/
> -src/
>  -hello/
> hello.go
>
>
> hello.go content:
>
>   package main
>
>   import (
>   "fmt"
>   )
>
>   func main() {
>   fmt.Println("Hello World!")
>   }
>
> when I am trying do go install I get this arror:
>  F:\GoWorckspace\src\hello> go install hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build786217674\b001\exe\a.out.exe: 
> The system cannot find the file specified.
>
> I have tried different options, but all of them lead to same error:
>
> PS F:\GoWorckspace\src> go install .\hello\hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build220985190\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go install .\hello
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build247169354\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go install hello
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build365645162\b001\exe\a.out.exe: 
> The system cannot find the file specified.
> PS F:\GoWorckspace\src> go build .\hello\hello.go
> open 
> C:\Users\Avetis\AppData\Local\Temp\go-build274908638\b001\exe\a.out.exe: 
> The system cannot find the file specified.
>
>
> I will appreciate any help on this, thanks!
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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 msg;
> }
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-29 Thread Tamás Gulácsi
LogMessage *match(...) {
...
return msg;
}

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: the Dominance of English in Programming Languages

2019-04-29 Thread fbaube
It's interesting to see this!

Back in the early 1970s I wondered what the programming languages in other 
countries (not-USA) looked like - what were the keywords, etc. 

Well, it turns out that (AFAIK) they were using the same compilers and the 
same interpreters, and languages with the same English keywords, because 
(also AFAIK) nobody was writing non-English-keyword compilers in Europe and 
nobody was patching existing binaries (like BASIC.EXE) to change the 
keywords contained in executables.

cheers - fred

On Monday, April 29, 2019 at 11:58:50 AM UTC+3, yvan...@gmail.com wrote:
>
>
> In France we have WINDEV  
>
giving something like
> '''
> // Le document sera enregistré en noir et blanc
> SI TwainVersJPEG("C:\Temp\MaPhoto.JPEG", 0, Faux, TwainNoirBlanc) = Vrai 
> ALORS
> Info("Le document a été enregistré")
> SINON
> Erreur("Le document n'a pas été scanné")
> FIN
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Wojciech S. Czarnecki
On Mon, 29 Apr 2019 05:07:58 -0700 (PDT)
Volker Dobler  wrote:

> But if you try to teach 9 or 10 year old kids to program you cannot
> do this in the language alone, you need at least to import fmt.
> And while the handful of keywords are not a problem at all the
> packages used to do interesting things (for a 9 year old) are
> in English only.

Sed or gofix can cope with that and it is a duty of the teacher to
make a basic packages translation. The more important though
are manuals suitable for self-teaching. 

The [Python for Kids](https://jasonrbriggs.com/python-for-kids/) 
book has been translated to nine languages. (I hope Jason Briggs
will love Go too, and soon come with a new book for kids ;).

> Of course I would never advocate to program in Bavarian, or
> cuneiform, but if you are starting to learn a real programming
> language than there _is_ a language barrier. And this barrier
> is in addition to typing on a keyboard and the math and the
> logic and everything else.

Or it can be a strong impulse to learn English -- like 
music lyrics is to the less techie kids.


> Because of this real problem I thought about some package basic
> which could be an atypical collection of useful functions for
> educational purpose: Very simple input and output functions,
> graphic functions (like points, lines, ellipses, rectangles),
> a bit of sound (like 12 different tones and two beeps) with exported
> identifiers and the godoc in the child's first language so that a very
> young student can explore what is possible in a more appealing
> way than just println-based output.

Good idea. Ready to be picked up by some Khan Academy contractor.

> V.

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Volker Dobler
The number of keywords and their "origin language" does not matter
much, that is something we probably can all agree to, especially
with the very few kewords in Go.

But if you try to teach 9 or 10 year old kids to program you cannot
do this in the language alone, you need at least to import fmt.
And while the handful of keywords are not a problem at all the
packages used to do interesting things (for a 9 year old) are
in English only.

Of course I would never advocate to program in Bavarian, or
cuneiform, but if you are starting to learn a real programming
language than there _is_ a language barrier. And this barrier
is in addition to typing on a keyboard and the math and the
logic and everything else.

Because of this real problem I thought about some package basic
which could be an atypical collection of useful functions for
educational purpose: Very simple input and output functions,
graphic functions (like points, lines, ellipses, rectangles),
a bit of sound (like 12 different tones and two beeps) with exported
identifiers and the godoc in the child's first language so that a very
young student can explore what is possible in a more appealing
way than just println-based output.

V.



On Monday, 29 April 2019 11:10:28 UTC+2, Max wrote:
>
> I am Italian, and I learned to program quite early - before really knowing 
> English.
>
> In my experience, the fact that most programming languages use English 
> keywords is not a big obstacle - for two reasons:
> 1) each programming language has very few reserved keywords - dozens at 
> most, compared to thousands of words you need to know in a new foreign 
> language.
> 2) a programming language is a **language** anyway, so the effort is 
> mostly in learning the meaning of each keyword, its syntax, and how to use 
> it.
>
> Having said that, English speakers have great advantages when studying 
> programs documentation, as most languages and libraries are **documented** 
> and commented in English.
> But in my opinion the fragmentation created by "everyone writes programs, 
> comments and docs in its own language" would be **much** worse.
>
> For reference, some years ago at work I had to integrate a program written 
> in German - identifiers, function names, even comments were in German.
> It was a nightmare, and it took months even with help from other (Italian) 
> people that knew the program and the meaning of each identifier and 
> function.
>
> Regards,
> cosmos72
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-29 Thread Wojciech S. Czarnecki
On Mon, 29 Apr 2019 04:40:51 -0700 (PDT)
Nitish Saboo  wrote:

> Can someone please guide me with the references or steps to integrate Go 
> Code with Node.js ?

Usually you write a go RPC server then you call it from the javascript side.
Or vice versa.

https://www.google.com/search?q=go+microservices

Its easy and fast and there soon will be that pivot point that
you realize you need not node.js anymore ;)

https://scotch.io/tutorials/moving-from-nodejs-to-go

Hope this helps,

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[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 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread John McKown
The solution is simple. Just program in APL. Then _nobody_ can understand
your program and so it is "fair" to all. It is a "write only" language.

https://en.wikipedia.org/wiki/APL_(programming_language)

Game of Life[edit

]

The following function "life", written in Dyalog APL, takes a boolean
matrix and calculates the new generation according to Conway's Game of Life
. It demonstrates
the power of APL to implement a complex algorithm in very little code, but
it is also very hard to follow unless one has advanced knowledge of APL.
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

-- 
This is clearly another case of too many mad scientists, and not enough
hunchbacks.


Maranatha! <><
John McKown

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread amnonbc
We would have even more fun if we had non-latin characters in keywords 
aliases,
and supported both left-to-right and right-to-left writing directions.
But I doubt that this will make programs more readable for everyone.

On Monday, 29 April 2019 10:10:28 UTC+1, Max wrote:
>
> I am Italian, and I learned to program quite early - before really knowing 
> English.
>
> In my experience, the fact that most programming languages use English 
> keywords is not a big obstacle - for two reasons:
> 1) each programming language has very few reserved keywords - dozens at 
> most, compared to thousands of words you need to know in a new foreign 
> language.
> 2) a programming language is a **language** anyway, so the effort is 
> mostly in learning the meaning of each keyword, its syntax, and how to use 
> it.
>
> Having said that, English speakers have great advantages when studying 
> programs documentation, as most languages and libraries are **documented** 
> and commented in English.
> But in my opinion the fragmentation created by "everyone writes programs, 
> comments and docs in its own language" would be **much** worse.
>
> For reference, some years ago at work I had to integrate a program written 
> in German - identifiers, function names, even comments were in German.
> It was a nightmare, and it took months even with help from other (Italian) 
> people that knew the program and the meaning of each identifier and 
> function.
>
> Regards,
> cosmos72
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Wojciech S. Czarnecki
On Mon, 29 Apr 2019 07:35:56 +0200
Chris Burkert  wrote:

> I recently read an article (German) about the dominance of English in
> programming languages [1]. It is about the fact that keywords in a language
> typically are English words. Thus it would be hard for non English speakers
> to learn programming - argue the authors.

Its an ever resurrecting topic in some science-impaired nationalist's circles. 

At the dawn of the age of enlightenment they were lamenting that one
must know also Greek to fully participate in discourse and that Greek is
hard. Then they were lamenting that one need to know French due to
its "unfair" dominance. Then for over a century they lamented that all
worthy physical sciences and engineering manuals were printed
in German.

Ubiquoteness of some languages is just a byproduct.
In any given epoch sciences and art are lead by people of a country(ies)
that let their people flourish. In the middle-ages most new science was done
and described in Arabic. In the XXII century it could be Mandarin.

> the fact that keywords in a language typically are English words.
> Thus it would be hard for non English speakers to learn programming 
> - argue the authors

Seriously? Are they really arguing that someone who can not memorize
meaning of 25 to 150 words written not in mother's tongue can cope with
all that math and logic she needs to understand to become a programmer?

Excuse me, but it is just nationalist's babble.

> I wonder if there is really demand for that

Ask MS Excel users whether they applaud translated math/statistical function
names. Is really 'FLOOR' less understandable to them than 'ZDCWD' acronym
for 'ZAOKRĄGLIJ DO CAŁKOWITEJ W DÓŁ' (or like, haven't seen it in years). 

> Besides keywords we have a lot of names for functions, methods, structs,
> interfaces and so on. So there is definitely more to it.

Go ecostystem is unicode from the onset. You can use German, Georgian or
even Klingon for your identifiers. So you already have a way to produce source
code that only German speaking part of the world would care of. And a way to
cut pupils off all the dangers that non German-speaking world poses ;>.

> I also believe the authors totally miss the point that learning Go is about
> to learn a language as it is because it is the language of the compiler.
(Sigh of relief :)

> However I find the topic interesting and want to hear about your opinions.
> thanks - Chris

Your Welcome :)

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-29 Thread Nitish Saboo
Hi,

void match(const gchar *pattern, size_t pattern_len, const gchar *program,
size_t program_len)
{
LogMessage *msg = log_msg_new_empty();
PDBInput input;

log_msg_set_value(msg, LM_V_MESSAGE, pattern, pattern_len);
log_msg_set_value(msg, LM_V_PROGRAM, program, program_len);
pattern_db_process(patterndb, PDB_INPUT_WRAP_MESSAGE(, msg));
log_msg_unref(msg);
}

This match is being called from the GO code.

log message object is getting created that has key-value pairs.

I want to return the key-value pair log message object to the Go code.How
can I achieve this ?

Thanks

On Fri, Apr 26, 2019 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 a pointer to a Go function, and
> then accessed the value after the Go function returns.
>
> This is kind of hard to discuss in the abstract; maybe you should show
> us some code?
>
> Ian
>
>
> > 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 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
> ?
> >>
> >> The first part of the question is discussed in great detail here:
> >> https://golang.org/cmd/cgo/#hdr-Passing_pointers
> >
> > --
> > 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.
> > For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Max
I am Italian, and I learned to program quite early - before really knowing 
English.

In my experience, the fact that most programming languages use English 
keywords is not a big obstacle - for two reasons:
1) each programming language has very few reserved keywords - dozens at 
most, compared to thousands of words you need to know in a new foreign 
language.
2) a programming language is a **language** anyway, so the effort is mostly 
in learning the meaning of each keyword, its syntax, and how to use it.

Having said that, English speakers have great advantages when studying 
programs documentation, as most languages and libraries are **documented** 
and commented in English.
But in my opinion the fragmentation created by "everyone writes programs, 
comments and docs in its own language" would be **much** worse.

For reference, some years ago at work I had to integrate a program written 
in German - identifiers, function names, even comments were in German.
It was a nightmare, and it took months even with help from other (Italian) 
people that knew the program and the meaning of each identifier and 
function.

Regards,
cosmos72

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: the Dominance of English in Programming Languages

2019-04-29 Thread yvan . godin

just for fun 
In France we have WINDEV where you can write code either in English or 
French ;-)  but no German :-(
unfortunately not free product 

giving something like
'''
// Le document sera enregistré en noir et blanc
SI TwainVersJPEG("C:\Temp\MaPhoto.JPEG", 0, Faux, TwainNoirBlanc) = Vrai 
ALORS
Info("Le document a été enregistré")
SINON
Erreur("Le document n'a pas été scanné")
FIN
'''
source here 

Le lundi 29 avril 2019 07:36:37 UTC+2, Chris Burkert a écrit :
>
> I recently read an article (German) about the dominance of English in 
> programming languages [1]. It is about the fact that keywords in a language 
> typically are English words. Thus it would be hard for non English speakers 
> to learn programming - argue the authors.
>
> I wonder if there is really demand for that but of course it is weird to 
> ask that on an English list.
>
> I also wonder if it would be possible on a tooling level to support 
> keywords in other languages e.g. via build tags: // +language german
>
> Besides keywords we have a lot of names for functions, methods, structs, 
> interfaces and so on. So there is definitely more to it.
>
> While such a feature may be beneficial for new programmers, to me it comes 
> with many downsides like: readability, ambiguous naming / clashes, global 
> teams ...
>
> I also believe the authors totally miss the point that learning Go is 
> about to learn a language as it is because it is the language of the 
> compiler.
>
> However I find the topic interesting and want to hear about your opinions.
>
> thanks - Chris
>
> 1: 
>
> https://www.derstandard.de/story/2000101285309/programmieren-ist-fuer-jeden-aber-nur-wenn-man-englisch-spricht
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Sebastien Binet
On Mon, Apr 29, 2019 at 8:08 AM Reto  wrote:

> In my view you don't necessarily need to speak English, although it helps
> a lot.
> Go uses utf-8 for all identifiers, so assuming you treat the keywords as
> blobs and just remember when to use which you should be fine.
>
> The issue being more that all existing packages worth using are written
> with English identifiers, it being the defacto universal language of the
> world.
> Same goes for the corresponding docs.
>
> Writing programs in multiple languages just fragments the ecosystem for no
> real benefit.
>

and imagine having to debug a program written in - say - russian, with all
the variables, functions (and their abbreviations) and comments in russian.
(I am not picking on russian programs.
It just happens that during my PhD, I'd inherited a physics simulation
program written by russian colleagues, and I had to maintain and develop it.
not something I want to do ever again :P)

cheers,
-s

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] the Dominance of English in Programming Languages

2019-04-29 Thread Reto
In my view you don't necessarily need to speak English, although it helps a lot.
Go uses utf-8 for all identifiers, so assuming you treat the keywords as blobs 
and just remember when to use which you should be fine.

The issue being more that all existing packages worth using are written with 
English identifiers, it being the defacto universal language of the world.
Same goes for the corresponding docs.

Writing programs in multiple languages just fragments the ecosystem for no real 
benefit.

-- 
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.
For more options, visit https://groups.google.com/d/optout.