[go-nuts] Understanding logic behind failing nil check

2019-11-21 Thread Kevin
hi all, Im relatively new to go (but been a developer for over 15yrs) and wrote some code like this and it perplexed me for a couple hours. ``` var _ error = &Error{} type Error struct{ message string } func (e *Error) Error() string { return e.message } func call1() error { return call2() } func

[go-nuts] Re: Should I return an error object, or a pointer to an error object?

2019-11-21 Thread Kevin
seems I have found out why you must return a pointer but it has to be of type `error` return :/ I posted this gotcha a few mins ago. https://forum.golangbridge.org/t/logic-behind-failing-nil-check/16331?u=kevlar_c On Wednesday, November 13, 2019 at 5:24:30 PM UTC, Brian Candler wrote: > > In http

[go-nuts] Re: Tweaking sync.Pool for mostly-empty pools

2018-02-15 Thread Kevin Malachowski
If there is likely nothing in the Pool, then maybe it's better to not use one at all. Can you compare the internal workload with an implementation where all callers just call the `New` function directly? What's the purpose of using a pooled memory if there's often nothing in the pool? On Wednes

[go-nuts] Silent errors during template execution

2018-03-24 Thread Kevin Malachowski
Can you post a minimal (but compilable and runnable) example which shows exactly what isn't working? You can create and share this conveniently using play.golang.org. Creating a small, self-contained example is helpful in that it helps us see exactly what isn't working, and can be helpful to yo

[go-nuts] How to update packages without duplicating distro packages

2018-08-05 Thread Kevin Locke
documentation that I may have overlooked would be much appreciated. Thanks, Kevin -- 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..

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-08 Thread Kevin Locke
On Wed, 2018-08-08 at 11:50 +0200, Jan Mercl wrote: > On Mon, Aug 6, 2018 at 6:12 AM Kevin Locke wrote: >> Is there a way to update packages installed using `go get` without >> duplicating packages that are distributed with Go or by my Linux >> distribution? > &g

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-08 Thread Kevin Locke
On Wed, 2018-08-08 at 14:20 +0200, Jan Mercl wrote: > On Wed, Aug 8, 2018 at 1:40 PM Kevin Locke wrote: > > In my initial email $GOPATH was unset. > > Then I would try (unset $GOPATH defaults to being effectively the same as > $HOME/go on nix) > > $ cd $HOME/go/src ; g

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-08 Thread Kevin Locke
is example) without installing additional dependencies which weren't initially installed? Thanks again for your explanation, Kevin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emai

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-09 Thread Kevin Locke
On Thu, 2018-08-09 at 06:18 +, Jakob Borg wrote: > On 9 Aug 2018, at 00:09, Kevin Locke wrote: >> Thanks for the explanation! Is there a way for me to update the >> locally installed packages (shfmt and its dependencies in this >> example) without installing addition

Re: [go-nuts] Why "strings" package exists ?

2018-08-15 Thread Kevin Malachowski
Well, the 'error' type has a method. But none of the other primitives do. -- 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

Re: [go-nuts] Re: What is the behavior of an HTTP persistent connection in Go?

2018-08-21 Thread Kevin Conway
> Are requests sent serially ... so that other concurrent requests to the same host are blocked When sending requests using HTTP/1, each connection will handle only one request at a time except when using pipelining. When sending requests using HTTP/2, each connection may manage any number of req

Re: [go-nuts] `exec: "gcc": executable file not found in $PATH` when compiling as a module

2018-08-27 Thread Kevin Bowrin
>From Russ Cox on Twitter: Because the pre-built packages are non-module builds and can’t be reused. Sorry. Disable cgo for now or install gcc. https://twitter.com/_rsc/status/1034143103509311493?s=19 On Mon., Aug. 27, 2018, 5:14 p.m. , wrote: > https://gist.github.com/kevinbowrin/5f93152fdac

[go-nuts] Q on using reflect: how to distinguish methods from functions?

2018-12-14 Thread Kevin Malachowski
Why do you need to figure out whether something is a Method? Usually it doesn't really matter. (I don't have an answer for you, but if you give more background I or someone else may be able to be more useful; trying to avoid the X-Y problem.) -- You received this message because you are subscr

Re: [go-nuts] Json decode : Monitoring errors properly

2018-12-26 Thread Kevin Conway
> For example, the error returned may show : "*invalid character 'G' looking for beginning of value*". But you can't see the original message. I believe https://golang.org/pkg/encoding/json/#Decoder.Buffered was added for this purpose. For example, https://play.golang.org/p/yAn2fypIELc > 1- I'm n

Re: [go-nuts] Json decode : Monitoring errors properly

2018-12-26 Thread Kevin Conway
> I believe https://golang.org/pkg/encoding/json/#Decoder.Buffered was added for this purpose. I just caught on that this method is exactly what you showed in the original message. I guess my input can be reduced to "I think that's your only option when using the decoder". I do think you've corre

Re: [go-nuts] Can I say a stack overflow is a panic?

2019-01-04 Thread Kevin Conway
There are several conditions that bypass recover. Another example is "fatal error: concurrent map read and map write". The error messages typically start with "fatal error" and represent a non recoverable exception in the run time rather than a user defined condition. I don't know the official ter

[go-nuts] Re: Writing an Excel add-in using Go?

2019-01-22 Thread Kevin Powick
n-express.com/add-in-net/index.php I have no affiliation with them. I'm just a happy customer. -- Kevin Powick On Tuesday, 22 January 2019 10:35:24 UTC-5, mrec...@gmail.com wrote: > > Hi, > > I was wondering if there is a library supporting writing an Excel add-in > in Go. G

Re: [go-nuts] Re: View http open connections

2019-02-13 Thread Kevin Conway
der heavy load (and clients >> see connection reset by peer) >> >> Does anyone know a way of getting current open connections? >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from

[go-nuts] Gomobile Java generation

2019-03-06 Thread kevin . harrison
1. What version of Go are you using (`go version`)? go1.11.4 darwin/amd64 2. What operating system and processor architecture are you using? GOOS="darwin" GOARCH="amd64" 3. What did you do? I attempted to generate android bindings using gomobile bind. 4. What did you expe

[go-nuts] gomobile genjava duplicate constructor definition

2019-03-15 Thread kevin . harrison
I am attempting to update a service package which was written to be used on mobile devices by using the gomobile bind package. It appears there was a change made in this commit

[go-nuts] Re: gomobile genjava duplicate constructor definition

2019-03-18 Thread kevin . harrison
Elias, thank you for the prompt response and submitting a fix. I have checked this out, and though it does result in successful compilation, it does not solve my problem because the public constructor is removed allowing me no initializer access from the application side. I had attempted to fix

[go-nuts] Re: Choosing a framework

2017-09-13 Thread Kevin Powick
think is too bloated, and one I might consider. Again, these are for personal reasons, so I suggest you learn Go more fully before making a decision. -- Kevin Powick On Saturday, 9 September 2017 19:51:40 UTC-4, Tim Uckun wrote: > > I am in the process of learning go and decided to do it by w

[go-nuts] Do you check in vendor packages?

2017-09-14 Thread Kevin Malachowski
I generally vote for checking in, or at least ensuring that /something/ has an in-house copy of all dependencies. The worst thing that can happen is someone deleting their repository and having your project being super broken. (See also https://www.theregister.co.uk/2016/03/23/npm_left_pad_chaos

[go-nuts] Re: What is the best way to represent functional options within factory methods?

2017-10-11 Thread Kevin Malachowski
Why do you need all of your factories to have a common parameter? Also, what problem are you trying to solve? If you're just trying to organize your code, to what end are you pursuing this generalization? That is, what would you like your final code to look like? (Feel free to use psuedocode to

Re: [go-nuts] a bug about go language

2017-10-26 Thread Kevin Powick
hing wrong with Go and/or the program itself. This is probably not the best way to learn Go. Try staring with the Go Tour (https://tour.golang.org), and read some of the other excellent documentation at golang.org. -- Kevin Powick PS. If you find SublimeText useful, you should support the author b

[go-nuts] Starting an HTTP server and logging about it

2017-11-09 Thread Kevin Burke
I want to start an HTTP server, and then once it's started, log a message that the server has started. Here are the options for doing that: - log ahead of time. The message gets logged before the server starts listening on a socket, which means you might get the message and then an error l

[go-nuts] net/http: Server closeIdleConns does not close StateNew connections

2017-11-13 Thread Kevin Burge
to become StateActive, but... in Chrome's case, it didn't. https://github.com/golang/go/issues/22682 https://play.golang.org/p/dP4vQZkKdx Kevin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Easy access to #golang

2017-11-19 Thread Kevin Powick
On Friday, 17 November 2017 10:47:44 UTC-5, Sam Whited wrote: > > Hi all, > > I don't like signing up for accounts, or having to jump through hoops > (even if they're relatively straight forward hoops) to get an invite to > something that should just be public. Also, some people seem to like

[go-nuts] Re: Why are can't struct field types not be used as types

2017-12-10 Thread Kevin Malachowski
Why not name the inner type? https://play.golang.org/p/8hyMLUVbCp -- 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 mo

Re: [go-nuts] Best way to add retries to existing library using net/http.Client?

2017-12-11 Thread Kevin Conway
A few of us had a very short discussion on the subject here: https://groups.google.com/forum/#!topic/golang-nuts/rjYdaFM5OBw Almost all go code I've seen that requires an HTTP client takes an `*http.Client` as one of the parameters. This doesn't leave consumers with many other options than to leve

[go-nuts] Donating to Go/Go-adjacent causes

2017-12-21 Thread Kevin Burke
estion, but I figure the people who read this email will know the best places to give. Thanks! Kevin -- 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 gol

[go-nuts] Re: why can't change map when in for range statements?

2018-01-15 Thread Kevin Powick
s evaluated once before beginning the loop, with one exception: if the range expression is an array or a pointer to an array and at most one iteration variable is present, only the range expression's length is evaluated; if that length is constant, by definition the range expression itself

[go-nuts] Re: why can't change map when in for range statements?

2018-01-15 Thread Kevin Powick
first place. Some type of a conditional with a *break* statement would seem better to me. -- Kevin Powick On Monday, 15 January 2018 22:00:30 UTC-5, sheepbao wrote: > > Thanks reply, I know *range expression is evaluated once before beginning > the loop, *but I delete map in for statemen

[go-nuts] Experience Report building OCR in Go

2018-01-15 Thread Kevin Malachowski
Not sure about the GUI points: exp/shiny has worked really well for me and has existed for at least a year. I do admit that 4 years ago I tried my hand at a GUI framework for Go though... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

[go-nuts] Re: Go as your first language

2018-01-16 Thread Kevin Powick
I've had good feedback from colleagues on the following course. https://appliedgo.com/p/mastergo There are also the usual reference at golang.org such as "Effective Go", the on-line introduction, and the language spec itself. -- Kevin Powick On Tuesday, 16 January 2018 02:10:

[go-nuts] Avoiding duplication in parallel tests

2018-01-17 Thread Kevin Burke
I have a bunch of tests I would like to run in parallel; I think this is a common situation for database backed tests where you might need to establish a connection or a transaction, run a bunch of queries, and then truncate the database. Right now I have something like this: func testA(t *test

[go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-21 Thread Kevin Malachowski
Given the last playground post, I'd guess that the aliased type (i.e. 'int' here) is being used for visibility rather than the alias's new name. It's also a little weird to use embedded types that dont need to be (there's no method promotion here because 'int' has no methods), or seeing aliases

[go-nuts] A string with zero ptr and cause SIGSEGV

2018-01-28 Thread Kevin Malachowski
Try running the code with the race detector (compile with -race), mysterious crashes are usually caused by data races. It's weird that it would happen with a string parameter to a function though. Are you using multiple goroutines in that function to modify/access a string? Can you share the co

[go-nuts] Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-28 Thread Kevin Malachowski
Given TCP connection reuse I don't think the os/kernel will be able to tell apart the TCP connections any better than intercepting the net.Conn with a custom listener. Especially if you're using anything encrypted, staying in Go is going to be necessary for you to get the sort of data you need.

[go-nuts] Could the go Tour be clearer on WHY recent make := zeroes

2019-06-20 Thread Kevin Chadwick
Hi "https://tour.golang.org/moretypes/13"; "The make function allocates a zeroed array and returns a slice that refers to that array." Yet more detailed literature states that make does not zero whilst new does. I gather this is because the shorthand used in the tour, instantiates new in the ba

Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes

2019-06-20 Thread Kevin Chadwick
On 6/20/19 8:30 PM, fge...@gmail.com wrote: > I'm not sure what you are asking for, but  > the spec on initialization is quite clear: > https://golang.org/ref/spec#The_zero_value > > I'm curious which detailed literature are you referring to? I was prompted by atleast a couple of books but also t

Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes

2019-06-21 Thread Kevin Chadwick
On 6/21/19 10:42 AM, fge...@gmail.com wrote: > (I forgot in my previous message: the email subject seems to imply > that := or make() was changed since 1.0. No it wasn't.) That was simply based on this, perhaps prior to 1.0?: "https://groups.google.com/forum/#!searchin/golang-nuts/make$20new$20ze

Re: [go-nuts] How to execute a command using root?

2019-08-30 Thread Kevin Chadwick
On 8/30/19 7:49 AM, Benjamin wrote: > Do anyone have any suggestions on this? Thanks Sudo is an option. I prefer to have a master root process that spawns workers processes that drop privileges via setegid...seteuid... syscalls to dedicated users for various tasks. Takes concurrency to the next le

Re: [go-nuts] go runtime/stubs.go noescape

2019-10-15 Thread Kevin Malachowski
I believe the question was about the specific implementation of noescape, specifically the "exclusive or" in that unsafe expression. To the original poster: are you just curious why, or is there a more specific question you have? I'm assuming that function looks like that to correctly trick the

Re: [go-nuts] Re: Roadblock for user-implemented JIT compiler

2019-10-24 Thread Kevin Chadwick
On 2019-10-24 09:50, Gert wrote: > This kind of low level is way out of my league but what about > using https://github.com/tinygo-org/tinygo instead to build your JIT? I only > know tinygo has no garbage collector at all. Don't let this stop you getting things done but I would hope that any newly

[go-nuts] Re: [64]byte()[:]

2019-11-16 Thread Kevin Malachowski
"make"ing a byre slice every time you call Equal is not likely as efficient; surely it will put pressure on the garbage collector, assuming it's not just called a few times. Writing something in less lines is not strictly better. I'd probably just make package level variable and reuse it among

Re: [go-nuts] Re: [64]byte()[:]

2019-11-17 Thread Kevin Malachowski
n Sun, Nov 17, 2019 at 1:00 AM Kevin Malachowski > wrote: > >> "make"ing a byre slice every time you call Equal is not likely as >> efficient; surely it will put pressure on the garbage collector, assuming >> it's not just called a few times. >> > &

[go-nuts] Re: early close of http.Client's Response.Body

2019-11-28 Thread Kevin Powick
-http-client-library-for-load-testing/ -- Kevin Powick On Monday, 25 November 2019 12:54:04 UTC-5, Liam wrote: > > Scenario: > Sending a client request and only reading the whole Response.Body for > certain .StatusCode values, and/or reading only the first N bytes. > > Docs for

[go-nuts] Type And Interface Equivalence

2016-09-02 Thread Kevin Conway
Not sure exactly how to describe this issue or the right words to use when talking about some of the concepts. Here's a best effort. Given a type T that implements interfaces A1 and A2, T is an acceptable input for any function that requires an A1 or A2 as input. Given A1 and A2 are identical in d

Re: [go-nuts] http.Client interface

2016-12-11 Thread Kevin Conway
> How would I swap out a http.Client that is required by a third-party library with a another that supports, say retries with exponential back-off? I'd suggest looking at http.Transport and http.RoundTripper [ https://golang.org/pkg/net/http/#RoundTripper]. The docs explicitly forbid using RoundTr

[go-nuts] Donating to Go/related causes

2016-12-24 Thread Kevin Burke
e? Apologies if this isn't the best place for this question, but I figure the people who read this email will know the best places to give. Thanks! Kevin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

Re: [go-nuts] xml for a person used to python's lxml - multiple attributes

2017-01-04 Thread Kevin Powick
On Monday, 2 January 2017 22:03:15 UTC-5, Sayth Renshaw wrote: > > Is there a good simple ORM or pipeline to push data to a database like > SQLite? > Many popular packages (libraries) for Go can be found by category at the following link. https://go.libhunt.com -- Kevin Powi

[go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Kevin Manley
I am new to Go so I'm sure this is just me misunderstanding how things work, but I was surprised at this result. Please can someone help me understand why the return value from Validate() is not seen as nil by the caller, despite Validate() returning nil? TIA, Kevin https://play.golang.

Re: [go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Kevin Manley
Thanks, makes sense On Friday, July 1, 2016 at 8:06:45 PM UTC-4, Caleb Spare wrote: > > https://golang.org/doc/faq#nil_error > > Make Validate return error, not MultiError. > > -Caleb > > On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley > wrote: > > I am new

[go-nuts] Re: Hi, someone may help me converting this python code to GO

2016-07-09 Thread Kevin Powick
Glad to see you put some effort into it yourself. -- 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

[go-nuts] Re: Reverse proxy with HTTP2 support

2016-07-13 Thread Kevin Klues
Im curious about this as well. Are there any plans to build native support for a reverse proxy that can directly forward HTTP/2 traffic to a backend server? If not, does anyone know of a usable external project that provides this functionality? On Wednesday, March 30, 2016 at 2:48:11 AM UTC-7,

[go-nuts] Can I use ... in switch? (example inside)

2016-07-26 Thread Kevin P
Is this valid? https://play.golang.org/p/xZdOWbm7Ew package main import ( "fmt" ) func main() { a := []int{0,1,2,3,4,5} switch 1 { case a...: fmt.Println("match") default: fmt.Println("no match") } } -- You received this message because you are subscribed to the Google Groups "golang-nuts

[go-nuts] Call for Participation - Communicating Process Architectures 2016

2016-08-08 Thread Kevin Chalmers
| | |Communicating Process Architectures (CPA) 2016| | | | The 38th. WoTUG Conf

[go-nuts] Who Loves Go?

2016-08-14 Thread Kevin Malachowski
I do! -- 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://groups.google.com/d/optout.

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread Kevin Powick
nd I would recommend a similar approach for those looking to use a Go based solution. i.e. Go JSON API services with your web server and JS framework of choice. -- Kevin Powick On Monday, 6 February 2017 12:09:10 UTC-5, so.q...@gmail.com wrote: > > Correct me if I'm wrong, but in servi

[go-nuts] Re: Go Fonts: request for feedback

2017-02-06 Thread Kevin Powick
Not being familiar with the field of typography, I have no idea how these changes will affect the Go fonts. However, if they make the examples shown in the Go blog from November 2016 significantly less ugly, I'm all for ti. -- Kevin Powick On Thursday, 2 February 2017 19:25:42 UTC-5,

[go-nuts] Re: json: cannot unmarshal array into Go value of type main error

2017-02-06 Thread Kevin Powick
Since you have an array of JSON data, you need to Unmarshal it into an Array of your struct, then range over the resulting array of your struct. Updated version of your code at: https://play.golang.org/p/gnx7pjTzOT -- Kevin Powick On Thursday, 2 February 2017 18:20:49 UTC-5, Rejoy wrote

Re: [go-nuts] json: cannot unmarshal array into Go value of type main error

2017-02-06 Thread Kevin Powick
Oops. I didn't see this correct answer posted by Kortschak -- Kevin Powick On Thursday, 2 February 2017 18:41:13 UTC-5, kortschak wrote: > > You have handed json.Unmarshal a non-slice/non-array type. > > Try this https://play.golang.org/p/Zl5G_Rkt26 > > > --

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread Kevin Powick
service simply returning JSON data is that it can be consumed by any client software capable of an HTTP request. This make it available to any number of languages with HTTP Client libraries available. These days, that's pretty much any language you would care to work with. -- Kevin Powi

Re: [go-nuts] Re: Organizing a lot of implementations for single interface

2017-02-17 Thread Kevin Conway
If your project exposes one interface and many implementations of it then I'd consider it reasonable to have your interface in the top level package and a subpackage for each implementation. On Fri, Feb 17, 2017, 02:33 Luca Looz wrote: > I'm starting now the project and i'm seeking advices on ho

Re: [go-nuts] Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-20 Thread Kevin Powick
om/go-geofence/ -- Kevin Powick On Monday, 20 February 2017 07:26:46 UTC-5, Konstantin Khomoutov wrote: > > > The post is kind of old but I'm not sure the situation could have > changed drastically during a single year. > > 1. http://jimplush.com/talk/2015/12/19/moving-a-team-from

[go-nuts] Re: ActiveState seeking Go community feedback

2017-02-20 Thread Kevin Powick
o your customers, while looking for support from they very community that your marketing claims is risky. I'm not really up on Activestate's involvement with Go, but have they contributed to the development or promotion of Go in any significant way? -- Kevin Powick -- You received t

[go-nuts] Handle gziped request bodies

2017-03-04 Thread Kevin Conway
I'm running a go 1.7 HTTP server. One of my clients is applying gzip to the POST body of their request and applying the appropriate content-encoding header. The current server implementation in go, unlike the client, does not appear to automatically handle decompression of the body. This is causing

Re: [go-nuts] Handle gziped request bodies

2017-03-04 Thread Kevin Conway
t, Mar 4, 2017 at 4:16 PM John Kemp wrote: > AFAIK, there is (still?) no out-of-the-box support for gzip. > > See, for example, https://github.com/NYTimes/gziphandler > > - johnk > > > On Mar 4, 2017, at 5:11 PM, Kevin Conway > wrote: > > > > I'm running

[go-nuts] Re: Deploying go https servers

2017-03-10 Thread Kevin Powick
s on our Go API service being only that, and not a web page server as well. -- Kevin Powick On Wednesday, 8 March 2017 14:02:50 UTC-5, Sankar wrote: > > Hi > > I have written a golang REST API server and a react webapp that talks to > this REST server. There is a mysql server t

Re: [go-nuts] Re: Deploying go https servers

2017-03-10 Thread Kevin Powick
I haven't done that, but with what little I do know about that type of deployment, I cannot see how choosing Caddy would make any difference. If you do go that route, I would appreciate hearing about any success or problems that you have. -- Kevin Powick On Friday, 10 March 2017 22:

Re: [go-nuts] Re: go-swagger dynamic API creation

2017-03-28 Thread Kevin Conway
Having used go-swagger (https://github.com/go-swagger/go-swagger) at one point, I'd say that these YAML generators are possibly useful for generating documentation from your code. One pain point of the documentation generators, though, is that most require that I create and maintain code objects ex

Re: [go-nuts] Is it harmful to always return invalid values on a non-nil-error?

2017-04-03 Thread Kevin Powick
esponsibility for the programs they write. If anyone writing an API want's to help the users of their APIs, then provide meaningful, detailed information in any returned error. -- Kevin Powick On Saturday, 1 April 2017 13:12:24 UTC-5, Val wrote: > > Alex, this thread may be lost but ple

[go-nuts] Re: Save Documents in Database

2017-04-03 Thread Kevin Powick
Sounds like you're re-inventing a wheel that not only may be a lot of work, but will result in a proprietary format that is incompatible with everything. -- Kevin Powick On Monday, 3 April 2017 02:33:31 UTC-5, Tomi Häsä wrote: > > Because Go has structs and it can read for example X

Re: [go-nuts] Is it harmful to always return invalid values on a non-nil-error?

2017-04-03 Thread Kevin Powick
at I intend to make this part of an API contract, I'll scream. Ok, so then it doesn't matter what you return, because the user of the API is supposed to check the error. This seems to be universally understood by both parties (API creator & user). Ignore errors at your own per

[go-nuts] Re: Save Documents in Database

2017-04-03 Thread Kevin Powick
bloated and more performant. -- Kevin Powick On Monday, 3 April 2017 16:26:45 UTC-5, Tomi Häsä wrote: > > That is exactly what I was thinking. I could save the files as > OpenDocument format, DocBook format, etc. in Android but in proprietary > format in the database where no-one else i

Re: [go-nuts] Re: Save Documents in Database

2017-04-03 Thread Kevin Powick
On Monday, 3 April 2017 18:22:40 UTC-5, John McKown wrote: > > On Mon, Apr 3, 2017 at 5:37 PM, Kevin Powick > wrote: > >> Why put the documents in a database on your server at all? Just store the >> document in the file system with a unique ID. >> &g

[go-nuts] Re: Golang timers guarantees

2017-04-05 Thread Kevin Powick
This may not be entirely applicable to your use case, but you may find the following Go proposal for Monotonic Time to be an interesting read. https://github.com/golang/proposal/blob/master/design/12914-monotonic.md -- Kevin Powick On Wednesday, 5 April 2017 07:29:40 UTC-5, te...@segment.com

[go-nuts] exec.Command using network conn for stdin, stdout

2017-04-17 Thread Kevin Johnson
ou for any help or suggestions, Kevin Johnson Here is the code: package main import ( "crypto/rand" "crypto/tls" "crypto/x509" "io" "io/ioutil" "log" "net" "os" "

[go-nuts] Re: i/o timeout when using bufio on net connection (tcp)

2017-04-17 Thread Kevin Johnson
. (Network non-blocking writes may wait for the entire write to succeed before returning). You might also use the binary.write to write to a local block of bytes and then use the conn send to send them manually, resending the parts when the writes only partially complete. Best of luck, Kevin

Re: [go-nuts] What's the recommended way to determine if a type.Type is exported?

2017-04-24 Thread Kevin Conway
Alternatively, if you are walking an AST and only interested in the exported names then you can use https://golang.org/pkg/go/ast/#PackageExports . It will filter your tree to only elements that are exported before you begin traversal. As to your specific case of determining if a type used in a me

Re: [go-nuts] Recover considered harmful

2017-04-24 Thread Kevin Conway
I'd say that recover() is not a problem but, instead, a symptom of panic() being available to developers. I'd flip the title and say panic() should be considered harmful. To quote from https://blog.golang.org/defer-panic-and-recover : > The process continues up the stack until all functions in the

Re: [go-nuts] Recover considered harmful

2017-04-24 Thread Kevin Conway
> If so, then how should I raise unrecoverable error, if I really know that it is unrecoverable? I don't believe you can ever know whether an error in your library is truly unrecoverable by the process executing the code. As a someone writing and operating the process, I'd expect a library to prov

Re: [go-nuts] Recover considered harmful

2017-04-24 Thread Kevin Conway
On Mon, Apr 24, 2017, 21:31 Sam Whited wrote: > On Mon, Apr 24, 2017 at 6:31 PM, Dan Kortschak > wrote: > > We (gonum) would extend the security exception to include scientific > > code; there are far too many peer reviewed works that depend on code > > that will blithely continue after an error

Re: [go-nuts] Re: Recover considered harmful

2017-04-25 Thread Kevin Conway
> To try to postpone the exit of a program after a critical error to me implies a much more complex testing and validation process that has identified all the shared state in the program and verified that it is correct in the case that a panic is caught There's an implicit argument here that the p

Re: [go-nuts] Re: [ANN] gohls, a downloader for HTTP Live Streaming (HLS) streams

2017-05-18 Thread Kevin Zhang
Yes, assuming the source is a normal HLS playlist, the TS file should be playable. Perhaps your source is encrypted or non-standard in some way? On 5/18/2017 10:27:56 AM, schwabenbu...@gmail.com wrote: The downloaded file should be a .TS-file right? my VLC player is not able to play the video.

Re: [go-nuts] netutil.LimitListener(lis, n) limits to n-2 requests

2017-05-23 Thread Kevin Conway
I'm speculating a bit here until I can dig back into the listener stack, but at least one variable you can tweak is the connection keep alive. On the surface, limit listener appears to gate on the socket accept call. I feel it is an important distinction because it limits the listener and not the r

Re: [go-nuts] Re: How fast can gopacket handles?

2017-05-27 Thread Kevin Conway
> can only handle up to 250Mbps-ish traffic I'm not familiar with gopacket, but I have seen multiple occasions where logging to a file or stdout became a bottleneck. Your code snippet is logging on every packet which seems excessive. Try logging with less frequency and, if using stdout, consider u

Re: [go-nuts] Re: How fast can gopacket handles?

2017-05-27 Thread Kevin Conway
> Any actual processing of the packet in the same thread significantly hurt the rate > offload the actual packet processing to a different goroutine As Rajanikanth points out, you'll need to put your work in other goroutines to make use of your other cores for processing them. One goroutine per

Re: [go-nuts] Re: Generic service via interfaces...

2017-05-29 Thread Kevin Conway
Before we put the focus on criticism of the OP's code organisation, it's well worth investigating the likely code bug first. >but when I use var m storage.ModelInterface and then call a member function of the interface (SetName) Go panics because nil pointer dereference Based on this problem descr

Re: [go-nuts] Re: How fast can gopacket handles?

2017-06-09 Thread Kevin Conway
tent/packet-capture-injection-and-analysis-gopacket > > I am wondering what further optimization can I do to speed this up? > > Thanks, > Chun > > > > > > On Tuesday, May 30, 2017 at 10:50:50 AM UTC-4, Chun Zhang wrote: >> >> Thank you Rajanikanth, Kevin and Eg

Re: [go-nuts] Create methods for structs at runtime

2017-06-14 Thread Kevin Malachowski
Maybe I'm missing something obvious, but why do you need to do this? Seems like some sort of remote dependency injection which requires you to serialize code from the server to the client. Why not just release a compiled client binary which has all of the implementations compiled in already, and

Re: [go-nuts] RFC: Blog post: How to not use an HTTP router

2017-06-18 Thread Kevin Conway
If I understand correctly, you're describing a simplified version of https://twistedmatrix.com/documents/current/web/howto/using-twistedweb.html which provides the concept of "path" by having a system that generates a graph of resource nodes than can be rendered. Routing to any specific endpoint is

[go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-27 Thread Kevin Malachowski
It's best to compare the assembly, but my guess: 'make' has to zero out the memory, whereas allocation using append does not. -- 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

Re: [go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-27 Thread Kevin Malachowski
But memclr+copy is slower than just copy, right? On Jun 27, 2017 6:53 PM, "T L" wrote: > > > On Tuesday, June 27, 2017 at 8:55:48 PM UTC-4, Kevin Malachowski wrote: >> >> It's best to compare the assembly, but my guess: 'make' has to zero out >&

Re: [go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-27 Thread Kevin Malachowski
Hit send too early... Your benchmarks do show that something is strange hen comparing the make (memclr) and copy (memory copy) cases. Out of my element here :) On Jun 27, 2017 7:01 PM, "Kevin Malachowski" wrote: > But memclr+copy is slower than just copy, right? > > On Jun 2

Re: [go-nuts] Maximum number of requests per HTTP connection?

2017-07-04 Thread Kevin Conway
Unfortunately, neither the http. Client nor the *http. Request expose a reference to the underlying connection such that you could implement that behaviour. At least, that's what I've found when trying to do this as well. One possible strategy we've considered is implementing a wrapper around the

Re: [go-nuts] Maximum number of requests per HTTP connection?

2017-07-05 Thread Kevin Malachowski
Creating an http.RoundTripper which was in charge of delegating to an http.Transport as well as swapping out to a new http.Transport when you want to swap underlying connections is probably what I'd try first. Cleaning up the old transport might be a little tricky if your application ever leaks

Re: [go-nuts] Re: Maximum number of requests per HTTP connection?

2017-07-06 Thread Kevin Conway
> You can have a filter which increments the counter and records for each request from the user and kicks him/her when the limit is crossed. We're actually interested in this problem from the other direction. When making an outbound HTTP request we want to limit the number of times (or the maxi

[go-nuts] Initializing aliased map

2017-07-07 Thread Kevin Malachowski
Note that the zero value of "aliased" is "nil". If you meant "an empty, newly initialized value" then, as previously mentioned, `make(aliased)` will do it for you, as would `aliased{}`. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

  1   2   3   4   >