Re: [go-nuts] Are receivers from a channel fifo?

2016-08-21 Thread 'Kevin Malachowski' via golang-nuts
Try it out :) seems like a simple enough test program to write. -- 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] defer at struct level

2016-08-21 Thread 'Kevin Malachowski' via golang-nuts
Do you have a code sample? I don't quite understand what you mean by something being "wrapped" in a struct. Will 'a' be a field in a struct? If so, you can just access it: defer myStructValue.a.Close() -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-16 Thread 'Kevin Malachowski' via golang-nuts
In that case it's generally "better" to have an explicit Close on your Go type which causes the explicit freeing of C memory. This can be tedious depending on your specific code, though. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Duplicate File Checker Performance

2016-10-15 Thread 'Kevin Malachowski' via golang-nuts
It also might be inefficient to call Sum multiple times with smaller slices compared to calling it once with a larger slice. Try using io.CopyBuffer and passing in larger buffer sizes to see if the CPU and memory usage start to converge. -- You received this message because you are subscribed

[go-nuts] Duplicate File Checker Performance

2016-10-15 Thread 'Kevin Malachowski' via golang-nuts
Sorry, I meant that calling Write on the hash type might be slower if it's called more often. (I'm on mobile right now. When I get back to a keyboard I'll try to come up with an example) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Why were tabs chosen for indentation?

2017-03-19 Thread 'Kevin Malachowski' via golang-nuts
I love that Go uses tabs because I use 3 spaces for my tabstop, and very few people share that preference. -- 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

[go-nuts] use of builtin print for debug

2017-05-08 Thread 'Kevin Malachowski' via golang-nuts
You can declare a func "print" in each package which just calls the real print func. When you want to turn off printing, you just have one line to comment out in that func to affect all callers. I'm curious why fmt.Printf doesn't work for you, though. In that case you'd still probably want a

Re: [go-nuts] New identifiers and selectors in short variable declarations

2018-01-09 Thread 'Kevin Malachowski' via golang-nuts
It is not a new declaration, it is definitely an assignment. This can be determined because (in Go) a new declaration has effects when closing over variables: https://play.golang.org/p/a_IZdOWeqYf (ignore the obvious race condition; it works the same but looks uglier with the requisite locks:

Re: [go-nuts] Re: Garbage collector and Slices

2018-08-20 Thread 'Kevin Malachowski' via golang-nuts
That information is old now - Go has a precise GC now. There is some sort of metadata stored for each variable related to whether the type contains pointers (as Jan alluded to earlier in the thread). On Monday, August 20, 2018 at 7:28:51 AM UTC-7, Florian Uekermann wrote: > > From the GC POV,

[go-nuts] Re: [RFC] Dynamically instrumentation Go binaries

2018-11-15 Thread 'Kevin Malachowski' via golang-nuts
If you can't recompile the binary, an option is to use a generic dynamic instrumentation platform like DynamoRIO (which I think works for Go programs after a recent bugfix). It works on windows, mac, and linux, and has been used in the past for various

Re: [go-nuts] scanner.Scan is holding my goroutine ;(

2018-12-13 Thread 'Kevin Malachowski' via golang-nuts
Can you post a short, self-contained (compile-able and runnable) example which shows the problem? Preferably hosted on play.golang.org for easy sharing and editing. If the scanner is reading from a reader which has been closed (returns io.EOF), the sc.Scan should return false (and the sc.Err

[go-nuts] runtime.readmemstats -> buckhash_sys increase

2018-12-24 Thread 'Kevin Malachowski' via golang-nuts
Is your application leaking memory allocated in C? (Are you using cgo-related packages at all?) -- 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] Re: Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread 'Kevin Malachowski' via golang-nuts
The best way to access the return value of a function is to name the return variable: func DoTwoThings(db *Database) (err error) { tx, err := db.Begin() if err != nil { return err } defer tx.Close() ... } Then any accidental shadowing doesn't matter because the "defer" is referring to the