Re: [go-nuts] Built-in log Package

2017-08-17 Thread dc0d
> > Even better: my libraries expose only the LogFunc: i.e. > I am currently doing something similar; exposing an interface with four methods Error, Info, Errorf, Infof with a default logger that uses the built-in log, setup at init. Yet IMHO there is a need for a built-in package that allows

Re: [go-nuts] Built-in log Package

2017-08-17 Thread Henrik Johansson
Sorry to but in but what happened to the whole logging initiative that was on going? Did I miss something about that? It seems very related to this. tors 17 aug. 2017 kl 09:10 skrev dc0d : > As they say global variables/things are bad. But I even use a global >

[go-nuts] Re: defer func() { _ = resp.Body.Close() }()

2017-08-17 Thread 'Eric Johnson' via golang-nuts
For the truly paranoid, perhaps write a helper function "EnsureClosed()" or something like that, which will do the close, but perhaps also appropriately log a failure to close. On Wednesday, August 16, 2017 at 5:05:39 AM UTC-7, Gert wrote: > > To pass errcheck I need to do something like > >

Re: [go-nuts] Built-in log Package

2017-08-17 Thread dc0d
Henrik, Here I've tried to put a sample (other than the built-in log package) for cases that global stuff makes things more clear and pragmatic (IMHO). On Thursday, August 17, 2017 at 11:44:09 AM UTC+4:30, Henrik Johansson wrote: > > Sorry to but in but what happened to the whole logging

Re: [go-nuts] Built-in log Package

2017-08-17 Thread Peter Mogensen
On 2017-08-17 09:24, dc0d wrote: > Logging from a specific place in code helps with finding out /where/ the > error happened. And doing that manually is cumbersome. I for one can not > give-up on this because it makes fixing things super fast. github.com/pkg/errors ...solves many of those

Re: [go-nuts] Built-in log Package

2017-08-17 Thread dc0d
Logging from a specific place in code helps with finding out *where* the error happened. And doing that manually is cumbersome. I for one can not give-up on this because it makes fixing things super fast. Fortunately current logging packages (like zap) take care of that case by providing the

[go-nuts] The memory release about Turning C arrays into Go slices

2017-08-17 Thread jianzhangbjz
As the instruction of https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices shows, the GC of Go will not release it. An example as the following, but I have a question about when and how to release this `slice`? import "C" import "unsafe" ... var theCArray *C.YourType =

[go-nuts] Re: how can I decrypt "ENCRYPTED PRIVATE KEY" using golang

2017-08-17 Thread Lucio
On Thursday, 17 August 2017 09:11:12 UTC+2, Lucio wrote: > > > > On Friday, 11 August 2017 15:31:37 UTC+2, Terry An wrote: >> >> My private key is generated by "openssl req -new -x509 -keyout a.key -out >> a.crt -days 3650" with password. >> >> It seems you have a PKCS8 encrypted key, which

[go-nuts] Re: defer func() { _ = resp.Body.Close() }()

2017-08-17 Thread djadala
Useful additional info: https://mijailovic.net/2017/05/09/error-handling-patterns-in-go/ https://groups.google.com/forum/#!topic/golang-nuts/-eo7navkp10 On Wednesday, August 16, 2017 at 3:05:39 PM UTC+3, Gert wrote: > > To pass errcheck I need to do something like > > defer func() { _ =

[go-nuts] Re: Go ordered map

2017-08-17 Thread Sokolov Yura
I've implemented AVL tree as index for sort.Interface: https://github.com/funny-falcon/go-tree (It is not strictly index, cause it could Swap elements). So it could be used in conjunction with same type that is defined for sort.Sort . среда, 16 августа 2017 г., 3:17:29 UTC+3 пользователь Tong

Re: [go-nuts] Built-in log Package

2017-08-17 Thread dc0d
That's a nice package with good design (and I've used it for a while). But I loose the info about where the error is happening. On Thursday, August 17, 2017 at 11:59:10 AM UTC+4:30, Peter Mogensen wrote: > > > > On 2017-08-17 09:24, dc0d wrote: > > Logging from a specific place in code helps

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-08-17 Thread Sofiane Cherchalli
Thanks Medina! I'll give it a try On Friday, August 11, 2017 at 1:19:50 AM UTC+2, Diego Medina wrote: > > Hope you had a goo time on vacation. > > No need for custom types, specially with csv files, all you get are > "string" type, but you know that some columns are actually float values, or >

Re: [go-nuts] Built-in log Package

2017-08-17 Thread Christian Joergensen
On Thursday, August 17, 2017 at 11:40:08 AM UTC+2, dc0d wrote: > > That's a nice package with good design (and I've used it for a while). But > I loose the info about where the error is happening. > What do you mean by where the error is happening? Have you checked out

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread Soumya Mukherjee
Thank you both. I did not realize the latter syntax is that of a type conversion. On Thursday, August 17, 2017 at 1:43:45 PM UTC-4, Axel Wagner wrote: > > > > On Thu, Aug 17, 2017 at 6:09 PM, Soumya Mukherjee > wrote: > >> I am new to Golang. What is/are the difference(s)

