Re: [go-nuts] Go Documentation

2018-12-19 Thread Francisco Dalla Rosa Soares
Hi Kazuya, I'm not sure what you mean by "learn how to write go documentation". * Do you want guidelines for contributing to the official documentation? * Do want a guide for how to write documentation for your own packages? I guess a lot of the experienced people here can give you tips, but I'd

[go-nuts] Go Documentation

2018-12-19 Thread 伊藤和也
Are there any teaching materials to learn how to write go documentations? -- 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

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Jan Mercl
On Wed, Dec 19, 2018 at 9:16 PM Jan Mercl <0xj...@gmail.com> wrote: >> On Wed, Dec 19, 2018 at 9:09 PM Viktor Kojouharov wrote: >> >> I'm interested to know whether it was considered (I can't imagine that it wasn't) for if and switch statements to be expressions instead > > I can't imagine it was

[go-nuts] Android self-hosted (native+IDE)

2018-12-19 Thread Dmitry Ponyatov
What about current progress on porting Go to Android (self-hosted SDK)? Does somebody is working on it? -- 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-nu

Re: [go-nuts] Re: performance optimization

2018-12-19 Thread Robert Engels
Then something is broken on the implementation. 10x overhead does not seem realistic. > On Dec 19, 2018, at 9:50 PM, Ian Lance Taylor wrote: > >> On Wed, Dec 19, 2018 at 6:52 PM robert engels wrote: >> >> I don’t think the analysis is correct in the issue cited. No one mentions >> just usin

Re: [go-nuts] Re: performance optimization

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 6:52 PM robert engels wrote: > > I don’t think the analysis is correct in the issue cited. No one mentions > just using usleep() as the system call like a C program would, at least for > time.Sleep(), and block the calling thread. That doesn't scale to large numbers of g

[go-nuts] GO build can't find package - Need help!!

2018-12-19 Thread Bhoompally Manipal
New to go...trying to build go project using "go build main.go" fails with the below error. verified the $GOPATH (C:\Users\mbhoompa\go) and $GOROOT (C:\Go). Looks like its trying to append $GOPATH twice..any thoughts? config\config.go:4:2: cannot find package "_/C_/Users/mbhoompa/go/src/sft

Re: [go-nuts] Re: performance optimization

2018-12-19 Thread robert engels
I don’t think the analysis is correct in the issue cited. No one mentions just using usleep() as the system call like a C program would, at least for time.Sleep(), and block the calling thread. For the timer based select, it is more difficult, and it seems the timerfd is the best solution - but

[go-nuts] Re: performance optimization

2018-12-19 Thread djadala
see https://github.com/golang/go/issues/27707 -- 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 ht

[go-nuts] Re: Defer, clousures and structs

2018-12-19 Thread Victor Giordano
INDEED HELPS A LOT. Thanks for pointing that out!. Thanks Scott! The best greetings!! V El miércoles, 19 de diciembre de 2018, 20:52:18 (UTC-3), Scott Cotton escribió: > > > Hi, > > I think it's pretty clear with 3 rules: > > 1. Go is call by value, so structs are copied on calls while pointer

[go-nuts] Re: Defer, clousures and structs

2018-12-19 Thread Scott Cotton
Hi, I think it's pretty clear with 3 rules: 1. Go is call by value, so structs are copied on calls while pointer to structs are not. 2. Methods a.M(x) are just function calls f(a, x). 2. defer foo(bar) will evaluate the expression leading to a function, foo, and the argument bar, in the con

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 2:55 PM Peter Kleiweg wrote: > > Ian Lance Taylor schreef op 19 december 2018 23:27:13 CET: > > On Wed, Dec 19, 2018 at 2:15 PM Peter Kleiweg > > wrote: > > > > > > > I assume that the recompile fails because compiling the C code > > fails. > > > You should compile the C

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Peter Kleiweg
Ian Lance Taylor schreef op 19 december 2018 23:27:13 CET: > On Wed, Dec 19, 2018 at 2:15 PM Peter Kleiweg > wrote: > > > > > I assume that the recompile fails because compiling the C code > fails. > > You should compile the C code yourself, producing a .syso file. You > > should add that .syso

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Rob Pike
BCPL had a construct like this, and we did consider doing something analogous, but in the end Go is not an expression language. C and BCPL are, and that property does lead to problems, although they are probably avoidable with careful language design. But Go is not an expression language, so contr

[go-nuts] Defer, clousures and structs

2018-12-19 Thread Victor Giordano
Perhaps someone could explain to me (or enlight a litte bit why): why the defer is working like is working in the following cases, so, allow me to go straight to the examples: *https://play.golang.org/p/rLJ48Wur-n0* *My "**rought" **interpretation*: When th

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 2:15 PM Peter Kleiweg wrote: > > > I assume that the recompile fails because compiling the C code fails. > You should compile the C code yourself, producing a .syso file. You > should add that .syso file to your package directory. You should > remove the C code from your

Re: [go-nuts] performance optimization

