Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-12 Thread Zhaoxun Yan
Thank you Steven. I am a little bewildered by the new mod configuration. Will it compile If I download the source file from the new github source to src directory without further setting up a mod in the old fashioned way? I am using go1.15. And today I ran a test logging all the sendings to Redis

[go-nuts] Re: [security] Go 1.18.1 and Go 1.17.9 are released

2022-04-12 Thread Amnon
D'oh! This is a known issue. (I should have checked before posting my original message). https://github.com/golang/go/issues/52317 So if you are an OSX user, then either download for source Or keep using 1.18 until https://github.com/golang/go/issues/52317 is resolved. On Wednesday, 13 April 20

[go-nuts] Re: [security] Go 1.18.1 and Go 1.17.9 are released

2022-04-12 Thread Amnon
Thank for the new release... I may be looking in the wrong place, but the darwin binaries for 1.18.1 appear to be missing. https://go.dev/doc/install when installing on a mac shows an installer button labeled "Download Go for Mac" which links to https://go.dev/dl/undefined which gives a 404 er

Re: [go-nuts] [gollvm] Test for GoLLVM?

2022-04-12 Thread Lanzhiguan Huang
Thanks, I see most of the cases are as same as the tests under go/test so we just need a testing framework. On Wednesday, April 13, 2022 at 5:58:27 AM UTC+8 Ian Lance Taylor wrote: > On Tue, Apr 12, 2022 at 12:20 AM Lanzhiguan Huang > wrote: > > > > Any ideas about running the tests under go/te

[go-nuts] [security] Go 1.18.1 and Go 1.17.9 are released

2022-04-12 Thread Dmitri Shuralyov
Hello gophers, We have just released Go versions 1.18.1 and 1.17.9, minor point releases. These minor releases include three security fixes following the security policy: - encoding/pem: fix stack overflow in Decode A large (more than 5 MB) PEM input can cause a stack overflow in Decode,

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Tyler Compton
Interestingly, Go also kind of has a built-in set data type by using map keys! https://go.dev/play/p/3-ZEKPSPUEh I know that's not really what you mean, but I think it's a cool pattern. On Tue Apr 12, 2022, 07:50 PM GMT, Ian Lance Taylor wrote: On Mon, Apr 11, 2022 at 11:19 PM 'Jack Li' via gol

Re: [go-nuts] [gollvm] Test for GoLLVM?

2022-04-12 Thread Ian Lance Taylor
On Tue, Apr 12, 2022 at 12:20 AM Lanzhiguan Huang wrote: > > Any ideas about running the tests under go/test directory? I think the test > framework is designed to be applicable for all the go compilers(go, gccgo, > gollvm...) but it seems there is something like assembly or unrecognizable >

[go-nuts] Re: Why is Go fun?

2022-04-12 Thread Mine GO BOOM
Another "fun" thing people miss out on is that you spend less time making choices, and more time writing what you need. When there is generally one library/function/struct that does what you want to do, so you don't need to overthink about what tool to use to do what you are trying to accomplis

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Ian Lance Taylor
On Mon, Apr 11, 2022 at 11:19 PM 'Jack Li' via golang-nuts wrote: > > Why Go provides only 2 built-in data structures, slice and map. It has just > more than C, but less than all other programming languages I've heard of, > C++, Python, Swift, Rust. > > I think this simplicity attracts me very m

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Jesper Louis Andersen
Very true! On Tue, Apr 12, 2022 at 8:36 PM Robert Engels wrote: > Nit but you can certainly create maps and slices in a library - you use > methods not language syntax - as long as you have pointers and type > casting. > > On Apr 12, 2022, at 1:30 PM, Jesper Louis Andersen < > jesper.louis.ander

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Robert Engels
Nit but you can certainly create maps and slices in a library - you use methods not language syntax - as long as you have pointers and type casting. > On Apr 12, 2022, at 1:30 PM, Jesper Louis Andersen > wrote: > >  >> On Tue, Apr 12, 2022 at 8:19 AM 'Jack Li' via golang-nuts >> wrote: >>

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Jesper Louis Andersen
On Tue, Apr 12, 2022 at 8:19 AM 'Jack Li' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hi group, > > Why Go provides only 2 built-in data structures, slice and map. It has > just more than C, but less than all other programming languages I've heard > of, C++, Python, Swift, Rust. > > I

[go-nuts] Re: Why Go has only slice and map