[go-nuts] DialTLS + Context with http Transport

2017-08-17 Thread Gabriel Rosenhouse
Hello, We're trying to configure a http.Transport such that the client does extra validation of the server-provided certificate before sending any data. We want this client to compare server-provided certificate fields against values present on the request Context. In essence, we'd like to be

Re: [go-nuts] Calling Julia from Go

2017-08-17 Thread Dan Kortschak
What is it that you want to do in Julia? On Wed, 2017-08-16 at 23:57 -0700, mrech...@gmail.com wrote: > I would like to implement a valuation server. For the whole server  > infrastructure I would like to use Go, because it feels more natural > than  > any other language for it. For the

Re: [go-nuts] Built-in log Package

2017-08-17 Thread Chris Hines
On Thursday, August 17, 2017 at 3:14:09 AM UTC-4, Henrik Johansson wrote: > > Sorry to but in but what happened to the whole logging initiative that was > on going? > Did I miss something about that? It seems very related to this. > That discussion took place in this thread:

[go-nuts] Re: defer func() { _ = resp.Body.Close() }()

2017-08-17 Thread 'Robert Fritzsche' via golang-nuts
Hi Gert, it the -ignore flag an option for you? E.g. errcheck -ignore '[cC]lose' $(GOPACKAGES) Cheers! Robert On Wednesday, 16 August 2017 14:05:39 UTC+2, Gert wrote: > > To pass errcheck I need to do something like > > defer func() { _ = resp.Body.Close() }() > > instead of > > defer

[go-nuts] []T(nil) vs []T {}

2017-08-17 Thread Soumya Mukherjee
I am new to Golang. What is/are the difference(s) between the following declarations? []T(nil) and []T {} Both seem to work identically for me. Also, I was not aware of the first syntax ([]T(nil). Can someone point me to the Go document where this is introduced? -- You received this

[go-nuts] Re: built tests fail on sierra 10.12.6

2017-08-17 Thread moehrmann via golang-nuts
I filed an issue a few days ago since i had the same problem: https://github.com/golang/go/issues/21416 -- 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] Go 2 suggestion - what dependencies included in a build?

2017-08-17 Thread 'Eric Johnson' via golang-nuts
The compiler, at least, knows which packages were used to compile the source. Even absent additional metadata from something like Gopkg.lock, the compiler could still include info about the packages compiled into a binary. Knowing that something might be vulnerable - but not knowing the version

[go-nuts] [ANN] wireframe - wire-framing Go cli based project from start to finish

2017-08-17 Thread Tong Sun
Check out *wireframe*, which provides wire-framing for Go cli based projects for quick start https://github.com/go-easygen/wireframe It is a tiny Go cli code that demonstrates how to quickly get a Go based command line program started, and deployed. It illustrates - what basic info to

[go-nuts] Getting some strange benchmark results

2017-08-17 Thread Agniva De Sarker
Hi everyone, I have a piece of code which is behaving a bit strangely in benchmarks. Here is a simplified version of it. The only difference is that in one case, the destination is a different slice. On the other case, its the same slice as source. func BenchmarkStringCreate(b *testing.B) {

Re: [go-nuts] The memory release about Turning C arrays into Go slices

2017-08-17 Thread jianzhangbjz
Thanks your reply, you mean I should be release the memory of `theCArray` in C side? I still have some doubts, and I made a clearer example as the below, any problem with it? So, the memory of this tmpslice should be release by release the argv on C side? func GoStrings(length int, argv

Re: [go-nuts] Go 2 suggestion - what dependencies included in a build?

2017-08-17 Thread Lars Seipel
On Thu, Aug 17, 2017 at 09:54:43AM -0700, Eric Johnson wrote: > The compiler, at least, knows which packages were used to compile the > source. Even absent additional metadata from something like Gopkg.lock, the > compiler could still include info about the packages compiled into a > binary.

Re: [go-nuts] Built-in log Package

2017-08-17 Thread Henrik Johansson
Thx Chris, that's unfortunate it was many years until the Java world settled on something that worked in spite of having a built-in log package. This is truly an area where we seem to repeat the mistakes of the past. On Thu, 17 Aug 2017, 18:11 Chris Hines wrote: > On

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread Jan Mercl
On Thu, Aug 17, 2017 at 6:46 PM Soumya Mukherjee wrote: > What is/are the difference(s) between the following declarations? No declarations, both are expressions. > []T(nil) Type conversion. > []T {} Compound literal. > Both seem to work identically for me. They're

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread 'Axel Wagner' via golang-nuts
On Thu, Aug 17, 2017 at 6:09 PM, Soumya Mukherjee wrote: > I am new to Golang. What is/are the difference(s) between the following > declarations? > > []T(nil) > > and > > []T {} > > Both seem to work identically for me. > https://play.golang.org/p/g6EFru8hUU Literally