[go-nuts] Re: Ternary ... again

2018-08-14 Thread Agniva De Sarker
Your answer is here - https://tip.golang.org/doc/faq#Does_Go_have_a_ternary_form. On Tuesday, 14 August 2018 22:13:37 UTC+5:30, Mark Volkmann wrote: > > I’m new to Go and I imagine the idea of adding a ternary operator to Go > has been discussed many times. Rather than repeat that, can someone

Re: [go-nuts] Re: Does the ecosystem need a standard interface for vector graphic?

2018-08-14 Thread george . moschovitis
> > inspired from the canvas html5 API. > That's another option, but maybe it's optimized for raster-graphics rather than vector graphics? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Why "strings" package exists ?

2018-08-14 Thread Ian Lance Taylor
On Tue, Aug 14, 2018 at 7:37 PM, wrote: > > Why not define the methods on type "string" ? > I look up the document, strings package handles string with UTF-8 encoding. > is it the reason ? > if not, it's design decision or any other reasons ? 1. None of the types defined by the language have

Re: [go-nuts] unrecognized import paths error while using go get

2018-08-14 Thread Ian Lance Taylor
On Tue, Aug 14, 2018 at 5:52 PM, Amandeep Gautam wrote: > Hi, >I installed gccgo on Solaris 11.3 using: sudo /opt/csw/bin/pkgutil -y -i > gcc5core > > Below is the output of go-5.5 env: > > amandeep@s113ldom1:~$ go-5.5 env > GOARCH="sparc" > GOBIN="" > GOCHAR="" > GOEXE="" >

[go-nuts] Why "strings" package exists ?

2018-08-14 Thread isfrog
Why not define the methods on type "string" ? I look up the document, strings package handles string with UTF-8 encoding. is it the reason ? if not, it's design decision or any other reasons ? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Re: Cross-compiled program for Raspberry Pi crashes

2018-08-14 Thread Dan Kortschak
Yes, that's understood. I'm just responding to the notion that it's a bug for a package author to expect the compiler to do the right thing. On Tue, 2018-08-14 at 15:56 -0700, Ian Lance Taylor wrote: > On Tue, Aug 14, 2018 at 3:49 PM, Dan Kortschak > wrote: > > > > > > This ignores the

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-14 Thread maksach
Hi, If I set Body to the out file itself, an item with the name of the outfile is uploaded to the S3 bucket, but that item is 0 bytes in size and when I click on it in S3 it doesn't appear, whereas with the buffer stuff, the image size in bytes is correct, but a black square shows up. This is

[go-nuts] unrecognized import paths error while using go get

2018-08-14 Thread Amandeep Gautam
Hi, I installed gccgo on Solaris 11.3 using: sudo /opt/csw/bin/pkgutil -y -i gcc5core Below is the output of go-5.5 env: amandeep@s113ldom1:~$ go-5.5 env GOARCH="sparc" GOBIN="" GOCHAR="" GOEXE="" GOHOSTARCH="sparc" GOHOSTOS="solaris" GOOS="solaris" GOPATH="/home/amandeep/" GORACE=""

[go-nuts] Re: `go test -c` skips init from main while `go test` doesn't

2018-08-14 Thread jake6502
I am unable to reproduce using a small test app on either Windows or Ubuntu, using go 1.10.3. In all cases the init() function in main is run when the test binary is run. Perhaps you could provide a minimal reproducible example? On Monday, August 13, 2018 at 8:21:30 PM UTC-4, Gert wrote: > >

Re: [go-nuts] Re: Cross-compiled program for Raspberry Pi crashes

2018-08-14 Thread Ian Lance Taylor
On Tue, Aug 14, 2018 at 3:49 PM, Dan Kortschak wrote: > > This ignores the possibility that more than one alignment-sensitive > field might be needed. Requiring that they all be up front, potentially > degrading readability flies in the face of the design principles of the > language. This kind

Re: [go-nuts] Re: Does the ecosystem need a standard interface for vector graphic?

