Re: [go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread Henrik Johansson
Surely these issues already exist in gogo-protobuf? How are they handled there? On Thu, Feb 1, 2018, 08:28 'Jisi Liu' via golang-nuts < golang-nuts@googlegroups.com> wrote: > This is not Java specific. I just used Java as an example. For most > protobuf implementations, there is a contract

[go-nuts] question

2018-01-31 Thread 王晚成
hello my dear friend Google man: I have some questions. type Point struct{ x int y int } func (p *Point) hehe(i int) { p.x = i p.y = i } func main(){ Point{1,2}.hehe(4) // compile error: can't take address of Point literal } The book says that there’s no way to obtain the

Re: [go-nuts] unused import and variables, necessary at compiler level? Experience can be improved?

2018-01-31 Thread Jan Mercl
On Thu, Feb 1, 2018 at 3:46 AM Alex Buchanan wrote: Put this line into any of the package *_test.go files: func use(...interface{}) {} When disabling some code in non-test files leads to unused variables foo and baz error, insert `use(foo, bar)` there to keep

Re: [go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread 'Jisi Liu' via golang-nuts
This is not Java specific. I just used Java as an example. For most protobuf implementations, there is a contract between the runtime and generated code which is not meant to be public. e.g. In go-protobuf, runtime expects the generated classes define some internal fields, like XXX_unrecognized,

Re: [go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread Walter Schulze
Could we perhaps get a code snippet example that non java programmers can follow. PS When I previously referred to java programmers as real software developers, I didn't add some much needed context. Sometimes in this java dominated world I personally don't feel like a real software developer.

[go-nuts] auto-correct a speech-to-text output and relate to of the words based on syllables

2018-01-31 Thread naveen
Hi, I have to make an application in which, - The user asks a question, Google's API is used to convert the speech to text. But the problem is due to different accent the translator misunderstands the words. - I want my application to guess the word to the nearest word spoken by

[go-nuts] unused import and variables, necessary at compiler level? Experience can be improved?

2018-01-31 Thread Alex Buchanan
Unused variables and imports are strictly disallowed by the Go compiler. Most of the time, I enjoy this benefit. These days, I've started to notice how often things go dead and/or unused in my python code. But, sometimes, this behavior is incredibly annoying. If I'm trying to debug something

[go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread 'simon place' via golang-nuts
also notice, if you haven’t encountered it, this makes []interfaces a bit awkward to handle with ellipsis functions... https://play.golang.org/p/JWuc4jt2uSP what i do is this; https://play.golang.org/p/O9Q4K_vXlul but you will need a convert for all combinations of interfaces and ellipsis

Re: [go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread liujisi via golang-nuts
On Wednesday, January 31, 2018 at 11:20:31 AM UTC-8, Walter Schulze wrote: > > Hi JT please see my inline replies. > > On Wed, 31 Jan 2018 at 19:05 wrote: > >> Thank you, Walter, for your support. >> >> > gogo/protobuf is disappointed that golang/protobuf still thinks

Re: [go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread matthewjuran
Converting []tmpType to []Useable: https://play.golang.org/p/u3WUOEopku9 I'm not sure I understand, but if you can make an exhaustive list of possible input slice types and an element can assert to Useable then the elements can be copied into a []Useable. Matt On Wednesday, January 31, 2018

Re: [go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread Walter Schulze
Hi JT please see my inline replies. On Wed, 31 Jan 2018 at 19:05 wrote: > Thank you, Walter, for your support. > > > gogo/protobuf is disappointed that golang/protobuf still thinks that > runtime reflection is an efficient way of serializing structures. > > The

[go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread thebrokentoaster
Thank you, Walter, for your support. > gogo/protobuf is disappointed that golang/protobuf still thinks that runtime reflection is an efficient way of serializing structures. The table-driven implementation avoids reflect in the fast and common path. Instead, are you referring to the fact that

Re: [go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread 'Axel Wagner' via golang-nuts
It seems that https://godoc.org/sort#Interface is the way to go here. You can combine it with reflect.Swapper to get an API like https://godoc.org/sort#Slice On Wed, Jan 31, 2018 at 6:52 PM, Chris Hopkins wrote: > Okay well the actual (working version) of the code (before

Re: [go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread Chris Hopkins
Okay well the actual (working version) of the code (before I wrote the test cases that are currently failing/not compiling) is here (I refuse to check in broken code): https://github.com/cbehopkins/permutation/blob/master/helpers.go The source library (permutation) can cope with permutes on

Re: [go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread 'Axel Wagner' via golang-nuts
FTR, you can also pass an actual []Usable, instead of a []tmpType. That is do https://play.golang.org/p/N_CJh0Ekik8 But I do think that your code and question suggest that you are trying to use interfaces to do some sort of subtyping, which is just not how they are supposed to be used. On Wed,

Re: [go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread 'Axel Wagner' via golang-nuts
You have to use reflection for that. Go doesn't have subtyping of that kind. This smells a bit of an xy-problem to me, though. There are several things here, that suggest an antipattern going on. With a little bit of context on the actual problem you are trying to solve,

[go-nuts] Re: any discourse-like forum in Go?

2018-01-31 Thread peterGo
Sebastien, Go中国技术社区 - golang (https://gocn.io/) says it is Powered By WeCenter 3.1.9 (https://github.com/wecenter). WeCenter 问答系统的环境需求 (https://github.com/wecenter/wecenter/blob/master/README.md) 可用的 www 服务器,如 Apache、IIS、nginx, 推荐使用性能高效的 Apache 或 nginx. PHP 5.2.2 及以上 MySQL 5.0

[go-nuts] GOTCHA: Just when you think you understand interfaces

2018-01-31 Thread Chris Hopkins
Hi Sharing my ignorance: I didn't realise that although you can switch-case on an interface, an array of interfaces doesn't work. https://play.golang.org/p/tD8msjCXyuZ Any ideas on how to cope with this? I tried: _, ok = tmp.([]Useable) But that fails for the same reason. I can't work out how

[go-nuts] Re: Vendor compilation problem

2018-01-31 Thread Luis Furquim
Hi, Just fixing a typo. When I said: 'from "./hudsond" to "mpf/sherlock/bot/src/hudsonbot" the problem was solved.' I meant: 'from "./hudsonbot" to "mpf/sherlock/bot/src/hudsonbot" the problem was solved.' Thank you for the attention! Luis Otavio de Colla Furquim Em quarta-feira, 31 de

[go-nuts] Re: Vendor compilation problem

2018-01-31 Thread Luis Furquim
Hi, Thanks for answering! The environment is as follows: vuco@azrael ~ $ go env GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/vuco/repos/gopkg" GORACE="" GOROOT="/home/vuco/repos/go" GOTOOLDIR="/home/vuco/repos/go/pkg/tool/linux_amd64"

[go-nuts] any discourse-like forum in Go?

2018-01-31 Thread Sebastien Binet
hi there, I am looking for a discourse-like forum, in Go. Does anybody know of such a thing? Interestingly, reading the https://blog.golang.org/hello-china post, I stumbled upon: - https://gocn.io which could be just what I am looking for, but there are no link to any github repo... :} (and my

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-01-31 Thread roger peppe
On 30 January 2018 at 23:19, wrote: >> - When slices can be compared, they can be used as map keys. What happens >> if the contents of a slice are changed after it has been added to a map? > > > I’m not too familiar with Go map internals, but my thought is the key hash >

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-01-31 Thread 'Axel Wagner' via golang-nuts
> What about a proposal addition of “types with self-references in slices cannot be compared”? Are you sure that's the only edge-case? Because this thread is kinda long and there might even be things we are not thinking about. > I’m curious about examples where people wanted one or the other. I

[go-nuts] Re: Why Goland Terminal appear Hexadecimal text, detail can see my picture

2018-01-31 Thread matthewjuran
Go files are usually encoded UTF-8, what text encoding is the terminal using? Matt On Wednesday, January 31, 2018 at 7:45:04 AM UTC-6, wangdach...@gmail.com wrote: > > This is my first posted,Thank you for helping me solve this problem > > my oprate-system is windows 10 > > goland version is

[go-nuts] Re: Go, VSCODE IDE, Delve debugger: am having problem debugging my console app

2018-01-31 Thread evan
hi! thanks for responding! when i hit F5 initially to Start Debugging, the debugger stops at a preset breakpoint. i hit F5 to continue... the Debug Console prints out it's continuing ... nothing happens after ... so i hit F5 to continue again, and again the Debug Console prints out the

[go-nuts] Re: golang compiler warning idea

2018-01-31 Thread matthewjuran
Here's a proposal covering this: https://github.com/golang/go/issues/21114 Matt On Wednesday, January 31, 2018 at 2:58:15 AM UTC-6, Egon wrote: > > Use govet and see https://golang.org/cmd/vet/#hdr-Shadowed_variables... > Of course, there are more tools that can help you >

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-01-31 Thread matthewjuran
I agree with you Axel. One point is that allowing struct comparison but not slice comparison was counterintuitive to me at first. What about a proposal addition of “types with self-references in slices cannot be compared”? While comparison by header versus comparison by value may not be an

[go-nuts] Re: Upcoming Go protobuf release

2018-01-31 Thread Walter Schulze
gogo/protobuf is happy to be acknowledged by Google as an entity in the golang protobuf space. gogo/protobuf welcomes golang/protobuf to the community and is extremely happy to see this kind of transparency. gogo/protobuf will also merge these changes and as usual try to stay as close as

[go-nuts] Re: Go, VSCODE IDE, Delve debugger: am having problem debugging my console app

2018-01-31 Thread deparker
Console app as in some sort of GUI application? Also, what actually happens when you run the app under Delve, like when you actually run `continue`? On Wednesday, January 31, 2018 at 6:50:02 AM UTC+1, evan wrote: > > i can debug my web app server code with no problem with the Go, VSCODE, > and

[go-nuts] Re: Unit tests - same vs separate package

2018-01-31 Thread Sonia Keys
Stevo, that's how I do it. Most of my tests are in an _test package so I can be sure my exported API works. Once in a while I want some extra tests on something not exported so those tests go in a separate source file. And yes, I try to do something with the filename to indicate that it

[go-nuts] Why Goland Terminal appear Hexadecimal text, detail can see my picture

2018-01-31 Thread wangdachangchang
This is my first posted,Thank you for helping me solve this problem my oprate-system is windows 10 goland version is 2017.3 how can i do to solve this situation

Re: [go-nuts] where in gc compiler does converting from syntax.TypeDecl to reflect.Type happen?

2018-01-31 Thread Jason E. Aten
Thanks Alex. Thanks Ian. In case it is of interest to other gophers, since somebody emailed me asking if my go/types -> reflect.Type conversion code was available: yes, it is. It is called muse. I've extracted muse from my just-in-time Go interpreter ( https://github.com/gijit/gi) and made muse

[go-nuts] Vendor compilation problem

2018-01-31 Thread Dave Cheney
Hi, Can you please provide the output from running, go env It looks like your GOPATH variables is either not set, or not set to the correct value, which in this case looks to be, /home/vuco/repos/gopkg -- You received this message because you are subscribed to the Google Groups

[go-nuts] Vendor compilation problem

2018-01-31 Thread Dave Cheney
Can you please provide the output from running to eng. It looks like your GOPATH variables is either not set, or not set to the correct value, which looks to be in this case /home/vuco/repos/gopkg -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] json struct tag

2018-01-31 Thread Konstantin Khomoutov
On Wed, Jan 31, 2018 at 09:26:35AM +1030, Dan Kortschak wrote: > > > Does the order in which the options in the tag appear matter (e.g.  > > > `json:"first_name,omitempty"` vs `json:"omitempty,first_name"`) ? > > > > I'd say they should not as their purposes are orthogonal to each > > other. >

Re: [go-nuts] SIGSEGV with cgo

2018-01-31 Thread hǎi sū
thank you. andrey mirtchovski於 2018年1月31日星期三 UTC+8下午1時33分04秒寫道: > > on the Go side you have an array of bytes, on the C side you are > passing a pointer to an array of shorts (16-bits) > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] SIGSEGV with cgo

2018-01-31 Thread hǎi sū
thank you. now, I understand. Ian Lance Taylor於 2018年1月31日星期三 UTC+8下午1時29分09秒寫道: > > On Tue, Jan 30, 2018 at 9:13 PM, hǎi sū > wrote: > > the code is below. > > ``` > > package main > > > > import "math/rand" > > import "fmt" > > > > /* > > #include > > #include

[go-nuts] Re: golang compiler warning idea

2018-01-31 Thread Egon
Use govet and see https://golang.org/cmd/vet/#hdr-Shadowed_variables... Of course, there are more tools that can help you https://github.com/alecthomas/gometalinter + Egon On Wednesday, 31 January 2018 02:05:57 UTC+2, Jacob Lancaster wrote: > > So, I'm new to Go, but I wanted to make a cli app