You can try any IDE from JetBrains and it should support Go. Among debugging
and other things, see what the latest release brought to it:
http://go-ide.com/releases/0.11.1725/
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from
If md5 is enough at the end, use an io.T eeReader. If not, you need to buffer
it, with bytes.Buffer. That can be reused with sync.Pool (don't forget the
Reset).
For mime, the first 1024 bytes is enough. Read that into a [1024]byte and
create a Reader with io.MultiReader.
--
You received this
On Thu, Aug 4, 2016 at 3:33 PM, T L wrote:
>
> With some special memory optimizations for slice, I think it is possible to
> make efficient conversions from []T to []interface.
> For example, we don't need to convert every element in []T to interface{},
> we can just use following struct to repres
Because we cannot change symbols covered by the Go 1 contract.
On Thursday, 4 August 2016 14:20:18 UTC+10, T L wrote:
>
> http://dave.cheney.net/2016/04/07/constant-errors
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from thi
On Thursday, August 4, 2016 at 12:16:37 AM UTC+8, Ian Lance Taylor wrote:
>
> On Wed, Aug 3, 2016 at 9:12 AM, T L >
> wrote:
> >
> > On Wednesday, August 3, 2016 at 11:46:43 PM UTC+8, Axel Wagner wrote:
> >>
> >> True, but it would still be just the same loop, it wouldn't actually be
> >> s
Doh. Thanks. I did the setup but didnt click "execute".
Revisiting this because its now a bottleneck since it directly impact user
experience (how long a request will take to process) and scalability
(requests per second a single instance can handle). It wasn't pre-mature
optimization, rather p
I surely will use the first version in practice.
I just want to make things clear, :)
On Thursday, August 4, 2016 at 3:23:11 AM UTC+8, Hotei wrote:
>
> If you create the source as a byte array by converting it ([]byte("abcde")
> then the compiler can NOT optimize it away. However - I don't thin
http://dave.cheney.net/2016/04/07/constant-errors
--
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, visi
done.
https://github.com/golang/go/issues/16596
On Thursday, August 4, 2016 at 12:01:55 PM UTC+8, bradfitz wrote:
>
> Please file a bug.
>
>
> On Wed, Aug 3, 2016 at 8:20 PM, steve wang > wrote:
>
>> https://play.golang.org/p/gYYUDxj6Z5
>>
>> Is this an issue?
>>
>> --
>> You received this mess
Please file a bug.
On Wed, Aug 3, 2016 at 8:20 PM, steve wang wrote:
> https://play.golang.org/p/gYYUDxj6Z5
>
> Is this an issue?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails
https://play.golang.org/p/gYYUDxj6Z5
Is this an issue?
--
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
Those arguments must live beyond the scope of the enclosing function.
--
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.
F
What's the "login package"?
On Wed, Aug 3, 2016 at 3:12 PM, wrote:
> Anyone know why the tcp server closes its connection after of answer the
> login package?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this gro
(I have now recreated it on my Mac, under 1.7rc5, the runtime differences
are still there.) I thought the compiler was removing these as you suggest,
but then StartEnd and EndStart had wildly different running times, despite
using the very same values. So I added dummy assignments to double chec
Anyone know why the tcp server closes its connection after of answer the
login package?
--
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...@g
I tried just what you mentioned. Unfortunately even my interim solution
when it is outside of the net.http package and within mine, there are many
services that are not exported meaning I can't use them at all and the
variables themselves are inaccessible.
I tried copying pasting some functions
You need to use the values to ensure that compiler does not remove the code.
Even if the compiler does not do this, your Intel CPU will, if effectively runs
an ssa implementation in hardware and will spot the dead stores and skip the
load.
--
You received this message because you are subscribe
A few years ago, I uploaded a parallel “find duplicate files in a filesystem”
utility to GitHub. It is called “dup” for “find duplicates.”
https://github.com/MichaelTJones/dup/blob/master/dup.go
In that program, which first groups files by size, then compares the first few
bytes, then com
Yes, I suppose that clamping the file size, and the requirement that the
package must pass compilation, even md5 shall do. Thanks to the avalanche
effect.
On Wednesday, August 3, 2016 at 9:36:34 PM UTC+2, Hotei wrote:
>
> The fact that collisions are possible does not make them "easy to create"
I perused your blog entry you mentioned. It's very interesting and will
come in handy in the future. Thank you.
I can appreciate your point of view about accepting the fact that currently
listeners are not part of the Server and just proceed to produce code and
get it done ASAP. My interim
Tests are usually included in the package. Testing a package cannot become
easier this way and it is the only way to test internal functions, types,
variables or constants. However if you have large test files, it may make
sense to keep them in a separate repository because go-getting the packag
The common practice is to write tests as part of the package to test. This
allows you to test unexported functions and types, which is not be possible
outside of the package. Testing the package makes it very easy. I created
an external test package once for large test files, where including t
The fact that collisions are possible does not make them "easy to create"
especially when you add the compileable requirement. If you're uneasy
about md5 you could always use more bits - like SHA1 used by "git" or
SHA256 (or larger) if you're really paranoid.
On Wednesday, August 3, 2016 at 1:
If you create the source as a byte array by converting it ([]byte("abcde")
then the compiler can NOT optimize it away. However - I don't think it
will *use* the capacity information in the source since it's not relevant
and it's going to copy the data bytes and length in any case.
If you're w
Tu cast pola s ktorou pracujes mas v L1/ L2 cache. V momente ked
pristupujes k inej casti pola ktora je niekolko megabajtov vzdialena tak
procesor musi natiahnut tie udaje z ram do cache. Neviem presne cisla ale
trva to zhruba tych 300 strojovych cyklov . Vypadok L2 neviem kolko trva,
je to v m
On Wednesday, August 3, 2016 at 6:16:37 PM UTC+2, Ian Lance Taylor wrote:
>
> On Wed, Aug 3, 2016 at 9:12 AM, T L >
> wrote:
> >
> > On Wednesday, August 3, 2016 at 11:46:43 PM UTC+8, Axel Wagner wrote:
> >>
> >> True, but it would still be just the same loop, it wouldn't actually be
> >> s
Hi Victor,
There are no "constant" errors in the sql package if thats what you are
looking for.
Generally if .Ping() returns an error there is no connection - afaik the
error string might give some indication but it is totally up to the
driver/database.
If you want to sleep and try again later y
I'm a bit uneasy about this. Since checksumming is not collision-resistant,
I would be careful just relying on this.
The goal was to avoid diffing files but I don't know what is the fastest
way.
In any case, I guess a checksum is not enough to guarantee file integrity
(against malice). Maybe ad
> On 2 Aug 2016, at 13:47, John McKown wrote:
>
> On Tue, Aug 2, 2016 at 3:34 AM, wrote:
>
> Something is interfering with your computer accessing that URL. Probably a
> proxy, anti virus, or wifi captive portal.
>
> I live in Iran and golang.org is blocked for Iranian users by golang compa
What is the purpose of this? For instance, In govendor the hash of the
files, file names, and path is computed and recorded. That way if they are
modified it is detected. So yeah, md5 or blake2 would work just fine.
On Wednesday, August 3, 2016 at 10:14:53 AM UTC-7, atd...@gmail.com wrote:
>
> W
Would a md5 hash suffice?
I mean, it is probably easy to create collisions, but the source still
needs to compile so...
Or an md5 hash and using go/types to make sure that any object escaping the
package boundaries is still present and none other have been added.
Any idea?
--
You received t
On Thursday, August 4, 2016 at 12:40:41 AM UTC+8, Hotei wrote:
>
> Looking at the asm it appears that there is a conversion func called in
> the second version - right before the copy with memmove.
>
> Based on this I'd say what happens AFTER the conversion is the same in
> both version since t
Looking at the asm it appears that there is a conversion func called in the
second version - right before the copy with memmove.
Based on this I'd say what happens AFTER the conversion is the same in both
version since the destination is the same and the content is the same. The
only optimizat
On Wed, Aug 3, 2016 at 9:12 AM, T L wrote:
>
> On Wednesday, August 3, 2016 at 11:46:43 PM UTC+8, Axel Wagner wrote:
>>
>> True, but it would still be just the same loop, it wouldn't actually be
>> significantly faster. And you'd need to put quite some machinery into a
>> pretty rarely used functi
On Wednesday, August 3, 2016 at 11:46:43 PM UTC+8, Axel Wagner wrote:
>
> True, but it would still be just the same loop, it wouldn't actually be
> significantly faster. And you'd need to put quite some machinery into a
> pretty rarely used functionality, which means it also wouldn't be cleaner
Thanks for the explanation. It does look much better in proto3. I will
see if it will be possible to switch to proto3.
2016-08-03 21:37 GMT+05:30 Ian Lance Taylor :
> On Wed, Aug 3, 2016 at 8:58 AM, Sankar wrote:
>>
>> I have a .proto2 file, like:
>>
>> message s {
>> optional double a = 1;
>> }
On Wed, Aug 3, 2016 at 8:58 AM, Sankar wrote:
>
> I have a .proto2 file, like:
>
> message s {
> optional double a = 1;
> }
>
> When I run protoc and generate the .pb.go file, it contains code like:
>
> type S struct {
> A*float64 `protobuf:"fixed64,1,opt,name=a"
> json:"a,omitempt
On Wednesday, August 3, 2016 at 11:59:27 PM UTC+8, Hotei wrote:
>
> Have you tried examining the assembler output? go build -gcflags="-S"
> program.go if I recall correctly.
>
yes, the output is different, looks like optimization is not made here, but
I can't make sure.
>
>
> On Wednesday
https://github.com/golang/go/issues/15209
On Wednesday, August 3, 2016 at 11:20:01 AM UTC-4, T L wrote:
>
>
>
> On Wednesday, August 3, 2016 at 10:53:34 PM UTC+8, Jessta wrote:
>>
>> On 4 Aug 2016 12:36 a.m., "T L" wrote:
>> >
>> > Often, I need converting a []T to []interface{} to use the []inte
You probably don't want to actually call
fmt.Println(s...)
with s an []interface{}. Just do
fmt.Print(s)
instead.
On Wed, Aug 3, 2016 at 5:20 PM, T L wrote:
>
>
> On Wednesday, August 3, 2016 at 10:53:34 PM UTC+8, Jessta wrote:
>>
>> On 4 Aug 2016 12:36 a.m., "T L" wrote:
>> >
>> > Often, I nee
Have you tried examining the assembler output? go build -gcflags="-S"
program.go if I recall correctly.
On Wednesday, August 3, 2016 at 11:27:36 AM UTC-4, T L wrote:
>
>
> I know a string value can be used as []byte if the first parameter if the
> builtin copy/append function is a []byte valu
Hi
I have a .proto2 file, like:
message s {
optional double a = 1;
}
When I run protoc and generate the .pb.go file, it contains code like:
type S struct {
A*float64 `protobuf:"fixed64,1,opt,name=a"
json:"a,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
Why is the A field
On Wed, Aug 3, 2016 at 7:36 AM T L wrote:
> Often, I need converting a []T to []interface{} to use the []interface as
> a variable length parameter.
> But converting a []T for []interface{} in a for loop is neither clean nor
> efficient.
>
If there was a builtin that did it, it would simply need
Don't confuse variadic arguments with slice arguments, by the way.
On Wed, Aug 3, 2016 at 8:20 AM T L wrote:
>
>
> On Wednesday, August 3, 2016 at 10:53:34 PM UTC+8, Jessta wrote:
>
>> On 4 Aug 2016 12:36 a.m., "T L" wrote:
>> >
>> > Often, I need converting a []T to []interface{} to use the []
True, but it would still be just the same loop, it wouldn't actually be
significantly faster. And you'd need to put quite some machinery into a
pretty rarely used functionality, which means it also wouldn't be cleaner.
The thing is, that the memory representation of []T and []J, with J being
an in
I know a string value can be used as []byte if the first parameter if the
builtin copy/append function is a []byte value:
> var bs []byte = make([]byte, 10)
> copy(bs, "abcde")
but if do explicit conversion anyway on the second string value
> var bs []byte = make([]byte, 10)
> copy(bs, []by
On Wednesday, August 3, 2016 at 10:53:34 PM UTC+8, Jessta wrote:
>
> On 4 Aug 2016 12:36 a.m., "T L" > wrote:
> >
> > Often, I need converting a []T to []interface{} to use the []interface
> as a variable length parameter.
> > But converting a []T for []interface{} in a for loop is neither clean
On Wednesday, August 3, 2016 at 10:54:29 PM UTC+8, Axel Wagner wrote:
>
> Why is converting it in a loop "neither clean nor efficient"? It seems to
> be both to me: a) It's clean, as it's type-safe, so much less can go wrong
> and it's obvious what it does and b) it's efficient, becaue a func([
No it can have its uses.
It really depends on what you are doing. However, I've never done this as a
way to declare some kind of namespace.
Typically, I use that in testing when I want a dummy type to implement an
interface.
That's just an example.
It can be used also if you export the struct
Why is converting it in a loop "neither clean nor efficient"? It seems to
be both to me: a) It's clean, as it's type-safe, so much less can go wrong
and it's obvious what it does and b) it's efficient, becaue a func([]T)
[]interface{} would need to use reflection, just to also have the same loop
(b
On 4 Aug 2016 12:36 a.m., "T L" wrote:
>
> Often, I need converting a []T to []interface{} to use the []interface as
a variable length parameter.
> But converting a []T for []interface{} in a for loop is neither clean nor
efficient.
>
> So is there a function in standard lib to convert []T to a []
Often, I need converting a []T to []interface{} to use the []interface as a
variable length parameter.
But converting a []T for []interface{} in a for loop is neither clean nor
efficient.
So is there a function in standard lib to convert []T to a []interface{}?
--
You received this message bec
Any idea how to check for connection error in database/sql?
err := db.Ping()
if err == CONNECTION_REFUSED (?) {
time.Sleep
}
--
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 a
Downgrading to 1.6.3, I'm also getting consistent benchmark results. I'll
try 1.7 on my Mac at home later today, to see if it's a 1.7 thing or a
Windows thing or...?
On Wednesday, 3 August 2016 14:55:20 UTC+1, C Banning wrote:
>
> PS - that's with Go v1.6.
>
> On Wednesday, August 3, 2016 at 7:4
PS - that's with Go v1.6.
On Wednesday, August 3, 2016 at 7:49:49 AM UTC-6, C Banning wrote:
>
> On MacBook Pro, 2.6 GHz Intel Core i7, 8 GB 1600 MHz memory, running OS X
> 10.11.6, your benchmarks look pretty consistent:
>
>
> BenchmarkStart-4 20 1.45 ns/op
>
> BenchmarkEnd-
On MacBook Pro, 2.6 GHz Intel Core i7, 8 GB 1600 MHz memory, running OS X
10.11.6, your benchmarks look pretty consistent:
BenchmarkStart-4 20 1.45 ns/op
BenchmarkEnd-420 1.47 ns/op
BenchmarkHereThere-4 20 1.46 ns/op
BenchmarkSta
On MacBook Pro, 2.6 GHz Intel Core i7, 8 GB 1600 MHz memory, you benchmarks
look pretty consistent:
BenchmarkStart-4 20 1.45 ns/op
BenchmarkEnd-420 1.47 ns/op
BenchmarkHereThere-4 20 1.46 ns/op
BenchmarkStartEnd-4 20
I've got a question about best practices for test file packages, I've seen
this post
http://stackoverflow.com/questions/19998250/proper-package-naming-for-testing-in-golang
and wanted to know if there really was a best practice for writing tests,
or if it really comes down to black/white box s
Hello,
When you compile go program, all your source and source from all
imported packages is compiled together in the same binary (.exe). You
don't need to worry about it. That's actually one of the go strengths,
no dll hell.
On 03.08.2016 07:57, ov35...@gmail.com wrote:
Hi,
i have a prog
The issue here in essence is that an http.Server doesn't store a
new.Listener to expose, it only operates on one provided to the Serve
method. Without changing the api, there's no way to expose a listener in an
http.Server in a way that doesn't interfere with the other methods.
However, I also
Your research revealed the essential lines from ListenAndServeTLS that
basically say:
1. create a tls listener
2. have the server serve using that listener
The LimitListener example follows this same pattern, just with net.Listener
instead of a tls.Listener. A careful reading reveals that Liste
Hi,
i have a program that imports a package from github.com/abc...
when i build the .exe how can i have the package/dependency included in the
.exe ?
thanks,
Al
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group
Please give me your typemap. Thanks!
--
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 https://gro
Hi all, just saw a piece of software that make large use of methods defined
on (basically) empty structs as a namespacing hack.
Example:
type Foo struct {
}
func NewFoo() Foo {
return Foo{}
}
var (
foo = NewFoo()
)
func (self Foo) Bar1 () {
}
func (self Foo) Bar2 () {
}
This way I can
I suggest you also take a look at the Go spec that describes method values:
https://golang.org/ref/spec#Method_values
It seems to click on what you want to do.
Also, take a look at this article from Alex Edwards:
http://www.alexedwards.net/blog/organising-database-access more
specifically, the "
With times under one nanosecond I'm wondering what you're actually
measuring. Aggressive optimization could make this an "empty" loop.
Synthetic benchmarks like this can be tricky to interpret.
On Wednesday, August 3, 2016 at 7:56:32 AM UTC-4, Ondrej wrote:
>
> I wanted to see if there was a
I can understand at first glance we may perceive ListenAndServeTLS as a
convenience helper, but if enough people to copy and paste its contents to
modify it, then the sublety is
the function is actually assumed to be part of a Foundation/Framework that
people build on top of. It is under the gol
I wanted to see if there was a difference when loading values from a
large-ish slice (1 elements) - to see if caches, locality and other
things had any meaningful impacts. Whilst individual value loading (just a
single element) seemed to be equally fast regardless of element position
(see b
On 03/08/16 07:34, Rayland wrote:
> How can I use reflect to detect all fields that have the zero value, on
> a pointer object?
Here is a bit of code I wrote which overrides all the non zero fields in
one struct, from another which might be helpful for you to look at.
// SetDefaults for config fr
You use
https://godoc.org/reflect#Value.Field
https://godoc.org/reflect#Zero
https://godoc.org/reflect#Value.Interface
and read the docs :)
Don't take this the wrong way, but reflect isn't for the gentle-spirited,
it's ugly, errorprone and hard. You probably don't want to use it and if
you need to
2016-08-03 9:21 GMT+02:00 Tamás Gulácsi :
> Everyone says you should give in, and use what protoc-gen-go generates, but I
> don't know how stable is that...
This is indeed what you should do. But see also
https://github.com/gogo/protobuf which in combination with the proto 3
syntax will give you
ListenAndServeTLS is just a convenience helper, feel free to copy and modify
its contents, and use that function.
--
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
I'm in the need for sth similar. Don't forget that protoc-gen-go will generate
it's own struct's, which will differ from yours! Or at least extra care is
needed.
Everyone says you should give in, and use what protoc-gen-go generates, but I
don't know how stable is that...
--
You received this
This looks like a simple question, but actually it takes a bit of thought
and experimentation to arrive at a working structure.
I'm also working on an MVC solution. I've set up the source code structure
so that it's ready to commit to github, but the first version is not
complete, so it's not
74 matches
Mail list logo