2018-12-19 Thread robert engels
Isn’t doesn’t even need to be that complex, the following uses 1.25 cores at 100% on my machine: package main import "time" func main() { counter := 0 for { counter++ time.Sleep(time.Microsecond) } } even if you change it to 100 usecs, which is only 10,000 times a second,

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Peter Kleiweg
> I assume that the recompile fails because compiling the C code fails. You should compile the C code yourself, producing a .syso file. You should add that .syso file to your package directory. You should remove the C code from your package directory--you can still put it in a subdirectory, of co

Re: [go-nuts] performance optimization

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 1:29 PM Tamás Király wrote: > > my task is to update a value every microsecond. > i did an it with an infinite loop with time.Sleep like this > > https://play.golang.org/p/JiN3_5KiGOO > > this causes me about 50-60% of CPU usage on my machine but i made another > version w

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Tyler Compton
There is some precedent. Python has an if expression of sorts that is distinct from its if statements: print(value1 if condition else value2) And in all Lisp dialects I'm familiar with, if is an expression: (print (if condition value1 value2)) Not to say that this means Go should support it nec

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 12:09 PM Viktor Kojouharov wrote: > > I've tried and failed at finding any previous discussion on this topic, so do > point me to one if it exists. > > I'm interested to know whether it was considered (I can't imagine that it > wasn't) for if and switch statements to be e

[go-nuts] performance optimization

2018-12-19 Thread Tamás Király
hi! my task is to update a value every microsecond. i did an it with an infinite loop with *time.Sleep* like this https://play.golang.org/p/JiN3_5KiGOO this causes me about 50-60% of CPU usage on my machine but i made another version with *time.After*: https://play.golang.org/p/PQHsNq261qZ thi

Re: [go-nuts] Possibly broken go compiler (specific situation inside)

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 7:46 AM Ian Lance Taylor wrote: > > On Wed, Dec 19, 2018 at 7:37 AM Miroslav Němec wrote: > > > > I have an example of uncompilable code here - > > https://play.golang.org/p/yIYEa1YcQfs , compiler wrongly identifies type of > > A.c . > > > > I can go around the issue whe

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Jan Mercl
On Wed, Dec 19, 2018 at 9:09 PM Viktor Kojouharov wrote: > I'm interested to know whether it was considered (I can't imagine that it wasn't) for if and switch statements to be expressions instead I can't imagine it was considered. Is there a precedence in other language? Not even C supports tha

[go-nuts] if/switch statements as expressions

2018-12-19 Thread Viktor Kojouharov
Hello, I've tried and failed at finding any previous discussion on this topic, so do point me to one if it exists. I'm interested to know whether it was considered (I can't imagine that it wasn't) for if and switch statements to be expressions instead, and if so, why were they ultimately left

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 10:50 AM Peter Kleiweg wrote: > > How do I do what runtime/race does? Is it what I want? > > I have a package with C and Go files. I want to install that package. Then I > want to import that package into a program, and build that program without > recompiling the package

Re: [go-nuts] Go Modules should detect breaking changes on public API (exported members) end enforce semver

2018-12-19 Thread Geovani de Souza
Nice, thank you! Em qua, 19 de dez de 2018 às 17:11, Paul Jolly escreveu: > Oh, and > https://github.com/go-modules-by-example/index/blob/master/019_apidiff/README.md > for a quick demo on apidiff. > > On Wed, 19 Dec 2018 at 19:10, Paul Jolly wrote: > > > > Please see: > > > > * https://github.

Re: [go-nuts] Go Modules should detect breaking changes on public API (exported members) end enforce semver

2018-12-19 Thread Paul Jolly
Oh, and https://github.com/go-modules-by-example/index/blob/master/019_apidiff/README.md for a quick demo on apidiff. On Wed, 19 Dec 2018 at 19:10, Paul Jolly wrote: > > Please see: > > * https://github.com/golang/go/issues/26420 > * https://godoc.org/golang.org/x/exp/cmd/apidiff which uses > ht

Re: [go-nuts] Go Modules should detect breaking changes on public API (exported members) end enforce semver

2018-12-19 Thread Paul Jolly
Please see: * https://github.com/golang/go/issues/26420 * https://godoc.org/golang.org/x/exp/cmd/apidiff which uses https://godoc.org/golang.org/x/exp/apidiff Effectively what you are discussing is broadly covered, at least based on current thinking, in the go release command. On Wed, 19 Dec 201

[go-nuts] Go Modules should detect breaking changes on public API (exported members) end enforce semver

2018-12-19 Thread Geovani de Souza
First, let me say that the current implementation of Go Modules is awesome and solves most of the problems I've faced until now. In the spirit of embracing good packages and stability for consumers, I think that the current tooling should detect breaking changes and enforce (or at least, recomm

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Peter Kleiweg
How do I do what runtime/race does? Is it what I want? I have a package with C and Go files. I want to install that package. Then I want to import that package into a program, and build that program without recompiling the package. Because recompile fails. How do I do that? This was an issue be

Re: [go-nuts] Go 1.12 Beta 1 is released

2018-12-19 Thread Ian Lance Taylor
On Tue, Dec 18, 2018 at 10:07 PM Peter Kleiweg wrote: > > Go 1.12 is the last release that will support binary-only packages. > > What are the alternatives? > > I need binary-only packages for packages that use cgo with non-standard > environment variable values. You can compile your C code into

