Find a way to use comments for your ""big space"
On Fri, Jun 30, 2017 at 8:12 PM wrote:
> I have a few such bug bears, so, my trick is to 'fix' fmt's helpful
> services when I check a file out, and only run fmt automatically when the
> file is committed to the
https://github.com/golang/go/blob/master/src/runtime/malloc.go#L137
On Saturday, 1 July 2017 13:12:32 UTC+10, Jeremy Jay wrote:
>
> We've got a very high-memory (4TB) system available that I'm trying to
> make full use of. Anyone have any
> pointers on how to track down this issue? Is it a
https://github.com/golang/go/wiki/Iota
--
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 options, visit
`iota` is golnag's enum. I've seen this code in Wikipedia. But I did not
understand it. Can someone please explain this code?
type ByteSize float64
const (
_ = iota // ignore first value by assigning to blank identifier
KB ByteSize = 1 << (10 * iota)
MB
GB)
--
You
Hi,
I made a bash script that sets up a small go project with the name(s)
of my choice that already has a useful basic shape to start with --
an internal package, tests and benchmarking. (I borrowed code from the
official set up video and from Daves's Fibonacci example)
I'm happy with the way
Do you know where is this issue documented? I'm facing the same problem now
and tried to find more information. Thanks!
On Tuesday, October 4, 2016 at 6:47:30 AM UTC-7, Art Mellor wrote:
>
> Perhaps documenting the behavior is the best quick fix. Not knowing how
> 'main' gets altered - is it
I have a few such bug bears, so, my trick is to 'fix' fmt's helpful
services when I check a file out, and only run fmt automatically when the
file is committed to the repository.
This keeps my fugly habits out of the tidy fmt'ed space and at the same
time, keeps fmt's attempts to tickle my OCD
We've got a very high-memory (4TB) system available that I'm trying to make
full use of. Anyone have any
pointers on how to track down this issue? Is it a system configuration
thing, a go malloc bug, or something else?
Thanks!
Snippet of the crash follows:
fatal error: out of memory
fatal
https://go-proverbs.github.io
gofmt is our life now.
It is not meant (or possible) to be everyone's favorite.
--
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
I am learning the go language and really liking it. However, there are a
few things that drive me crazy and I wanted to list one in particular to
see if there is some way to change it.
When I write a package that has 20 different functions in it I like to add
4 or 5 blank lines between each
what you want is to set SetMaxOpenConns, SetMaxIdleConns:
db, err := sql.Open(config.DriverName, GetDataSourceFromConfig(config))
if err != nil {
log.Fatal(err)
}
db.SetMaxOpenConns(config.MaxOpenConns)
db.SetMaxIdleConns(config.MaxIdleConns)
On Friday, June 30, 2017 at 10:22:11 AM UTC-4,
log.Fatal() is what u want
On Fri, 30 Jun 2017 at 18:32, Andrew Pennebaker
wrote:
> For command line applications, it's often useful to terminate with a
> one-line string message, without presenting a stack trace. Could Go get a
> die-like standard function for
For command line applications, it's often useful to terminate with a
one-line string message, without presenting a stack trace. Could Go get a
die-like standard function for this?
panic() and log.Panic() are similar to die, except that panic always shows
a trace, even when a very newbie-facing
website: https://github.com/cosmos72/gomacro
install: go get github.com/cosmos72/gomacro
Fairly complete and interactive Go interpreter, implemented in pure Go,
supporting:
- all Go basic types, expressions, operators and builtins
- all Go statements except goto
- all Go declarations:
If you really have over 100 simultaneous connection you need to configure
postgresql engine
Regards
Franco
Il giorno mercoledì 21 giugno 2017 14:56:14 UTC+2, Tieson Molly ha scritto:
>
> I am running into an issue I have seen mentioned on here years ago. I am
> seeking the current best
Now that I looked at the source, I learned.
// Reader is the interface that wraps the basic Read method. // // Read reads
up to len(p) bytes into p. It returns the number of bytes // read (0 <= n <=
len(p)) and any error encountered. Even if Read // returns n < len(p), it may
use all of p
On Fri, Jun 30, 2017 at 2:42 PM Franco Marchesini <
franco.marches...@gmail.com> wrote:
> Aside from the correction, however, I did not understand why the method
is called 2 times.
HTH: https://play.golang.org/p/Na7GtgZ-_B
--
-j
--
You received this message because you are subscribed to
Aside from the correction, however, I did not understand why the method is
called 2 times.
Il giorno venerdì 30 giugno 2017 12:51:20 UTC+2, Franco Marchesini ha
scritto:
>
> Yes, after Dave's answer I realized the mistake.
> This is a solution.
>
> Il giorno venerdì 30 giugno 2017 11:42:45
It is certainly a micro-benchmark. I just wanted to ask in case it was
expected since I use golang on ARM based embedded systems a lot and they
tend to be sensitive to binary size. In the tests, my binary is stripped
(-ldflags="-w -s"), so I wouldn't think the size difference is related to
Yes, after Dave's answer I realized the mistake.
This is a solution.
Il giorno venerdì 30 giugno 2017 11:42:45 UTC+2, Sebastien Binet ha scritto:
>
>
>
> On Fri, Jun 30, 2017 at 11:38 AM, Franco Marchesini > wrote:
>
>> 1.
>>
>> Because with 2 there is a problem. The
Can you provide example code which demonstrates the problem? What you are
describing is not expected.
Reading and writing to channels simultaneously with the `<-` operator from
multiple goroutines should not generate memory race conditions by
themselves, but concurrency is complicated and it is
Hello All
I have a question about the use of race condition detector. (compiling with
-race options, to be precise).
I have a program which has a channel (size 1024): one goroutine is reading
and one is writing.
When I compile using -race , the detector says there is a race condition on
On Fri, Jun 30, 2017 at 11:38 AM, Franco Marchesini <
franco.marches...@gmail.com> wrote:
> 1.
>
> Because with 2 there is a problem. The method is called twice and is
> inefficient.
>
what about checking your errors, then ? :)
https://play.golang.org/p/K8j8D0AZe9
-s
> Il giorno venerdì 30
1.
Because with 2 there is a problem. The method is called twice and is
inefficient.
Il giorno venerdì 30 giugno 2017 11:31:31 UTC+2, Jan Mercl ha scritto:
>
> On Fri, Jun 30, 2017 at 9:48 AM Franco Marchesini > wrote:
>
> > Why after the execution the k value is 2?
>
Anyway thank you for the answer.
I know whats the problem.
This is an example of "cargo cult programming"
This is where I read the solutions.
https://gist.github.com/zyxar/2317744
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe
On Fri, Jun 30, 2017 at 9:48 AM Franco Marchesini <
franco.marches...@gmail.com> wrote:
> Why after the execution the k value is 2?
What value of k do you expect instead and why? (
https://play.golang.org/p/wdWo3fahAS)
--
-j
--
You received this message because you are subscribed to the
Sorry but the method work twice.
try this:
}
func (rot *rot13Reader) Read(p []byte) (n int, err error) {
k++
n, err = rot.r.Read(p)
for i := 0; i < len(p); i++ {
if (p[i] >= 'A' && p[i] < 'N') || (p[i] >= 'a' && p[i] < 'n') {
p[i] +=
Oh, sorry, I know. It'll be because the first time through your reader returns
, nil, and on the second time returns 0, io.EOF. So Read is called twice, but
on the second time does no work.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To
Print out the size of p each time Read is called
--
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 options,
Hello,
why the method Read of rot13Reader run twice?
This is the code:
package main
import (
"fmt"
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
}
var k int
func (rot *rot13Reader) Read(p []byte) (n int, err error) {
k++
n,
In my private sql driver implementation, I need to do some clean up during
conn.Close().
That clean up may block the DB.Query() for a second. That lead to the
latency.
Now I fix this problem by making conn.Close() do clean up asynchronously,
so the conn.Close() can return fast.
Doing clean up
Benchmark is not fair to this problem, it is the mean latency value.
This time I wrote a simple test, and just log the time elapsed.
Here is the code:
package main
import (
"database/sql"
"fmt"
"os"
"time"
_ "github.com/go-sql-driver/mysql"
)
var db *sql.DB
func RunNoMaxLifetime() {
In the mysqlConn.Close() method of mysql driver, it just send a quit
command, not wait for the server reply.
So the latency is neglectable.
But in my sql driver, I did some clean up, that make the conn.Close()
block. Now I fix this problem by doing close asynchronously, and
keep conn.Close()
here is the benchmark result for mysql driver:
k@k-ThinkPad-X270:sql$ go test -v -bench . --benchtime 60s -parallel 10
BenchmarkNoMaxLifetime-4 1000 13480 ns/op
BenchmarkMaxLifetime1S-4 1000 14356 ns/op
PASS
ok _/home/k/Desktop/work/test/sql 303.967s
The benchmark code is
34 matches
Mail list logo