The slice which is created to be appended to b, points to &i, which (i)
gets updated in next (last) loop iteration.
Hence in last iteration, first element in `b` will start pointing to the
new array [4,5,6].
This could have been mitigated had `i` been allocated to new location on
every it
I don't know if its a good idea to have this in stdlib, but you can
definitely write your own to solve the problem :)
package main
import (
"fmt"
)
func Printfln(format string, a ...interface{}) {
fmt.Printf(format + "\n", a...)
}
func main() {
Printfln("%s is awesome!", "Go")
fmt.Println("yu
And a little better way to create `numMem`
https://play.golang.org/p/fAWgSpi2CKR
On Wednesday, 23 May 2018 12:55:49 UTC+5:30, Karan Chaudhary wrote:
>
> One other simpler (and not so elegant) solution is to use separate set for
> each element.
>
> https://play.golang.o
One other simpler (and not so elegant) solution is to use separate set for
each element.
https://play.golang.org/p/9ZSRfAyOX4-
@Bakul's solution sounds good but haven't tried to understand it clearly.
On Wednesday, 23 May 2018 11:46:15 UTC+5:30, Sankar wrote:
>
> Use an array instead of a sl
Will this help? https://github.com/aaronbriel/jsonjunit
I haven't tried it but piping the json output to jsonjunit can help.
On Saturday, 19 May 2018 19:55:24 UTC+5:30, Vedu Joshi wrote:
>
> I see that in go1.10, we can have json formatted "go test" output (by
> using -json flag)
> I googled aro
Interesting idea, Forud.
So I was reading net/http package, it has ResponseWriter which is an
interface as opposed to http.Request (which is a concrete type).
Then I wanted to know what all types implement http.REsponseWriter, which
reminded of your post here.
Is it possible to know this usi
Kindly discard this. I was looking at a different file.
--
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 option
Hi,
For a simple program:
package main
import (
"fmt"
"os"
"time"
)
func main() {
fmt.Println("hello!", os.Getpid())
time.Sleep(10 * time.Second)
}
I generate the core file using "gcore ".
Size of the core file is 1.1G.
Is that normal?
Isn't it eno
p allocations generated by incoming
>> requests, so I can optimize my handler functions
>>
>> I will write a more basic webserver example to see if I can produce the
>> result I am expecting
>>
>> Am Donnerstag, 30. November 2017 14:39:56 UTC+1 schrieb Karan Chaudhary
I think, this is what is happening.
I don't think this is a bug.
When server shuts down, it asks the kernel to release the resources it was
holding. One of the resources is port.
Though the program closed the port (by the shutdown()), but kernel still
keeps it in TIME_WAIT state. Now if w
If at any point it is to be checked that connection is active or not,
`Ping` can be used as stated by Shawn.
And any operation on dirty conn should fail, as the session is corrupt.
Though, it seems, auto-reconnection is already done by database/sql.
https://github.com/golang/go/issues/5718
O
Attaching png:
<https://lh3.googleusercontent.com/-3pu5f0Zvebw/WiAKKFjnVnI/KG4/hnPspzQzf7ASbvqtTU64rEMPSsZ3G1bzgCLcBGAs/s1600/profile003.png>
On Thursday, 30 November 2017 19:09:04 UTC+5:30, Karan Chaudhary wrote:
>
> Are you just trying to see how heap allocation can b
. November 2017 13:37:43 UTC+1 schrieb basti skalendudler:
>>
>> The go tool pprof command is interactive, so I thought it is enough type
>> 'png' to get the image after the benchmark is run
>>
>> I tested to start go tool pprof now as well during and
>From the top of my head, shouldn't the benchmark be done when traffic is
being sent to the server and not before it is sent?
On Sunday, 26 November 2017 00:11:40 UTC+5:30, basti skalendudler wrote:
>
> Hey guiys, I posted a StackOF question two days ago, but so far nobody was
> able to help me
With a quick look, it seems "net" is not the only pkg which depends on
cgo, though by default it uses pure Go DNS resolver only.
I tested on small program:
package main
import (
"fmt"
"net/http"
)
func main() {
fmt.Println("Hello, playground")
http.ListenAndSe
Yes it will work as "x" is within scope.
https://play.golang.org/p/dhBahtIVGb
On Tuesday, 7 November 2017 14:42:47 UTC+5:30, Abhijit Desai wrote:
>
> I want to log MyStruct value in "defer + go routine" so that logging
> will not affect total execution time of the the request which works
Is the port 5000 on 192.168.153.239 open? If it is open, is your server
running on that port?
https://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it
On Monday, 6 November 2017 19:30:22 UTC+5:30, 28911...@gmail.com wrote:
>
> I try
Oh, didn't check that!
On Monday, 6 November 2017 17:49:52 UTC+5:30, dja...@gmail.com wrote:
>
>
>
> On Monday, November 6, 2017 at 12:23:37 PM UTC+2, Karan Chaudhary wrote:
>>
>> Another one: http://go-search.org
>>
>
> Go Search
>
756881 <http://
CMIIW, I doubt if it is explicitly needed to close the request's body in
handler, as it seems, close of request's body is handled by stdlib upon
completion of handler.
Handler, in net/http, is called
here: https://github.com/golang/go/blob/master/src/net/http/server.go#L1804
Finish
Request
Another one: http://go-search.org
On Friday, 3 November 2017 21:21:48 UTC+5:30, 517 March wrote:
>
> as a new Go programmer,
> how could I know which package should be use?
>
> is there any search tool could be used?
>
> or does it just depend on your experience?
>
--
You received this message
>
> `go run` takes multiple files as arguments.
>
Interesting. Didn't know this was possible. Until now i used to fallback
to using go build if code was distributed over multiple files. (When i'm
testing some case which includes few files)
--
You received this message because you are subs
Just a note that waitGroup should be passed as reference to
functions/methods rather than as value. I have made mistakes where the
program hung as Done was called on copy of waitgroup rather than on the
original wg to which tasks were added.
Here it is not a problem as waitgroup used within an
You need to break the scanning by passing EOF to the program. Use ctrl-d
if you're on Unix based system.
go doc bufio.Scan
func (s *Scanner) Scan() bool
Scan advances the Scanner to the next token, which will then be
available
through the Bytes or Text method. It returns false when the
I see.
I'm trying to find rationale for this: why is "defer foo(x)" treated
differently than "defer func() { foo(x) }" by the language designers?
On Thursday, 28 September 2017 17:57:45 UTC+5:30, Jan Mercl wrote:
>
> On Thu, Sep 28, 2017 at 2:18 PM Karan Chaudhar
Hi,
I have a doubt regarding use of enclosing function's variables inside
functions used as "deferred".
If function literal is used as "deferred" func (say foo), and it uses
enclosing function's variable (say x) as one of its arguments,
the value of x is "frozen" and func foo is called with t
Hi,
I'm getting this error when install the project:
runtime.cgocall: nosplit stack overflow
584 assumed on entry to runtime.cgocall (nosplit)
528 after runtime.cgocall (nosplit) uses 56
520 on entry to runtime.entersyscall (nosplit)
480 after runti
26 matches
Mail list logo