[go-nuts] Re: golang compiler warning idea

2018-01-30 Thread Lucio
The Go policy not to generate ANY warnings is now deeply rooted, it is not going to be changed this late in the game, not even if one or more instances could justify the break with tradition. The go vet tool will help you discover situations where the code is conventionally ambiguous or even br

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

2018-01-30 Thread 'Axel Wagner' via golang-nuts
On Wed, Jan 31, 2018 at 12:19 AM, 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 > would depend on the b

[go-nuts] Re: trying to find out if there's already a Go v2 roadmap

2018-01-30 Thread evan
thank you both for the info On Tuesday, January 30, 2018 at 8:20:15 PM UTC+8, evan wrote: > > also, could a Go Team-supported GUI library be in Go's near future? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

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

2018-01-30 Thread evan
i can debug my web app server code with no problem with the Go, VSCODE, and Delve setup. the client connecting to that web app is a console app, which primarily does the following: gets json data from the server, stuffs the data into the table widget of the terminal user interface (3rd party G

Re: [go-nuts] SIGSEGV with cgo

2018-01-30 Thread andrey mirtchovski
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 unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] SIGSEGV with cgo

2018-01-30 Thread Ian Lance Taylor
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 > > void t(const short *buf, size_t buf_size) { > printf("in t."); > printf("0: %d ", buf[0]); > printf("buf_size-1: %d\n", buf[buf_size-1])

[go-nuts] SIGSEGV with cgo

2018-01-30 Thread hǎi sū
the code is below. ``` package main import "math/rand" import "fmt" /* #include #include void t(const short *buf, size_t buf_size) { printf("in t."); printf("0: %d ", buf[0]); printf("buf_size-1: %d\n", buf[buf_size-1]); } */ import "C" func main() { for { a := make([]byte, 178209) rand.Read

[go-nuts] Re: golang compiler warning idea

2018-01-30 Thread Jacob Lancaster
One of my roommates pointed out that this shouldn't throw a warning or error because I didn't assign a value to the variable, but it should be a warning because I hide the scope of the original text variable with the text variable inside the loop scope. The C# compiler throws a warning for a ve

[go-nuts] golang compiler warning idea

2018-01-30 Thread jakelanc950
So, I'm new to Go, but I wanted to make a cli app that plays go fish with another client over a network. While I was testing the main loop that takes in the commands, I noticed that the program wouldn't exit when I entered the exit command. Here is my code before I found the issue. var text str

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

2018-01-30 Thread matthewjuran
Correction on the self-reference example: a0 := A{} // equal a1 := A{a0, A{}} a1[0] = a1 a2 := A{a1, a1[1]} // not equal a3 := A{A{a1, a1[1]}, a1[1]} Thanks, Matt On Tuesday, January 30, 2018 at 5:19:44 PM UTC-6, matthe...@gmail.com wrote: > > - When slices can be compared, they can be used as m

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

2018-01-30 Thread matthewjuran
> > - 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 would depend on the backing array values. Go maps also allow read

Re: [go-nuts] json struct tag

2018-01-30 Thread Dan Kortschak
It does matter, and omitempty must have a leading comma; the first comma separated term is the JSON field name. From the json docs: ``` The format string gives the name of the field, possibly followed by a comma-separated list of options. The name may be empty in order to specify options without o

[go-nuts] Re: Async process state snapshotting in Golang

2018-01-30 Thread jul . semaan
As a follow-up, I managed to get everything to work as I wanted with forking but I got a major issue.. The golang runtime mutexes are invalidated by the forking, that means that anything in the runtime that needs a mutex is broken so garbage collection had to be disabled and additional memory a

[go-nuts] Re: Upcoming Go protobuf release

2018-01-30 Thread joetsai via golang-nuts
Done. I tagged v1.0.0. When we perform the merge in the future, it will be tagged as v1.1.0. On Tuesday, January 30, 2018 at 9:37:23 AM UTC-8, Alexey Palazhchenko wrote: > > Hi, > > Can you please add tags to the repository before that? SemVer or even tags > with _any_ semantic would greatly hel

Re: [go-nuts] Re: EOF during http.Client.Do()

2018-01-30 Thread prasad . mandore
Did you find the root cause for this. I am getting the same issue. On Thursday, February 20, 2014 at 8:44:01 PM UTC-8, freeformz wrote: > > Also wondering if I could be running into this: > https://code.google.com/p/go/issues/detail?id=3514 > > although I don't se related 503's before hand > > >

[go-nuts] Re: gomobile bind -target=ios ld: framework not found OpenGL

2018-01-30 Thread John Teasdale
Thanks, that lead me in the right direction. The OpenGL library that I'm using: https://github.com/goxjs/gl claims to support iOS (which it does) but it doesn't recognize the 'ios' build tag that gomobile uses. On Sunday, January 28, 2018 at 5:58:12 AM UTC-8, Elias Naur wrote: > > Only OpenG

[go-nuts] Running golang compiled binary on QNX

2018-01-30 Thread Serguei Bezverkhi (sbezverk)
Hello, I was wondering if anybody managed to get golang compiled binary to run on 32-bit QNX? I compiled it with GOARCH=386 GOOS=linux go build -o blah But when I start it in QNX I get core dump. I double check and the time of executable matches type of native qnx binaries. Appreciate any su

[go-nuts] Re: glog + vendor = "flag redefined: log_dir"?

2018-01-30 Thread jake6502
Ok, maybe I'm a bit off topic. But this also points out why I firmly believe that libraries should not add things to the default flag set in an init function. This is just one of many cases where that can cause problems. @Library developers - please, please consider supplying the user with an

[go-nuts] asn1 struct tagging

2018-01-30 Thread andrey mirtchovski
in the spec i have something defined as: Inner ::= [10] IMPLICIT SEQUENCE { one INTEGER, two INTEGER } Outer :== [11] IMPLICIT SEQUENCE { one Inner, two INTEGER ... } what are my options for tagging the "Inner" struct? do I need to specify the tag (10) in each instan

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

2018-01-30 Thread roger peppe
Two significant issues that need to be thought about: - 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? - It is possible to have self-referential slices [1]. How would comparison work in such a case?

[go-nuts] Re: Upcoming Go protobuf release

2018-01-30 Thread matiasbaruchinsaurralde
Awesome! Looking forward to try it out. El lunes, 29 de enero de 2018, 19:47:40 (UTC-3), Joe Tsai escribió: > > (If you don't use Go protocol buffers, you can stop reading) > > Hello gophers, > > This is an announcement that we will be merging the dev branch of > github.com/golang/protobuf

Re: [go-nuts] Guarantees about evaluation order but not slice indexing

2018-01-30 Thread 'Axel Wagner' via golang-nuts
On Tue, Jan 30, 2018 at 7:20 PM, Dmitriy Cherchenko wrote: > The second possibility you described is exactly what I’m worried about. > But I have several places where I’m doing something like b.data[b.grow()] = > bt and wouldn’t want to break that up into two lines everywhere. I was > wondering i

[go-nuts] Cloud Functions Golang Support

2018-01-30 Thread Sankar
Hi When is Golang support for Cloud functions in GCP expected ? I am starting off a new project and would love to use GCP over AWS, but lambda already supports Golang. Is there an approximate ETA for Golang in Google Cloud functions ? Thanks. -- You received this message because you are subs

Re: [go-nuts] Guarantees about evaluation order but not slice indexing

2018-01-30 Thread Ian Lance Taylor
On Tue, Jan 30, 2018 at 10:20 AM, Dmitriy Cherchenko wrote: > > The second possibility you described is exactly what I’m worried about. But I > have several places where I’m doing something like b.data[b.grow()] = bt and > wouldn’t want to break that up into two lines everywhere. I was wondering

Re: [go-nuts] Guarantees about evaluation order but not slice indexing

2018-01-30 Thread Dmitriy Cherchenko
The second possibility you described is exactly what I’m worried about. But I have several places where I’m doing something like b.data[b.grow()] = bt and wouldn’t want to break that up into two lines everywhere. I was wondering if you could find anything else in the spec to guarantee that the i

[go-nuts] [ANN] Code your own blockchain in less than 200 lines of Go!

2018-01-30 Thread nosequeldeebee
Hi all, I wrote an intermediate level tutorial to teach the basic concepts of the blockchain by writing one up in Go. It's a tutorial so doesn't have full unit tests and such but let me know if you have any feedback. Tutorial: https://medium.com/@mycoralhealth/code-your-own-blockchain-in-less

[go-nuts] Re: Upcoming Go protobuf release

2018-01-30 Thread Alexey Palazhchenko
Hi, Can you please add tags to the repository before that? SemVer or even tags with _any_ semantic would greatly help to rollback to the latest working version when things break. –-– Alexey «AlekSi» Palazhchenko -- You received this message because you are subscribed to the Google Groups "go

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

2018-01-30 Thread matthewjuran
Here’s a draft for a Go 2 proposal that I’d like to add to the issue tracker since there’s no discussion there about this: Slices should have equality defined. https://golang.org/doc/faq#map_keys Map lookup requires an equality operator, which slices do not implement. > They don't implement eq

Re: [go-nuts] Decoder.DisallowUnknownFields() works when passing *struct but not *map[string]interface{}

2018-01-30 Thread Trig
I dunno... it doesn't seem to satisfy this check, even though the article you sent me states maps are pointers (but does satisfy == reflect.Map). Doesn't the unmarshaller check for a pointer using == reflect.Ptr before it does anything? I haven't looked at it lately (can't atm, so going on me

Re: [go-nuts] Re: trying to find out if there's already a Go v2 roadmap

2018-01-30 Thread matthewjuran
The blog post is the open source roadmap: https://blog.golang.org/toward-go2 There are over 200 Go 2 proposals and a third of them have been closed: https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3AGo2 The community is collecting and discussing ideas there. Some contributors a

Re: [go-nuts] Decoder.DisallowUnknownFields() works when passing *struct but not *map[string]interface{}

2018-01-30 Thread Trig
I guess it's not needed. I know that the json unmarshaller requires a pointer to a struct... so for consistency, I was just stating it as a pointer. I had no idea that make(map) returns *hmap. On Tuesday, January 30, 2018 at 9:13:28 AM UTC-6, matthe...@gmail.com wrote: > > Dave talks about map

Re: [go-nuts] Decoder.DisallowUnknownFields() works when passing *struct but not *map[string]interface{}

2018-01-30 Thread matthewjuran
Dave talks about map representation here: https://dave.cheney.net/2017/04/30/if-a-map-isnt-a-reference-variable-what-is-it I don’t understand why you need a pointer to a map, can you provide a code example? Matt On Tuesday, January 30, 2018 at 8:22:54 AM UTC-6, Trig wrote: > > Appreciate the r

[go-nuts] Vendor compilation problem

2018-01-30 Thread Luis Furquim
Hello Gophers, I got this compilation message: hudsonbot/New.go:8:4: cannot find package "_/home/vuco/repos/gopkg/src/mpf/sherlock/bot/src/hudsonbot/vendor/ github.com/gabrielledf/paperfishGo" in any of: /home/vuco/repos/go/src/_/home/vuco/repos/gopkg/src/mpf/sherlock/bot/src/hudsonbot/vendor/ git

Re: [go-nuts] [ANN] A gradient boosting regressor package

2018-01-30 Thread matthewjuran
Thanks for sharing gradboostreg here. Matt On Tuesday, January 30, 2018 at 12:47:33 AM UTC-6, Sina Siadat wrote: > > Hi Matt, > > Thank you for the code review! > > ​ > ​ > > gradboostreg/tree, stat, sample have no tests. > > Yes, thanks for reminder, I should write tests for them!​ > > ​ > ​ > >

[go-nuts] Re: [ANN] Bob, a framework to create a distributed AI that can learn to understand your voice, speak back, interact with your mouse and keyboard, and anything else you want

2018-01-30 Thread matthewjuran
> > I agree even though I've never thought like this. For my own curiosity, > what gain do you see by embedding structs like this? Now when making calls you don’t have to refer to the field to call the methods; the embedded type’s methods are promoted to the struct type but still use the fiel

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

2018-01-30 Thread Ian Lance Taylor
On Tue, Jan 30, 2018 at 4:45 AM, Stevo Slavić wrote: > > Official docs recommend putting unit tests in same package as package under > test, see: > - https://golang.org/doc/faq#How_do_I_write_a_unit_test > - https://golang.org/pkg/testing/ > > Practical experience (see > https://medium.com/@matrye

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

2018-01-30 Thread Ian Lance Taylor
On Mon, Jan 29, 2018 at 11:21 PM, Jason E. Aten wrote: > > I wrote some code to convert (go/types) types.Type to reflect.Type, > > but I kept thinking, "this has to be done somewhere already in > the runtime or compiler libraries...", doesn't it? > > [ I know gc doesn't use go/types, but assume I'

Re: [go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Ian Davis
Define a logging interface in your main package, then pass an implementation of the interface in your test that forwards writes to t.Logf On Tue, 30 Jan 2018, at 2:11 PM, Jérôme LAFORGE wrote: > No, it is not possible to use t.Log within the code you want to test.> The > function IsBuggyEven is n

Re: [go-nuts] Re: trying to find out if there's already a Go v2 roadmap

2018-01-30 Thread Ian Lance Taylor
On Tue, Jan 30, 2018 at 4:53 AM, evan wrote: > Just to clarify, i meant GUI library for Desktop App > > > On Tuesday, January 30, 2018 at 8:20:15 PM UTC+8, evan wrote: >> >> also, could a Go Team-supported GUI library be in Go's near future? The closest we've got is golang.org/x/exp/shiny. I'm n

[go-nuts] Re: Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-30 Thread Михаил Стойков
I'm doing similar thing so that a connection can be throttled including to change the throttle in the middle of the request. This can be reused to count outgoing bytes (it was actually a feature that I thought on when designing it, I can't seem to find an implementation of it at the time). Unfo

Re: [go-nuts] Decoder.DisallowUnknownFields() works when passing *struct but not *map[string]interface{}

2018-01-30 Thread Trig
Appreciate the response. I'm wanting to pass a *map[string]interface{} where the keys (strings) are already populated. I'm thinking of just creating a func which does this itself... checks to see if the keys exists and populate accordingly, and if not... return an error. Don't think this wil

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Jérôme LAFORGE
No, it is not possible to use t.Log within the code you want to test. The function IsBuggyEven is not defined to be used into testing scope, it is defined to be used into production context. Le mardi 30 janvier 2018 13:48:27 UTC+1, Jordan Krage a écrit : > > Try using `t.Logf` instead of `fmt.Pri

Re: [go-nuts] glog + vendor = "flag redefined: log_dir"?

2018-01-30 Thread Ian Davis
On Tue, 30 Jan 2018, at 7:59 AM, porridge via golang-nuts wrote: > I admit I'm somewhat new to Golang, how do I solve this problem? > My program uses two libraries, both of which have > github.com/golang/glog in their /vendor/ directories.> This results in a > panic at runtime, apparently because

[go-nuts] Hazelcast Releases Dedicated IMDG Go Client Supporting Multi-Application Distributed Cloud Computing Deployments

2018-01-30 Thread darren
Hazelcast today announced the availability of a new Hazelcast Go Client for client-server deployments of Hazelcast IMDG – giving Go applications capabilities to integrate and share large datasets with other applications in real-time while scaling to the cloud and ensuring high-performance and r

[go-nuts] glog + vendor = "flag redefined: log_dir"?

2018-01-30 Thread porridge via golang-nuts
I admit I'm somewhat new to Golang, how do I solve this problem? My program uses two libraries, both of which have github.com/golang/glog in their /vendor/ directories. This results in a panic at runtime, apparently because two copies of glog try to initialize the same flag on initialization. Ma

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

2018-01-30 Thread Stevo Slavić
Hello Go community, Official docs recommend putting unit tests in same package as package under test, see: - https://golang.org/doc/faq#How_do_I_write_a_unit_test - https://golang.org/pkg/testing/ Practical experience (see https://medium.com/@matryer/5-simple-tips-and-tricks-for-writing-unit-test

[go-nuts] Re: trying to find out if there's already a Go v2 roadmap

2018-01-30 Thread evan
Just to clarify, i meant GUI library for Desktop App On Tuesday, January 30, 2018 at 8:20:15 PM UTC+8, evan wrote: > > also, could a Go Team-supported GUI library be in Go's near future? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Jordan Krage
Try using `t.Logf` instead of `fmt.Printf`. On Saturday, January 27, 2018 at 6:03:13 AM UTC-6, Jérôme LAFORGE wrote: > > Of course, that was I already did. But I talk about the log into function > I want to test (in the example of playground: func IsBuggyEven) . > see: > https://play.golang.org

[go-nuts] Re: Async process state snapshotting in Golang

2018-01-30 Thread jul . semaan
I believe copying the map containing structs and not pointers would make it consume twice the amount of memory which isn't desirable in my case. - Julien On Tuesday, 30 January 2018 00:09:21 UTC-5, Tamás Gulácsi wrote: > > Do you really need pointers tonyour structs in the map? Because that > c

[go-nuts] trying to find out if there's already a Go v2 roadmap

2018-01-30 Thread evan
also, could a Go Team-supported GUI library be in Go's near future? -- 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

[go-nuts] What is the best way to redirect naked domains to a subdomain?

2018-01-30 Thread Andrew O'Neill
I would like to do this in go and was wondering if my approach is good enough or if there is a better way. Below is the example code and a playground link https://play.golang.org/p/wLzmOFMrudP Andrew const ( domain= "example.com" wwwdomain = "www." + domain ) mux := http.NewServeMux()

Re: [go-nuts] Decoder.DisallowUnknownFields() works when passing *struct but not *map[string]interface{}

2018-01-30 Thread Konstantin Khomoutov
On Sun, Jan 28, 2018 at 10:59:58AM -0800, Trig wrote: > This works as intended when you pass it a pointer to a Struct; however, it > should also work (you would think, since the Unmarshaller can handle both > types) a pointer to a *map[string]interface{}; however, it does not. Are > there any

Re: [go-nuts] json struct tag

2018-01-30 Thread Konstantin Khomoutov
On Sun, Jan 28, 2018 at 09:21:12AM -0800, Trig wrote: > I've searched but can't find any good sources on json struct tag options > and rules... These rules are contained in the pieces of documentation for encoding/json.Marshal and encoding/json.Unmarshal; studying the output of `go doc json.Mars

[go-nuts] Re: Upcoming Go protobuf release

2018-01-30 Thread thebrokentoaster
Yes, although not as much as for proto3. The limiting factor for proto2 is the pervasive use of pointers to primitive fields. In order to improve that further, we will likely have to change the generated API for proto2. JT On Monday, January 29, 2018 at 10:45:55 PM UTC-8, Lee Armstrong wrote: >

Re: [go-nuts] Guarantees about evaluation order but not slice indexing

2018-01-30 Thread 'Axel Wagner' via golang-nuts
On Tue, Jan 30, 2018 at 9:10 AM, Dmitriy Cherchenko wrote: > It looks like the language spec is a little imprecise in the Order of > evaluation section > about if any function evaluating an index of a slice will always be invoked > before anything

[go-nuts] Re: [ANN] Bob, a framework to create a distributed AI that can learn to understand your voice, speak back, interact with your mouse and keyboard, and anything else you want

2018-01-30 Thread Asticode
First off, cheers for the code review :) >> Since type ability is not exported, why not embed sync.Mutex? I agree. >> What does o stand for? I named this variable "isOn" first, but then I named the function to access it the same way, therefore I had to find another name. I do agree "o" sucks,

[go-nuts] Guarantees about evaluation order but not slice indexing

2018-01-30 Thread Dmitriy Cherchenko
It looks like the language spec is a little imprecise in the Order of evaluation section about if any function evaluating an index of a slice will always be invoked before anything is done to the slice at that index. That is, if you have somethi