Re: [go-nuts] glog + vendor = "flag redefined: log_dir"?

2018-01-30 Thread Ian Davis
On Tue, 30 Jan 2018, at 7:59 AM, porridge via golang-nuts wrote: > I admit I'm somewhat new to Golang, how do I solve this problem? > My program uses two libraries, both of which have > github.com/golang/glog in their /vendor/ directories.> This results in a > panic at runtime, apparently because

Re: [go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Ian Davis
Define a logging interface in your main package, then pass an implementation of the interface in your test that forwards writes to t.Logf On Tue, 30 Jan 2018, at 2:11 PM, Jérôme LAFORGE wrote: > No, it is not possible to use t.Log within the code you want to test.> The > function IsBuggyEven is n

Re: [go-nuts] what is the out put of this code and why?

2018-02-01 Thread Ian Davis
If it compiled (there are syntax errors) then I'd expect it to print each of the numbers 0..99 doubled, followed by a repeat of the last printed value. Each iteration of the second loop you set y = x[i]+i What are you trying to achieve? On Thu, 1 Feb 2018, at 9:43 AM, Ganesh kumar wrote: > packa

Re: [go-nuts] A Go Const suggester?

2018-03-28 Thread Ian Davis
On Wed, 28 Mar 2018, at 8:32 AM, Patrik Iselind wrote: > Is there such a tool that can go through a GoLang code base and > suggest values that might be a good idea to convert into constants?> > If a value (for example an int or a string, but excluding values that > are already constants) is hard c

Re: [go-nuts] The &(*x) idiom for copying.

2018-03-28 Thread Ian Davis
On Wed, 28 Mar 2018, at 5:21 PM, thwd wrote: > https://play.golang.org/p/pjyoPX99Zr1 > > Taking the address of an explicit dereference has different behavior > than implicitly dereferencing and taking address.> > Is this the desired behavior? It surprised me. I think the naming of your functions

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread Ian Davis
On Tue, 14 Aug 2018, at 11:19 AM, nicolas_boiteux via golang-nuts wrote:> Hello > > I need some assistance to decode a json content > > I tried to use only usefull code to do it but don't success to > retrieve the data part of the json result.> > > var user struct {Firstname string `j

Re: [go-nuts] Http/net - post and decode json data part

2018-08-14 Thread Ian Davis
On Tue, 14 Aug 2018, at 12:44 PM, nicolas_boiteux via golang-nuts wrote:> the raw of response.body is this > > > { "args": {}, "data": > "{\"firstname\":\"Nic\",\"lastname\":\"Raboy\"}", "files": {}, > "form": {}, "headers": {"Accept-Encoding": "gzip", > "Connection": "close","Cont

Re: [go-nuts] How to find other packages using this package?

2018-08-17 Thread Ian Davis
On Fri, 17 Aug 2018, at 5:08 PM, Tad Vizbaras wrote: > I have a package. Let say a/b/c. How to find what are other packages > in my GOPATH using it?> > I am basically trying to clean up GOPATH from all unused packages > installed and downloaded over the years.> Finding "dead" packages in GOPATH. >

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Ian Davis
On Thu, 30 Aug 2018, at 3:37 PM, Denis Cheremisov wrote: > Hi! > With Go 1.10 and earlier one can install binaries via regular `go > get`, `go get golang.org/x/tools/cmd/goimports` for instance.> It doesn't > work with Go modules enabled: > > $ go get golang.org/x/tools/cmd/goimports > go: canno

Re: [go-nuts] Setting font in draw2d

2018-09-11 Thread Ian Davis
On Tue, 11 Sep 2018, at 3:01 PM, viktor.oge...@gmail.com wrote: > Hi, > > I am struggling to load and use custom fonts from ttf files in draw2d > (used since I need rotated text).> > To illustrate: https://play.golang.org/p/6-rswetZOr8 give the output:> > 2018/09/11 15:52:43 open ../resource/fon

Re: [go-nuts] Generics - Why contracts?

2018-09-11 Thread Ian Davis
On Tue, 11 Sep 2018, at 3:23 PM, Jeff wrote: > TLDR; So why contracts and not templates or something else? Is there > a benefit to contracts that I don't appreciate (very likely, cause I > don't understand them)? Are there issues with a template approach? > If this has been addressed elsewhere, p

Re: [go-nuts] Announcing a Fyne GUI toolkit

2018-09-14 Thread Ian Davis
On Fri, 14 Sep 2018, at 6:02 PM, Andrew Williams wrote: > > It's now well into development and ready for people to get involved. > There is a long way to go but it feels like a solid base.> Instructions for > getting started, if you need them, are at > https://github.com/fyne-io/bootstrap/blob/m

Re: [go-nuts] Re: Why google doesnt make jdbc like library for go?

2018-09-21 Thread Ian Davis
On Fri, 21 Sep 2018, at 3:36 AM, ascarra...@gmail.com wrote: > He has a valid point. Most of the enterprise applications uses Oracle > DB. I for one is looking for an oracle driver similar to what JDBC > does (a simple to use, no separate installation needed). All of Go > oracle drivers available

Re: [go-nuts] Huge map[string]*Object and GC where *Object is from sync.Pool

2018-09-27 Thread Ian Davis
On Thu, 27 Sep 2018, at 2:04 PM, Peter Mogensen wrote: > > Of course... it requires that you handle any collisions in hashing the > string key to an int yourself, but wrt. the value I curious if anyone > can see issued with just storing a uintptr instead of the pointer for > sync.Pool managed o

Re: [go-nuts] Huge map[string]*Object and GC where *Object is from sync.Pool

2018-09-27 Thread Ian Davis
On Thu, 27 Sep 2018, at 3:06 PM, Peter Mogensen wrote: > > > On 09/27/2018 03:58 PM, Robert Engels wrote: > > It wasn’t necessarily a warning to you :) > > > > It comes from the days of GC bashing in Java and so everyone tried to > > manually write garbage free programs using pools and it had a

Re: [go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread Ian Davis
On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote: > `go mod download -json` does not product valid json? Is this a known > issue or am I missing something? Do you have an example that shows the invalid json? -- You received this message because you are subscribed to the Google Gro

Re: [go-nuts] Variadic functions using ...interface{}

2018-10-21 Thread Ian Davis
On Sun, 21 Oct 2018, at 10:52 PM, Justin Israel wrote: > I was getting an error trying to pass a []string to this elasticsearch > API ctor:> > https://github.com/olivere/elastic/blob/v6.2.11/search_queries_terms_set.go#L26> > > func NewTermsSetQuery(name string, values ...interface{}) > *TermsSe

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Ian Davis
On Mon, 22 Oct 2018, at 4:36 PM, Sathish VJ wrote: > So, I also tried with > *go test -v -bench=. -test.benchtime=0.1s * > and that does complete. > > But is the implication that StopTimer/StartTimer is too costly to use > even for this simple benchmark? See https://github.com/golang/go/iss

[go-nuts] Unable to view go-review.googlesource.com on Firefox 60.x

2018-11-16 Thread Ian Davis
Hi all, Since upgrading to Firefox 60.3 on Linux I am unable to view any pages on https://go-review.googlesource.com/ and I wondered if anyone else was seeing this problem or if it's an issue with my setup? Chromium renders the pages fine. When I view source with Firefox I see the following:

Re: [go-nuts] Unable to view go-review.googlesource.com on Firefox 60.x

2018-11-16 Thread Ian Davis
On Fri, 16 Nov 2018, at 6:05 PM, Wagner Riffel wrote: > I'm either on 60.3 under linux and it's working fine. OK thanks, it must be something on my system -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop r

Re: [go-nuts] Re: Strange glog.V(level) behavior in go.1.11.2 ?

2018-12-08 Thread Ian Davis
The best thing to do would be to make a self contained example that reproduces it and file an issue at https://github.com/golang/go/issues On Sat, 8 Dec 2018, at 8:49 AM, Jan wrote: > I still haven't solved the issue (I just keep that odd line _ = &hmm) > in the middle of the code.> > But I quick

Re: [go-nuts] Json and value

2018-12-12 Thread Ian Davis
On Wed, 12 Dec 2018, at 6:03 AM, olivier.gale...@gmail.com wrote: > Hello, > > I trie to get value from api request > i have this response > [{"id": > 62,"nom":"TEST","URI":"http://192.168.0.31/param/","IP":"192.168.0.31","MacAdress":"DE:AD:BE:EF:FE:ED","created_at":"2018- > 12-06T20:44:57.131380

Re: [go-nuts] Json and value

2018-12-12 Thread Ian Davis
On Wed, 12 Dec 2018, at 9:46 AM, olivier.gale...@gmail.com wrote: > i have the same response > [{"id": > 62,"nom":"TEST","URI":"http://192.168.0.31/param/","IP":"192.168.0.31","MacAdress":"DE:AD:BE:EF:FE:ED","created_at":"2018- > 12-06T20:44:57.131380+01:00","update_at":"2018-12- > 06T21:00:40.8

[go-nuts] Missing docker hub images for Go 1.11.4?

2018-12-18 Thread Ian Davis
Is there a problem with the docker hub build at the moment? Currently only Go 1.11.3 is available there: https://hub.docker.com/_/golang/ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails f

Re: [go-nuts] Using "er" and "able" for interfaces

2019-01-16 Thread Ian Davis
On Wed, 16 Jan 2019, at 2:42 PM, Victor Giordano wrote: > As far i can get to understand the english language (i'm not a native > speaker), the "er" seems to denotes or describe things in a more "active way" > (the thing that they actually do by itself), and the "able" describes things > in a mo

Re: [go-nuts] Unable to delete multiple records (multiple ids) on hitting endpoint

2019-01-17 Thread Ian Davis
On Thu, 17 Jan 2019, at 8:13 AM, aniruddha.dwiv...@nytimes.com wrote: > Hi I am using NYT's Marvin framework which internally uses gorilla mux. I am > able to delete single record when I pass single id as json object in request > body using postman but I don't know how to handle array of json obj

Re: [go-nuts] Using "er" and "able" for interfaces

2019-01-18 Thread Ian Davis
On Thu, 17 Jan 2019, at 7:48 PM, Jakob Borg wrote: > On 16 Jan 2019, at 15:42, Victor Giordano wrote: > >> >> As far i can get to understand the english language (i'm not a native >> speaker), the "er" seems to denotes or describe things in a more "active >> way" (the thing that they actual

Re: [go-nuts] What does a deadlock mean in golang?

2019-01-29 Thread Ian Davis
It's because the goroutine executing the main function blocks until the last channel send completes. But since you don't have another goroutine receiving from the channel the program cannot continue and remains in a blocked state. This is the cause of the deadlock. On Tue, 29 Jan 2019, at 8:55

Re: [go-nuts] Go modules do not respect vendor folder of dependencies (is this by design?)

2019-02-10 Thread Ian Davis
On Sun, 10 Feb 2019, at 12:03 AM, s...@pion.ly wrote: > * I have a project 'A' that is importing 'B' > * 'B' uses a vendor folder, if you delete the vendor folder the project does > not compile. > * With `GO111MODULE=on` I am unable to project 'A'. It tries to pull the > latest of 'B', and every

Re: [go-nuts] why add the useless function in interface?

2019-03-26 Thread Ian Davis
On Tue, 26 Mar 2019, at 12:37 PM, XiaoBing Jiang wrote: > Hi, all: > > in src/cmd/compile/internal/syntax/nodes.go, why need the aNode() function in > the interface? > > type Node interface { > // Pos() returns the position associated with the node as follows: > // 1) The position of a node repr

Re: [go-nuts] public interface with private method: totally dubious ? In which case is it useful ?

2017-09-04 Thread Ian Davis
It's a pattern that can be used to prevent external implementations of the interface. Another example is the text/template package in the standard library: https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L21 On Mon, 4 Sep 2017, at 01:21 PM, mhhc...@gmail.com wrote: > hi, >

Re: [go-nuts] Parsing a CSV column with partially double-quotes in it

2017-09-29 Thread Ian Davis
Try setting r.LazyQuotes=true On Thu, 28 Sep 2017, at 09:56 PM, Lantos István wrote: > > I want to parse the following CSV structure. The column separators > are tabs:> > *package main* > > *import (* > *"encoding/csv"* > *"fmt"* > *"log"* > *"strings"* > *)* > > *func main()

Re: [go-nuts] binary.Read()

2017-10-05 Thread Ian Davis
On Thu, 5 Oct 2017, at 08:58 AM, Johan terryn wrote: > In following code: > > type JPGFile struct { > Exif_SOI [2]byte Exif } type Exif struct { APP1Marker [2]byte > APP1DataSize uint16 ExifHeader [6]byte TIFFHeader[6]byte }> func > ReadFile(filename string) (JPGFile, error) {

Re: [go-nuts] big.Int.SetString fails with string created with bytes.Buffer

2017-10-10 Thread Ian Davis
On Tue, 10 Oct 2017, at 09:51 AM, aurelien.rain...@gmail.com wrote: > > func main() { > buf := bytes.NewBuffer(make([]byte, 4)) > buf.WriteString("1234") These two lines result in a string with 4 null bytes followed by 1234. Just use buf := &bytes.Buffer{} Ian -- You received this mess

Re: [go-nuts] "defer go"

2017-10-10 Thread Ian Davis
On Tue, 10 Oct 2017, at 02:27 PM, Shawn Milochik wrote: > On Tue, Oct 10, 2017 at 9:13 AM, Scott Cotton labs.com> wrote:>> Hi all, >> >> 1. "defer go" extend defers to work on goroutine exit with >>mechanism just like defer, but if we say "defer go f()">> instead of >> "defer f()" then we

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 09:57 AM, Gianguido Sorà wrote: > > I'm writing a small utility which uses a strings.Replacer to process > some substitutions in some strings; these strings contains UTF-8 > characters as well as emojis.> > Here you can find a playground with an example: > https://play.go

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 10:33 AM, Ian Davis wrote: > > On Wed, 11 Oct 2017, at 09:57 AM, Gianguido Sorà wrote: >> >> I'm writing a small utility which uses a strings.Replacer to process >> some substitutions in some strings; these strings contains UTF-8 &g

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 11:16 AM, Gianguido Sorà wrote: > Uhm, so the Replacer sees it as two separate entities, and replaces > the part of the composite that matches one of the cases. Sort of. The emoji is really just the "\xE2\x83\xA3" part (or "\U20e3") which puts a keycap symbol around the

Re: [go-nuts] Why can't I call a pointer-receiver method on a temperary but addressable struct literal?

2017-10-13 Thread Ian Davis
On Fri, 13 Oct 2017, at 01:41 PM, Cholerae Hu wrote: > https://golang.org/ref/spec#Calls >> If x is addressable[1] and &x's method set contains m, x.m() is >> shorthand for (&x).m()> > https://golang.org/ref/spec#Address_operators > Composite literals is addressable. > > So why can't I call Dum

Re: [go-nuts] Why can't I call a pointer-receiver method on a temperary but addressable struct literal?

2017-10-13 Thread Ian Davis
On Fri, 13 Oct 2017, at 02:02 PM, Ian Davis wrote: > On Fri, 13 Oct 2017, at 01:41 PM, Cholerae Hu wrote: >> https://golang.org/ref/spec#Calls >>> If x is addressable[1] and &x's method set contains m, x.m() is >>> shorthand for (&x).m()>> &g

Re: [go-nuts] Debugging a mutex/scheduling issue

2017-10-16 Thread Ian Davis
This sounds like https://github.com/golang/go/issues/13086 On Mon, 16 Oct 2017, at 09:01 PM, Caleb Spare wrote: > I have a server which is doing log processing and I'm trying to > improve throughput. The bottleneck is access to a shared resource > protected by a sync.Mutex. The issue is that even

Re: [go-nuts] slice of pointer of struct vs slice of struct

2017-10-20 Thread Ian Davis
On Fri, 20 Oct 2017, at 06:34 AM, Jan Mercl wrote: > On Fri, Oct 20, 2017 at 7:25 AM Feby Tanzil > wrote:> > > Which is better & preferable in Go? > > Depends on size of T. How does that affect the size of []T or []*T ? Ian -- You received this message because you are subscribed to the Goog

Re: [go-nuts] Urgent: race condition with ticker channels

2017-11-06 Thread Ian Davis
On Mon, 6 Nov 2017, at 12:14 PM, arunabh.ar...@gmail.com wrote: > Hi, > > I am fairly new to Golang, so please excuse if this is a silly > question. I could not find any answers on the web.> > Code portion A: > > rf.mu.Lock() > rf.electionTicker = time.NewTicker(rf.currentTimeout) > <===

Re: [go-nuts] Is the result right or not?

2017-12-06 Thread Ian Davis
You can see your error if you initialise i to -1 before the loop: v[i] is evaluated before i is incremented. On Wed, 6 Dec 2017, at 02:26 PM, T L wrote: > > package main > > import "fmt" > > func main() { > var i int > var x = []int{3, 5, 7} > var y = make([]int, 3) > for i, y[i] = rang

Re: [go-nuts] Matrix Operation

2018-01-02 Thread Ian Davis
Try gonum https://godoc.org/gonum.org/v1/gonum/mat On Tue, 2 Jan 2018, at 10:58 AM, meher akshay wrote: > Hi everyone, > > I want to find the eigen vectors and values of a matrix in golang. > Please help me as I am not able to do it using the provided docs > > Thanks > > -- > You received

Re: [go-nuts] Underlying arrays and their slices passed to functions

2018-01-05 Thread Ian Davis
On Thu, 4 Jan 2018, at 6:55 PM, Frank Davidson wrote: > Thanks!!! Very helpful blog post!! > > So, in proc, the slice header is copied, then an entirely new array is > created - []byte{5,6,7,8} - and the slice header copy is set to point > at that new array, and then discarded, whereas in proc 2,

Re: [go-nuts] "type MyByte byte", then how to convert []MyByte to []byte so that I can use bytes.Xyz functions for []MyByte?

2018-01-24 Thread Ian Davis
A loop is the usual way. On Wed, 24 Jan 2018, at 12:57 PM, d...@veryhaha.com wrote: > except unsafe ways. > > -- > 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

Re: [go-nuts] how to prevent go1.13 go directive being written in an go directive-free go.mod?

2019-06-11 Thread Ian Davis
https://golang.org/cmd/go/#hdr-The_go_mod_file documents the go directive as the "expected language version". It seems it would be better described there as the "minimum language version". On Tue, 11 Jun 2019, at 2:43 PM, Ian Lance Taylor wrote: > On Tue, Jun 11, 2019 at 6:40 AM Ian Lance Tayl

Re: [go-nuts] how to prevent go1.13 go directive being written in an go directive-free go.mod?

2019-06-11 Thread Ian Davis
Yes, I wrote minimum when I meant to write maximum! Sorry for the confusion. On Tue, 11 Jun 2019, at 3:37 PM, t hepudds wrote: > As far as I understand, it is not a minimum version of the language. > > Also, a key point that is easy to miss is that the language version is > distinct from tool

Re: [go-nuts] A proof-of-concept implementation of my generics proposal for Go

2019-06-27 Thread Ian Davis
Syntactically this looks very good. I have read your gist but I'd like to see this as a proposal in the Go issue tracker. Ian On Thu, 27 Jun 2019, at 3:29 PM, Michal Strba wrote: > Hey everybody! > > A few weeks ago, I posted about my proposal for generics in Go 2. You can > find it here. >

Re: [go-nuts] Re: `on err` alternative to `try()` has traction...?

2019-07-09 Thread Ian Davis
On Tue, 9 Jul 2019, at 11:43 AM, Nicolas Grilly wrote: > >> So why complicate the language with a new keyword which has really no >> purpose. > > As mentioned in the proposal, try is not a new keyword, it's just a new > built-in function. It's quite a bit more than a just new function since it

Re: [go-nuts] RFC for opt-in streaming support in encoding/json package

2019-08-09 Thread Ian Davis
On Fri, 9 Aug 2019, at 3:33 PM, Jonathan Hall wrote: > *I debated posting here, or straight to GitHub. If that's the better place, I > can move the thread there. * I have long wanted proper streaming support in > the `encoding/json` library. Lately I’ve been doing some digging to > understand th

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread Ian Davis
On Fri, 16 Aug 2019, at 7:09 PM, dr.ch.mau...@gmail.com wrote: > Dear Community and dear Go-developers, > > Meanwhile it is clear why things do not work: > The Go-Scheduler is unable to allow to switch to another goroutine in > busy-waiting-loops - > the only possibility to get around that proble

Re: [go-nuts] sync.Mutex encounter large performance drop when goroutine contention more than 3400

2019-08-20 Thread Ian Davis
On Tue, 20 Aug 2019, at 9:33 AM, changkun wrote: > Hi Robert, > > Thanks for your explanation. But how could I "logged the number of operations > done per Go routine", which particular debug settings you referring to? > It is reasonable that sync.Mutex rely on runtime scheduler but channels do

Re: [go-nuts] GO Mod (modules) for dummies. Please help.

2019-09-23 Thread Ian Davis
Hi, On Mon, 23 Sep 2019, at 11:04 AM, sdd.dav...@gmail.com wrote: > > If I have a reasonably large and complex (pet) project with local packages in > it. I like to split my project in to small units with 'namespaces' to keep it > manageable. These are NOT reusable components until I decide they

Re: [go-nuts] Cannot find libraries at go.pedge.io by Peter Edge

2019-09-25 Thread Ian Davis
On Tue, 24 Sep 2019, at 10:48 PM, Craig Rodrigues wrote: > I have a package where the dependencies were vendored in a few years ago > using govendor. > > I am trying to convert the vendor tree from govendor to go modules. > > I a having problems finding libraries written by Peter Edge, > which h

Re: [go-nuts] Forking gotk3 not working?

2019-09-25 Thread Ian Davis
On Tue, 24 Sep 2019, at 11:02 AM, erich.r...@gmail.com wrote: > Hi! This is perhaps more a question about git than Go but must have something > to do with go get, too. I tried to fork gotk3 from github on the web page > (using Fork button), because I need to merge some important 3rd party pull

Re: [go-nuts] Re: [golang-dev] go.dev is live!

2019-11-14 Thread Ian Davis
On Thu, 14 Nov 2019, at 4:54 AM, Dan Kortschak wrote: > Hi, > > It looks like license detection needs work. > > See https://pkg.go.dev/gonum.org/v1/gonum?tab=overview and note it has > a BSD 3 clause, as shown by GitHub's assessment (just above the "Clone > or download" button) at https://github.

Re: [go-nuts] github project - https://github.com/Tfindelkind/automation - How to compile and install each package when using "go get github.com/Tfindelkind/automation"

2016-08-22 Thread Ian Davis
On Mon, Aug 22, 2016, at 07:43 AM, tfindelk...@gmail.com wrote: > > > So what I want to achieve is. > > A windows user with go installed types: > > go get github.com/Tfindelkind/automation > > After this all executable are build and installed If you ask your users to use this then it will work

Re: [go-nuts] Pop out first element of a slice.

2016-09-20 Thread Ian Davis
On Tue, Sep 20, 2016, at 03:23 PM, Gabriel Adumitrachioaiei wrote: > I don't understand something when I want to pop out first element of a > slice and use it. > Here is my version: > > s := []int{1,2,3} first := s[] s = s[1:] > > > Here is a version that I saw in the standard library: > https://go

Re: [go-nuts] Pop out first element of a slice.

2016-09-20 Thread Ian Davis
On Tue, Sep 20, 2016, at 03:54 PM, Gabriel Adumitrachioaiei wrote: > Well, the capacity will be reduced by one. I don't think this makes > much difference. It makes a difference for a long running service that repeatedly pushes and pops. Ian -- You received this message because you are subscrib

Re: [go-nuts] Pop out first element of a slice.

2016-09-20 Thread Ian Davis
On Tue, Sep 20, 2016, at 04:15 PM, Gabriel Adumitrachioaiei wrote: > You might be right, but I just don't realize how. Since capacity will > be 2x or 1.5x as before, reallocating the slice will not happen often. > Or do you think that this would still be worse than copying almost all > slice everyt

Re: [go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Ian Davis
On Fri, Sep 23, 2016, at 03:35 PM, gary.willoug...@victoriaplumb.com wrote: > Yeah, the Json decoder should handle it. Maybe post a bug report? > https://github.com/golang/go/issues This has been raised before: https://github.com/golang/go/issues/12254 The answer is to use a reader to strip the

Re: [go-nuts] idea behind error interface and github.com/pkg/errors

2016-09-27 Thread Ian Davis
On Fri, Sep 23, 2016, at 08:03 AM, Ahmy Yulrizka wrote: > I understand that, I dont either. But what's the idea behind not > having it at the first place? Is there more to it other than make it > more simple? One possibility is that it reduces the number of allocations (for storing frame pointers)

Re: [go-nuts] Reasons why `go get` is entirely quiet by default

2016-10-13 Thread Ian Davis
On Thu, Oct 13, 2016, at 10:48 PM, Nyah Check wrote: > Hi everyone, > > I don't know if someone may have talked of this here. But I just wish > to find out why `go get` is entirely quiet by default? Unlike other > package managers like npm or yarn. Someone asked this on the IRC > channel today and

Re: [go-nuts] fmt.Fscan without delimeter

2016-10-19 Thread Ian Davis
On Wed, Oct 19, 2016, at 03:34 PM, Brian Picciano wrote: > Hi there! My use-case involves reading all data off of an io.Reader > and scanning it into a receiver value provided by the user of my > library. In many ways the same thing as fmt.Fscan. The difference is > that only one receiver value is

[go-nuts] Context cancellation

2016-11-02 Thread Ian Davis
Hi all, I'm trying to understand the idioms around cancellation of contexts. I've read the godoc and the relevant blog (https://blog.golang.org/context). Should you always call the cancelFunc of a cancellable context? Or should it only be called if the operation is terminated before successful co

Re: [go-nuts] Context cancellation

2016-11-02 Thread Ian Davis
On Wed, Nov 2, 2016, at 12:12 PM, Axel Wagner wrote: > From https://godoc.org/context > >> Failing to call the CancelFunc leaks the child and its children until >> the parent is canceled or the timer fires. The go vet tool checks >> that CancelFuncs are used on all control-flow paths. > > I'm not s

Re: [go-nuts] Context cancellation

2016-11-02 Thread Ian Davis
On Wed, Nov 2, 2016, at 12:56 PM, 'Axel Wagner' via golang-nuts wrote: > AIUI: A child or grandchild function is not supposed to signal that. > They can return an error and let the parent cancel, or they can create > their own child context WithCancel and cancel that. Context doesn't > replace exce

Re: [go-nuts] Context cancellation

2016-11-02 Thread Ian Davis
On Wed, Nov 2, 2016, at 10:35 PM, Gustavo Niemeyer wrote: > Hello there, > > On Wed, Nov 2, 2016 at 11:09 AM, Ian Davis wrote: >> __ >> >> On Wed, Nov 2, 2016, at 12:56 PM, 'Axel Wagner' via golang- >> nuts wrote: >>> AIUI: A child or grandchi

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 11:09 AM, Felix Geisendoerfer wrote: > I would love for net/http experts to take a look at the "Why this > package exists" section of the README, as well as the horrible hack > required to make things work: > > https://github.com/felixge/httpsnoop/blob/master/wrap.go#L44-L

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 02:21 PM, Felix Geisendörfer wrote: > Yes, I thought about it :). > > Did you read the "Why this package exists” section of the README? Yes but obviously not closely enough :) Kubernetes takes a hybrid approach: https://github.com/kubernetes/kubernetes/blob/master/pkg/a

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
er, http.Hijacker and io.ReaderFrom. > Perhaps they determined that the go core is only using these 2 > combinations. But that’s a bit too brittle of an invariant for me to > rely on. Therefor my package does the painful thing and implements all > 16 cases … > > Cheers > Felix &g

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 03:21 PM, Felix Geisendörfer wrote: > >> I would think that 99+% of all type checks are to determine whether >> the supplied object provides additional functionality that can be >> used. I'm struggling to think of a situation where you would type >> check for the Flush meth

Re: [go-nuts] html/template modifies template outside of actions

2016-11-11 Thread Ian Davis
On Fri, Nov 11, 2016, at 09:21 AM, Marvin Renich wrote: > the Execute method escapes the first character ('<' in " "<". This seems wrong to me, both logically and according to the > documentation, which states in the fourth paragraph under Overview for > text/template: > > all text outside act

Re: [go-nuts] Short Variable Declaration Question

2016-11-18 Thread Ian Davis
I think the sentence is supposed to read something like this: "The second declares out (and assigns to it as before) but only assigns a value to the existing err variable (without declaring it)" On Fri, Nov 18, 2016, at 03:02 PM, Terry McKenna wrote: > Hi Guys, > > I am reading "The Go P

Re: [go-nuts] [ANN] RAIS: Fully open-source IIIF-compliant image server... and BONUS: the exciting story of how Go made its way into UO Libraries

2016-11-23 Thread Ian Davis
Great story and congrats on your project On Wed, Nov 23, 2016, at 06:24 PM, Jeremy Echols wrote: > *Project:* > > This one's been out a long time, but I wanted to get to a place where > it felt solid before announcing it to this list. RAIS > (https://github.com/uoregon-libraries/rais-imag

Re: [go-nuts] So how exactly one does(should do) forking/pull requests in Golang world

2016-11-25 Thread Ian Davis
This is how to do it with a git repository: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html On Fri, Nov 25, 2016, at 10:31 AM, Mariusz Gronczewski wrote: > Hi, > > So let's say there is a project, living under path > github.com/local/project. Project is neatly

Re: [go-nuts] Re: Bloom filter

2016-11-28 Thread Ian Davis
On Sat, Jan 25, 2014, at 07:17 AM, greg.z...@gmail.com wrote: > Hello, I seem to be unable to Unmarshal a bitset over size 32.. What have you tried and what errors did you encounter? If you share some code then your question will be easier to answer. -- You received this message because y

Re: [go-nuts] Re: invitation to gophers.slack.com

2016-12-09 Thread Ian Davis
As an aside, does anyone know if there are publicly available chatlogs from the slack channel? On Fri, Dec 9, 2016, at 02:46 PM, jorelli wrote: > ^ is this still current? I signed up sometime last week but haven't > been able to get on (._.) > > trying to get over to the chat for github.com/

Re: [go-nuts] Re: How to use ~/ in terminal with go program?

2017-01-03 Thread Ian Davis
On Tue, 3 Jan 2017, at 09:45 AM, Aurélien Desbrières wrote: > Yes but how my software will run the day that this library disappear > because it is not native from golang.org? Vendor the library using Go's vendoring support. Then you will always have a copy of the code you need. -- You received

Re: [go-nuts] []struct{} vs. []*struct{}

2017-01-11 Thread Ian Davis
On Wed, 11 Jan 2017, at 12:15 AM, Steve Roth wrote: > Suppose you are reading a list of structures, and you do not know in > advance how many there will be. I'm trying to figure out when it's > better to append them to a slice of structures, and when it's better > to append pointers to them to

Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-13 Thread Ian Davis
On Fri, 13 Jan 2017, at 10:12 AM, mailte...@gmail.com wrote: > > Hello, > > Have been struggling with mitigating against nil pointer deference and > i would appreciate if anyone can help > > Code 1: Works file > https://play.golang.org/p/lhOh9g5R9l > > > Code 2: Error > https://pl

Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-13 Thread Ian Davis
On Fri, 13 Jan 2017, at 05:17 PM, mailte...@gmail.com wrote: > > Hello, > > Ignoring the error does not help > > https://play.golang.org/p/a8AIcHWII6 You changed your code by making your JSON valid so this is now a different problem to the one you originally asked. You can tak

Re: [go-nuts] XML: Encoder vs. Marshal

2017-01-18 Thread Ian Davis
On Wed, 18 Jan 2017, at 02:23 PM, Tomi Häsä wrote: > What is the difference between XML Encoder and Marshal (or > MarshalIndent)? They both are used when writing to a stream. When do > you use Encoder? Marshal doesn't write to a stream. It returns a byte slice which you could then use directly

Re: [go-nuts] Re: A proposal for generic in go

2016-06-21 Thread Ian Davis
On Tue, Jun 21, 2016, at 01:45 PM, andrew.mez...@gmail.com wrote: > >>I am not saying that generics is bad, but I am questioning whether > >>generics is necessary. > > Please, do not panic. > If you worry about the following things: > - Generated code will grow when used generics > - Generated co

Re: [go-nuts] Re: A proposal for generic in go

2016-06-21 Thread Ian Davis
On Tue, Jun 21, 2016, at 03:17 PM, andrew.mez...@gmail.com wrote: > >>increase in cognitive load to decipher chains of type definitions. > > Sorry, but who are members of this mail lists? > This is a first time when I hear about such loads such as the > `cognitive load`. > Also I am possible here

Re: [go-nuts] Re: Singleton pattern for a client handle

2016-06-30 Thread Ian Davis
On Thu, Jun 30, 2016, at 01:10 PM, awickert wrote: > > > Am Donnerstag, 30. Juni 2016 08:29:32 UTC+2 schrieb krma...@gmail.com: >> I want a single instance of a client handle to be initialized. >> >> Is it ok to declare the instance as >> >> var client MetricsClient >> >> and then initialize

Re: [go-nuts] Re: Singleton pattern for a client handle

2016-06-30 Thread Ian Davis
On Thu, Jun 30, 2016, at 01:10 PM, awickert wrote: > > > Am Donnerstag, 30. Juni 2016 08:29:32 UTC+2 schrieb krma...@gmail.com: >> I want a single instance of a client handle to be initialized. >> >> Is it ok to declare the instance as >> >> var client MetricsClient >> >> and then initialize

Re: [go-nuts] Vendored trace package causes panic because of implicit handlers

2016-07-06 Thread Ian Davis
On Wed, Jul 6, 2016, at 12:34 PM, Jakob Borg wrote: > 2016-07-06 9:11 GMT+02:00 Peter Bourgon : > > You can't actually make this distinction. > > There should be a single vendor/ dir at the root of the repo. > > See https://github.com/zellyn/wtf2 for a demonstration. > > (And https://github.com/pet

Re: [go-nuts] log.Logger, Why is this not an interface?

2016-07-08 Thread Ian Davis
On Fri, Jul 8, 2016, at 05:29 AM, zgersh...@pivotal.io wrote: > Hey All, > > Originally asked on twitter but a more long-form medium is required to > answer this question. I've recently been working on adding logging to > a library and have been replacing what was once a custom logging > interface

Re: [go-nuts] log.Logger, Why is this not an interface?

2016-07-08 Thread Ian Davis
On Fri, Jul 8, 2016, at 01:39 PM, Viktor Kojouharov wrote: > It would have been quite useful for the stdlib to define a logger > interface, so that third party loggers would implement it and allow > for easier switching between them Maybe, but one strength of Go's interfaces is that consumers of

Re: [go-nuts] What dependency management tool do you use?

2016-07-12 Thread Ian Davis
On Tue, Jul 12, 2016, at 09:23 PM, Henrik Johansson wrote: > I use gb. I like it a lot and I have had no issues. A quick question: how well do tools like go pprof work when your source code is managed by gb, outside of the GOPATH? -- Ian   -- You received this message because you are subscrib

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Ian Davis
On Fri, Jul 15, 2016, at 06:34 AM, Brad Fitzpatrick wrote: > goimports has been updated. > > If you've been frustrated by its speed lately, run: > >$ go get -u golang.org/x/tools/cmd/goimports > > ... and things should be much nicer. > > Details at https://golang.org/cl/24941 Some really ne

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Ian Davis
On Mon, Jul 18, 2016, at 03:13 PM, Rayland wrote: > Any thoughts on how to attack this problem? You could run the tiny example that Peter Waller wrote with the same test and share the results here. If we see the same slowdown pattern then it would eliminate a problem in your code. -- Ian -- Y

Re: [go-nuts] Re: http response issue with leaking handles

2016-07-28 Thread Ian Davis
On Thu, Jul 28, 2016, at 03:14 PM, James Bardin wrote: > > > On Thursday, July 28, 2016 at 2:40:38 AM UTC-4, > krma...@gmail.com wrote: >> resp, err := http.Get("https://api.ipify.org?format=json";) if resp != >> nil { defer resp.Body.Close() } >> > > This is incorrect. There's no guarantee that

Re: [go-nuts] Re: http response issue with leaking handles

2016-07-28 Thread Ian Davis
On Thu, Jul 28, 2016, at 03:50 PM, James Bardin wrote: > > On Thu, Jul 28, 2016 at 10:39 AM, Ian Davis wrote: >> Is it? The http package only says: >> >> "When err is nil, resp always contains a non-nil resp.Body. Caller >> should close resp.Body when done

Re: [go-nuts] Re: How to wait for specified amount of time in a loop without timer overhead

2016-08-04 Thread Ian Davis
Maybe you could investigate something like this: https://www.snellman.net/blog/archive/2016-07-27-ratas-hierarchical-timer-wheel/ Disclaimer: I've not tried that method, but I saw it recently and filed it away as potentially useful -- Ian On Thu, Aug 4, 2016, at 11:14 AM, pi wrote: > You mean

Re: [go-nuts] Re: is it possible to speed up type assertion?

2017-02-02 Thread Ian Davis
On Thu, 2 Feb 2017, at 09:20 AM, T L wrote: > > > On Thursday, February 2, 2017 at 4:58:32 PM UTC+8, Axel Wagner wrote: >> Hi, >> >> I can not really reproduce your results. I rewrote your code to use >> the builtin benchmarking: http://sprunge.us/IfQc >> Giving, on my laptop: >> >> Be

Re: [go-nuts] A Tour of Go: 45

2017-02-07 Thread Ian Davis
On Tue, 7 Feb 2017, at 03:36 PM, Tomi Häsä wrote: > Is it normal to get 45 in the Flow Control example? > > https://tour.golang.org/flowcontrol/1 > > package main > > import "fmt" > > func main() { > sum := 0 > for i := 0; i < 10; i++ { > sum += i > fmt.Println(i) > } > fmt.Print

  1   2   >