Re: [go-nuts] Possibly broken go compiler (specific situation inside)

2018-12-19 Thread Ian Lance Taylor
On Wed, Dec 19, 2018 at 7:37 AM Miroslav Němec wrote: > > I have an example of uncompilable code here - > https://play.golang.org/p/yIYEa1YcQfs , compiler wrongly identifies type of > A.c . > > I can go around the issue when I move newA function below type definitions > https://play.golang.org/

[go-nuts] Possibly broken go compiler (specific situation inside)

2018-12-19 Thread Miroslav Němec
Hello, I have an example of uncompilable code here - https://play.golang.org/p/yIYEa1YcQfs , compiler wrongly identifies type of A.c . I can go around the issue when I move newA function below type definitions https://play.golang.org/p/jLh2fYBu5mc . Is this a compiler issue, or does really ty

Re: [go-nuts] Re: [gollvm] Compilation of assembly (.s) file fails - maybe a multiline handling issue? (code to reproduce inside)

2018-12-19 Thread Benedikt T
Thanks for the tip Than. You are helping me understand this bit by bit ;) I'm guessing I have to adjust these portions (if no specific gccgo build tag is available)? Best, Benedikt On Wednesday, December 19, 2018 at 3:05:08 PM UTC+1, Than McIntosh wrote: > > On Wed, Dec 19, 2018 at 8:52 AM Ben

Re: [go-nuts] Re: [gollvm] Compilation of assembly (.s) file fails - maybe a multiline handling issue? (code to reproduce inside)

2018-12-19 Thread 'Than McIntosh' via golang-nuts
On Wed, Dec 19, 2018 at 8:52 AM Benedikt T wrote: > Okay, I moved the multiline definitions into one line respectively, which > solved some of the errors. So this seems to be in fact related to how the > file is being handled by the assembler. Now I still need to fix the > following errors: > W

[go-nuts] Re: [gollvm] Compilation of assembly (.s) file fails - maybe a multiline handling issue? (code to reproduce inside)

2018-12-19 Thread Benedikt T
Okay, I moved the multiline definitions into one line respectively, which solved some of the errors. So this seems to be in fact related to how the file is being handled by the assembler. Now I still need to fix the following errors: root@llvmbuilder-successful-s-1vcpu-2gb-fra1-s-1vcpu-2gb-fra1-

[go-nuts] Re: [gollvm] Compilation of assembly (.s) file fails - maybe a multiline handling issue? (code to reproduce inside)

2018-12-19 Thread Benedikt T
Okay, I moved the multiline definitions into one line respectively, which solved some of the errors. So this seems to be in fact related to how the file is being handled by the assembler. Now I still need to fix the following errors: root@llvmbuilder-successful-s-1vcpu-2gb-fra1-s-1vcpu-2gb-fra1-

Re: [go-nuts] Issue using json with array

2018-12-19 Thread Ozone Kawakami
Your code `make(pos, 1)` seems to be typo. The fixed version works well. https://play.golang.org/p/gnLe_Xi2-nb 2018年12月19日(水) 10:40 Juan Mamani : > I'm not an expert but I do my best. > > Original json format required: > { "pos": [{ "lp" : "WISE-12", "lat": "-33,43565400", "lon" : > "-70,6055270

Re: [go-nuts] Returning pointer to struct from cgo to C cause panic: runtime error: cgo result has Go pointer

2018-12-19 Thread eran . yasso
solved it: //export Eb_TcpSecureStreamCreateListener func Eb_TcpSecureStreamCreateListener(listenIp string, listenPort int) unsafe.Pointer, retStatus { pmap := &ThreadSafePeerMap{ } server := Server{ } server.listener = secConn.NewListener(server.liste

[go-nuts] [gollvm] Compilation of assembly (.s) file fails - maybe a multiline handling issue? (code to reproduce inside)

2018-12-19 Thread Benedikt T
Hi! I'm trying to compile a part of the geth-client with the current gollvm build. But it fails in this file: https://github.com/ethereum/go-ethereum/blob/master/crypto/bn256/cloudflare/gfp_amd64.s Here is an exempt from the error: root@llvmbuilder-successful-s-1vcpu-2gb-fra1-s-1vcpu-2gb-fra1-01

[go-nuts] Re: Homoiconic metaprogramming in Go

2018-12-19 Thread Max
As Ian Lance Taylor answered already, Go language and main Go compilers (go and gccgo) do not support this. My unofficial Go interpreter https://github.com/cosmos72/gomacro instead does, I even presented its AST manipulation and code generation facilities (heavily modeled after Common Lisp) at

Re: [go-nuts] Issue using json with array

2018-12-19 Thread Juan Mamani
Thanks a lot for your reply!! You are right it's working. But, it could be possible to avoid calling "make"... El mié., 19 de dic. de 2018 a la(s) 08:14, Ozone Kawakami ( kawakami.oz...@gmail.com) escribió: > Your code `make(pos, 1)` seems to be typo. > The fixed version works well. > https://p