2018-08-14 Thread Sebastien Binet
FYI (and IIRC), the vg package from (now) gonum/plot is actually inspired from the canvas html5 API. -s sent from my droid On Wed, Aug 15, 2018, 00:45 wrote: > A general interface would be extremely useful (at least to me ;-). > I am not sure about the postscript-based API (I am not against

Re: [go-nuts] Re: Cross-compiled program for Raspberry Pi crashes

2018-08-14 Thread Dan Kortschak
This ignores the possibility that more than one alignment-sensitive field might be needed. Requiring that they all be up front, potentially degrading readability flies in the face of the design principles of the language. This kind foot-gun in other languages is why many people choose Go. On Tue,

[go-nuts] Re: Does the ecosystem need a standard interface for vector graphic?

2018-08-14 Thread george . moschovitis
A general interface would be extremely useful (at least to me ;-). I am not sure about the postscript-based API (I am not against it though) and I find the the name `image/gc` a bit confusing (vector <-> image, gc ~ garbage-collector). -- You received this message because you are subscribed to

Re: [go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Sotirios Mantziaris
c'mon, this is so stupid... thanks man very much, this was actually the problem! Kudos for finding the culprit! On Wednesday, August 15, 2018 at 12:44:20 AM UTC+3, Justin Israel wrote: > > > > On Wed, Aug 15, 2018 at 9:33 AM Sotirios Mantziaris > wrote: > >> I can see over the wire that i get

Re: [go-nuts] Re: [golang-dev] Go 1.11 Release Candidate 1 is released

2018-08-14 Thread Ulderico Cirello
I apologize. I didn't see in the BCC and assumed it wasn't sent. For some reasons I lost the email from the announcement list. Il giorno mar 14 ago 2018 alle ore 18:45 Ian Lance Taylor ha scritto: > On Tue, Aug 14, 2018 at 4:41 AM, Ulderico Cirello > wrote: > > > > Don't we send these

Re: [go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Justin Israel
On Wed, Aug 15, 2018 at 9:33 AM Sotirios Mantziaris wrote: > I can see over the wire that i get messages from the server with > Basic.Delivery. > The messages do not pop up out of the channel that channel.Consume returns > when creating the connection. > I might read some where that channels do

Re: [go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Justin Israel
On Wed, Aug 15, 2018 at 8:05 AM Sotirios Mantziaris wrote: > I have actually opened a thread in the rabbitmq-users list where i checked > through wireshark what goes over the wire. It is actually pretty nice to > see the flow. > I have cross posted since i did not know if it is rabbitmq or my go

[go-nuts] Extending deadline for logging

2018-08-14 Thread rbz via golang-nuts
I'm working on a service that write some log info to spanner when it's done responding to a request. However, the service uses the context's deadline to write to spanner, so if the deadline expires due to some long running RPC, the write to spanner fails (because the deadline expired), and we

Re: [go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Sotirios Mantziaris
I have actually opened a thread in the rabbitmq-users list where i checked through wireshark what goes over the wire. It is actually pretty nice to see the flow. I have cross posted since i did not know if it is rabbitmq or my go code... it seems that i get the next message from the wire but the

Re: [go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Justin Israel
On Wed, Aug 15, 2018, 2:14 AM Sotirios Mantziaris wrote: > hi, > > i have setup a "consumer" for a rabbitmq queue. Every delivery is put in a > channel which is picked up by a goroutine. > After processing the delivery is then Ack or Nack based on the success of > the processing. > It seems that

[go-nuts] Re: Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
i finaly have it :D in fact, the whole struct of httpbin returns have to be describe through different structures to works. package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { type User struct { Firstname string `json:"firstname"`

Re: [go-nuts] Re: go/format ouputs spurious newlines

2018-08-14 Thread naha
I've read rather a lot of formal documentation where the authors were not so careful with their language, particularly with distinctions between words like "undefined" and "invalid". I think it a reasonable expectation that an object of type X returned by one function of a library be

[go-nuts] Re: Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
and without the use of http.post, the encode / decode methods works :( i also try this but it doesn't work too. func main() { type User struct { Firstname string `json: "firstname"` Lastname string `json: "lastname"` } type httpbin struct { Origin string

[go-nuts] Re: Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
when i try something like that: res, _ := http.Post("https://httpbin.org/post;, "application/json; charset=utf-8", b) var newuser map[string]interface{} json.NewDecoder(res.Body).Decode() fmt.Println(newuser["json"]) it prints me correctly the content a map containing the ID &

Re: [go-nuts] Re: go/format ouputs spurious newlines

2018-08-14 Thread Marvin Renich
* n...@mit.edu [180814 11:43]: > The documentation can be interpreted as you say. I do not see how you can interpret it otherwise. > If the resulting AST is subsequently inserted into a larger AST and then > serialized, the source that is output can be syntactically invalid. > > It is

Re: [go-nuts] Ternary ... again

2018-08-14 Thread 'Axel Wagner' via golang-nuts
There is lots of discussion findable here: https://groups.google.com/forum/#!searchin/golang-nuts/ternary%7Csort:date There's a bit of discussion on the issue tracker: https://github.com/golang/go/issues?utf8=%E2%9C%93=ternary+operator -- in particular https://github.com/golang/go/issues/23248

Re: [go-nuts] why my program will panic?

2018-08-14 Thread Marvin Renich
* sheepbao [180814 10:53]: > Thank you for your detailed answer. > I thought it would crash in this line (b.Z = "zz") of code. But it dose not > happen and the program print "zz". > I don't understand why this program crash in return, not in b.Z = "zz". > Because I agree with your opinion, The

Re: [go-nuts] Re: [golang-dev] Go 1.11 Release Candidate 1 is released

2018-08-14 Thread Ian Lance Taylor
On Tue, Aug 14, 2018 at 4:41 AM, Ulderico Cirello wrote: > > Don't we send these announcements to golang-announcements anymore? It was sent to golang-announce: https://groups.google.com/forum/#!topic/golang-announce/792GrzfZ1tw . Ian -- You received this message because you are subscribed to

[go-nuts] Re: Http/net - post and decode json data part

2018-08-14 Thread alanwang424
Have a try with jsonparser.Get()? 在 2018年8月14日星期二 UTC+8下午6:19:20,nicolas...@yahoo.fr写道: > > Hello > > I need some assistance to decode a json content > > I tried to use only usefull code to do it but don't success to retrieve > the data part of the json result. > > var user struct { >

[go-nuts] Ternary ... again

2018-08-14 Thread Mark Volkmann
I’m new to Go and I imagine the idea of adding a ternary operator to Go has been discussed many times. Rather than repeat that, can someone point me to a discussion about why Go doesn’t add this? I’m struggling to understand why it is desirable to write code like this: var color if temperature

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
i try to parse the return of httpbin :) Le mardi 14 août 2018 18:00:36 UTC+2, Ian Davis a écrit : > > > On Tue, 14 Aug 2018, at 12:44 PM, nicolas_boiteux via golang-nuts wrote: > > the raw of response.body is this > > > { > "args": {}, > "data":

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread Ian Davis
On Tue, 14 Aug 2018, at 12:44 PM, nicolas_boiteux via golang-nuts wrote:> the raw of response.body is this > > > { "args": {}, "data": > "{\"firstname\":\"Nic\",\"lastname\":\"Raboy\"}", "files": {}, > "form": {}, "headers": {"Accept-Encoding": "gzip", > "Connection": "close",

Re: [go-nuts] Re: go/format ouputs spurious newlines

2018-08-14 Thread naha
The documentation can be interpreted as you say. If the resulting AST is subsequently inserted into a larger AST and then serialized, the source that is output can be syntactically invalid. It is unexpected (and I believe unreasonable) that serializing an AST can produce code that can't be

[go-nuts] Does the ecosystem need a standard interface for vector graphic?

2018-08-14 Thread Robert Johnstone
In two recent projects, I have run up to the problem of creating vector graphics. In one case, the project used gonum.org/v1/plot/vg to provide output, and in another github.com/llgcode/draw2d. I've also found golang.org/x/image/vector. In all of these cases, we have an interface that

[go-nuts] Re: Compile to go languages?

2018-08-14 Thread 'David Chase' via golang-nuts
It's not a bad idea, except for the "idiomatic" part. I guess it depends upon how idiomatic you want it to be. Once upon a time, we compiled code to C (C++, Modula-3, and Cedar Mesa all had a compiler of that sort at one time or another). Some people tried it for Java. The advantage of

Re: [go-nuts] why my program will panic?

2018-08-14 Thread sheepbao
Thank you for your detailed answer. I thought it would crash in this line (b.Z = "zz") of code. But it dose not happen and the program print "zz". I don't understand why this program crash in return, not in b.Z = "zz". Because I agree with your opinion, The field Z of (*b) is beyond the memory

[go-nuts] streadway/amqp (RabbitMQ) manual Ack does not work after first message

2018-08-14 Thread Sotirios Mantziaris
hi, i have setup a "consumer" for a rabbitmq queue. Every delivery is put in a channel which is picked up by a goroutine. After processing the delivery is then Ack or Nack based on the success of the processing. It seems that the first one is processed ok but the rest cannot be Ack/Nack. The ui

Re: [go-nuts] Re: go/format ouputs spurious newlines

2018-08-14 Thread Marvin Renich
* n...@mit.edu [180814 09:47]: > The documentation for parser.ParseExpr says that the position information > in the AST it returns "is undefined". I opserved the result as having > position information. This looks like a bug. > > https://play.golang.org/p/tpzqDF3EZ_S > > demonstrates this

Re: [go-nuts] why my program will panic?

2018-08-14 Thread Marvin Renich
* sheepbao [180813 23:45]: > go version > go version go1.10.2 darwin/amd64 > > test code: > > func TestPoint(t *testing.T) { > type A struct { > X int > Y string > } > type B struct { > X int > Y string > Z string > } > > a := A{X: 2,

[go-nuts] Re: go/format ouputs spurious newlines

2018-08-14 Thread naha
The documentation for parser.ParseExpr says that the position information in the AST it returns "is undefined". I opserved the result as having position information. This looks like a bug. https://play.golang.org/p/tpzqDF3EZ_S demonstrates this bug. On Thursday, August 9, 2018 at 11:48:10

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-14 Thread helloPiers
It's not clear what the type of "out" is, other than it has Stat() and Read([]byte) methods, but, assuming it's an io.Reader at least, if you examine the return values from Read, like: n, err := out.Read(buffer) you may get a clue to what's going wrong, for example n might not be the full

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
the raw of response.body is this { "args": {}, "data": "{\"firstname\":\"Nic\",\"lastname\":\"Raboy\"}", "files": {}, "form": {}, "headers": { "Accept-Encoding": "gzip", "Connection": "close", "Content-Length": "38", "Content-Type": "application/json",

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
the raw of response.body is this { "args": {}, "data": "{\"firstname\":\"Nic\",\"lastname\":\"Raboy\"}", "files": {}, "form": {}, "headers": { "Accept-Encoding": "gzip", "Connection": "close", "Content-Length": "38", "Content-Type": "application/json",

[go-nuts] Re: [golang-dev] Go 1.11 Release Candidate 1 is released

2018-08-14 Thread Ulderico Cirello
Filippo, Don't we send these announcements to golang-announcements anymore? Ciao, Ulderico Il mar 14 ago 2018, 04:15 Filippo Valsorda ha scritto: > Hello gophers, > > We have just released go1.11rc1, a release candidate version of Go 1.11. > It is cut from release-branch.go1.11 at the

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread Ian Davis
On Tue, 14 Aug 2018, at 11:19 AM, nicolas_boiteux via golang-nuts wrote:> Hello > > I need some assistance to decode a json content > > I tried to use only usefull code to do it but don't success to > retrieve the data part of the json result.> > > var user struct {Firstname string

Re: [go-nuts] Re: Examples testing with two newline, but only one newline

2018-08-14 Thread zpsyhapcst
Wow!!, Thank you I think test files do not work in "Play golang" , but it seems work fine I learn a new trick again. messju mohr於 2018年8月13日星期一 UTC+8下午10時52分43秒寫道: > > Here is a running version that shows the original poster's problem: > > > On Mon, Aug

[go-nuts] Re: Examples testing with two newline, but only one newline

2018-08-14 Thread zpsyhapcst
Thank you I have written a test, but when I saw the Examples, I thought it was better to test my function. And I got the error. I am not sure whether it is a bug. Jake Montgomery於 2018年8月14日星期二 UTC+8上午5時27分46秒寫道: > > Looks like a bug to me. I would suggest you open an issue. > > It is not

[go-nuts] Http/net - post and decode json data part

2018-08-14 Thread nicolas_boiteux via golang-nuts
Hello I need some assistance to decode a json content I tried to use only usefull code to do it but don't success to retrieve the data part of the json result. var user struct { Firstname string `json: "firstname"` Lastname string `json: "lastname"` Origin string

[go-nuts] Re: Can go-dockerclient be built with go modules?

2018-08-14 Thread Constantin Konstantinidis
An issue is already opened cf. https://github.com/golang/go/issues/22291 On Saturday, August 11, 2018 at 8:08:01 PM UTC+2, Joseph Lorenzini wrote: > > > All: > > Using vgo, I haven't been able to build a go package with this library. > Using go 1.10, I can successfully build this library. > >

Re: [go-nuts] Re: Cross-compiled program for Raspberry Pi crashes

2018-08-14 Thread Jakob Borg
It’s a bug in the library if it uses 64 bit atomic operations without ensuring 64 bit alignment. Putting the alignment-required field at the top of the struct is the traditional method. //jb On 14 Aug 2018, at 08:45, Stephan Mühlstrasser mailto:stephan.muehlstras...@gmail.com>> wrote: Am

[go-nuts] Re: Cross-compiled program for Raspberry Pi crashes

2018-08-14 Thread Stephan Mühlstrasser
Am Montag, 13. August 2018 23:47:11 UTC+2 schrieb Dave Cheney: > > I don’t think that will help. The problem is not cross compilation. The > problem is when run in a 32bit environment the offset of that field is not > guaranteed to be aligned to 8 bytes. You’ve got a 50/50 chance that each >