2022-04-12 Thread Sam Hughes
I'm certainly not privy to the nitty-gritty, but I'd encourage you to skim over the Go Dev team meeting notes. It's really cool to see what people have proposed over the years, how the team interacted with it, and ultimately why yes, why no. It's been really educational. The short of it is Java

Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-12 Thread Steven Hartland
First off, the package you're using for redis isn't maintained; you should switch to github.com/gomodule/redigo/redis instead, which will allow you to remove the c == nil check as that doesn't happen. In your example you're ignoring error from json.Marshal which could be hiding a problem, so I wou

Re: [go-nuts] Dynamically loading custom passes with gollvm?

2022-04-12 Thread Balamurugan M
Hi! Ohh! Yes please, that'll be very helpful for our experiments. Thank you so much. Regards On Mon, Apr 11, 2022, 2:50 PM Than McIntosh wrote: > Hello, > > At the moment gollvm doesn't support anything like the "-Xclang -load > -Xclang ...". > > It would not be too hard to add this though. Wa

Re: [go-nuts] Hesitating on using cached / un-cached channels

2022-04-12 Thread Zhaoxun Yan
Yes you are right! Unbuffered channel is solid! package main import ( "fmt" "time" ) var c = make(chan int) func report(){ for{ select{ case n:= <- c: fmt.Println(n, time.Now().Format("2006-01-02 15:04:05")) default: time.Sleep(tim

[go-nuts] Re: Constant CPU usage on an idle HTTP server from Go 1.17

2022-04-12 Thread Brian Candler
Correct: "go run" builds a binary and then fork/execs the binary it has built, to run it. On Tuesday, 12 April 2022 at 08:19:38 UTC+1 scorr...@gmail.com wrote: > By the way, the difference that I thought I saw between go run and the > compiled version was because the pid of the process to look

Re: [go-nuts] Dynamically loading custom passes with gollvm?

2022-04-12 Thread 'Than McIntosh' via golang-nuts
It would not be too hard to add this though. Want to send a patch? >>Ohh! Yes please, that'll be very helpful for our experiments. >>Thank you so much. I think you misunderstood my comment. I was asking if you would like to send a patch yourself. Thanks, Than On Mon, Apr 11, 2022 at 1

Re: [go-nuts] io.WriteString to a file panics

2022-04-12 Thread Rory Campbell-Lange
On 12/04/22, 'Sean Liao' via golang-nuts (golang-nuts@googlegroups.com) wrote: > > output, err := os.Create(o) > The short variable declaration you used to create `err` also shadows > `output`. Thanks very much for pointing out this shadowing problem. > > var err error > output, err = os.Create(

Re: [go-nuts] io.WriteString to a file panics

2022-04-12 Thread Jan Mercl
On Tue, Apr 12, 2022 at 9:53 AM Rory Campbell-Lange wrote: > Attempting to write to a named file panics on go 1.17 on Linux with: > > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x46123d] Not prov

Re: [go-nuts] io.WriteString to a file panics

2022-04-12 Thread 'Sean Liao' via golang-nuts
> output, err := os.Create(o) The short variable declaration you used to create `err` also shadows `output`. var err error output, err = os.Create(o) On Tue, Apr 12, 2022 at 8:53 AM Rory Campbell-Lange wrote: > I have a command line programme that can output to either stdout or a > named file.

[go-nuts] io.WriteString to a file panics

2022-04-12 Thread Rory Campbell-Lange
I have a command line programme that can output to either stdout or a named file. Output to stdout, as commented out in the small example below, works fine, but not to a named file. Attempting to write to a named file panics on go 1.17 on Linux with: panic: runtime error: invalid memory add

[go-nuts] [gollvm] Test for GoLLVM?

2022-04-12 Thread Lanzhiguan Huang
Hello, Any ideas about running the tests under go/test directory? I think the test framework is designed to be applicable for all the go compilers(go, gccgo, gollvm...) but it seems there is something like assembly or unrecognizable flags which will block the test. Is there an easy way to fi

[go-nuts] Re: Constant CPU usage on an idle HTTP server from Go 1.17

2022-04-12 Thread Santiago Corredoira
By the way, the difference that I thought I saw between go run and the compiled version was because the pid of the process to look at in the below example should be 63668, the tmp file, not 63548, the go run call. $ ps aux | grep test bill 63548 0.2 0.1 2044984 17588 pts/0 Sl+ 09:15

[go-nuts] Re: Constant CPU usage on an idle HTTP server from Go 1.17

2022-04-12 Thread Santiago Corredoira
Hi, yes, all about the toy program is the same. It was an attempt to get to a minimal example that anyone can reproduce so I could ask for help. The real problem is with a larger program where I get this 100% CPU usages ramdomly when the server is idle. I was thinking and with the basic example