[go-nuts] Re: Reading an .ini file

2017-01-14 Thread bucarr
> Thank you all for the suggestions. Some of them are WAY above my pay > grade presently. I'll try one of the other suggested packages. > On Saturday, January 14, 2017 at 9:46:47 AM UTC-7, buc...@gmail.com wrote: > > > -- You received this message because you are subscribed to the Goo

[go-nuts] Writing a Great Proposal for GopherCon 2017

2017-01-14 Thread bketelsen
Dave Cheney was kind enough to write up a detailed post on how to write a better proposal for your GopherCon talk. https://blog.gopheracademy.com/gophercon-2017/writing-a-successful-gophercon-proposal/ He did a fantastic job detailing what makes a good proposal. Take some time to read it, then

[go-nuts] Re: func return with if... else...

2017-01-14 Thread Eric Brown
Thank you... On Saturday, January 14, 2017 at 4:44:33 PM UTC-6, Dave Cheney wrote: > > The former. -- 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+u

[go-nuts] Re: func return with if... else...

2017-01-14 Thread Dave Cheney
The former. -- 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: func return with if... else...

2017-01-14 Thread Eric Brown
If you have a catch-all, is it better to use after an if condition without an else, or put it in an else: if condition { return A } return B or: if condition { return A } else { return B } Just curious is there is a prefered standard to this for readability, or if it's just to each

Re: [go-nuts] Re: func return with if... else...

2017-01-14 Thread Justin Israel
On Sun, Jan 15, 2017 at 10:37 AM Eric Brown wrote: > Sorry guys, found the issue... and it's from my inexperience. The > functions that is happening to are ones I used a switch condition (which I > could've used an if condition on instead). > > I used: > > switch strings.Contains(targetDatabase.

[go-nuts] func return with if... else...

2017-01-14 Thread James Bardin
If you're "if" block returns, and there's nothing after the "else" block, then you don't need the "else" at all. -- 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

[go-nuts] Re: func return with if... else...

2017-01-14 Thread Eric Brown
Sorry guys, found the issue... and it's from my inexperience. The functions that is happening to are ones I used a switch condition (which I could've used an if condition on instead). I used: switch strings.Contains(targetDatabase.Driver, ConvertString("[!]sqlite[!]")) { case true: case false:

Re: [go-nuts] func return with if... else...

2017-01-14 Thread Paul Jolly
The compiler does understand the exhaustiveness of if ... else ... : https://play.golang.org/p/PAcg9oUAxA Can you post some code to highlight the problem you're having? On 14 January 2017 at 21:31, Eric Brown wrote: > Using go, when I create a function with a return... and that function uses >

[go-nuts] func return with if... else...

2017-01-14 Thread Eric Brown
Using go, when I create a function with a return... and that function uses an if... else... condition w/ the return being passed under each, the compiler still throws an error 'missing return at end of function'? I can put a return at the end of the function, but it will never get to that poin

[go-nuts] Re: Blocking waitgroup

2017-01-14 Thread Dave Cheney
When your program blocks, hit control-\ and you'll get a stack trace of every running goroutine, the ones blocked inside downPart will point to the place they are blocked. On Sunday, 15 January 2017 05:33:25 UTC+11, vyasgir...@gmail.com wrote: > > I am implementing a multi part file downloader a

Re: [go-nuts] Blocking waitgroup

2017-01-14 Thread Justin Israel
Hi, I'm seeing a number of issues with your example code... You are creating a slice of channels when you really could just use a single channel to receive all of the results. You wait on a WaitGroup, but the goroutines only call Done() *after* they are able to send their result on the channel.

Re: [go-nuts] Re: should every .gz file be served with content-encoding gzip?

2017-01-14 Thread 'Anmol Sethi' via golang-nuts
How will it take longer to download? The gzipped version will still be transferred, just without the extension and the Content-Encoding set to gzip. On Sat, Jan 14, 2017 at 3:12 PM wrote: if you do so, it will be longer to download, it also put more pressure on the server as it needs to decompres

Re: [go-nuts] Re: should every .gz file be served with content-encoding gzip?

2017-01-14 Thread mhhcbon
if you do so, it will be longer to download, it also put more pressure on the server as it needs to decompress the content as it serves it. Other side effects occurs such as the longer it is to serve a request the busier the server will be thus the more likely you are to hit the server capacity.

Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
1. It is unexpected. When I click a link that ends with .tar.gz, I expect to get a .tar.gz file. 2. It is a waste of disk space. Sure, as soon as they download the tarball, they will extract it. But they still need the space for both the tarball and the contents at the same time. So we might as

Re: [go-nuts] Re: should every .gz file be served with content-encoding gzip?

2017-01-14 Thread 'Anmol Sethi' via golang-nuts
While it is unexpected, what is wrong with just serving a tar file and redirecting a foo.gz request to a foo request? Why should a user want to have a .gz file after downloading? On Sat, Jan 14, 2017 at 1:38 PM wrote: > Say you have this foo.tar.gz, > served as /foo.tar.gz with a content-encodin

[go-nuts] Re: should every .gz file be served with content-encoding gzip?

2017-01-14 Thread mhhcbon
Say you have this foo.tar.gz, served as /foo.tar.gz with a content-encoding: gzip, the browser would in fact decode the gzip stream and serve a tar file. I guess, it is unexpected, the content-encoding should probably be application/octet-stream to instruct the browser to download the file, for

[go-nuts] Blocking waitgroup

2017-01-14 Thread vyasgiridhar27
I am implementing a multi part file downloader and I need help to find the blocking element in the following piece of code. func downPart(wg *sync.WaitGroup, url string, dataChan chan []byte, range1, range2 int) { defer wg.Done() client := new(http.Client) req, _ := http.NewRequest("GET",

Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
It all depends on what the user wants to have when they are done downloading. In the case of HTML, CSS, and JS, they want an uncompressed file that is ready for their browser to use. So you should use Content-Encoding: gzip and Content-Type: text/html or whatever. In the case of a .tar.gz, they

[go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread 'Anmol Sethi' via golang-nuts
Say in my http fileserver, I have /static/foo.tar.gz. Should my fileserver be serving it as /static/foo.tarwith content-encoding: gzip always or should it be served as /static/foo.tar.gz with content-type: gzip? Change foo.tar.gz with any file that ends in .gz. My question boils down to whether or

[go-nuts] Re: Reading an .ini file

2017-01-14 Thread mhhcbon
I can reproduce your problem by inserting the BOM in front of the file. printf '\xEF\xBB\xBF;blah\nff=ff' > test.ini A quick and dirty fix might look like this, it wraps the read operation with a bomskipreader, which jobs is to detect and get ride of the bom if detected, thus its like it was n

[go-nuts] Re: Reading an .ini file

2017-01-14 Thread mhhcbon
On Saturday, January 14, 2017 at 5:46:47 PM UTC+1, buc...@gmail.com wrote: > > Rankest beginner here. Trying to learn Go by converting an old Visual > Basic application to Go (yeah, right) on Windows 10 (got all the database > stuff working with both postgre and sqlite!) The application needs

[go-nuts] Reading an .ini file

2017-01-14 Thread Nathan Kerr
Using a newer package might help. https://github.com/go-ini/ini looks to be under active development and is written by the author of https://github.com/Unknwon/goconfig, which also reads ini files but is now in bug fix only mode. Both claim to support comments. -- You received this message be

[go-nuts] shiny: get mouse position relative to window

2017-01-14 Thread ktye78
How do I get the position for a mouse.Event in shiny using golang.org/x/mobile/event.mouse? The position returned is the global position on the screen, which changes if I move the window. The comments in https://github.com/golang/mobile/blob/master/event/mouse/mouse.go#L18 say it's: "// X and

[go-nuts] Reading an .ini file

2017-01-14 Thread bucarr
Rankest beginner here. Trying to learn Go by converting an old Visual Basic application to Go (yeah, right) on Windows 10 (got all the database stuff working with both postgre and sqlite!) The application needs to read an .ini file to get path/filename. It bombs on the first line. This is fr

Re: [go-nuts] Re: Disadvantage of Go

2017-01-14 Thread Christoph Berger
> None of these alternatives really solve any real problem generics would solve. True, and the article does not mean to imply this. But often it would seem that there is no alternative to using generics for solving a given problem although there is one if you look close enough. Of course this de

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

2017-01-14 Thread mailteety
It was easier than i expected https://play.golang.org/p/olooozwapD On Friday, 13 January 2017 19:13:16 UTC+1, mhh...@gmail.com wrote: > > yeah, right, it s possible and works, but its way more complex, lets > forget about this :) > > This works https://play.golang.org/p/hP8Zq-LfQA > > On Friday

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

2017-01-14 Thread mailteety
It was easier than i expected https://play.golang.org/p/olooozwapD On Friday, 13 January 2017 19:00:14 UTC+1, Ian Davis wrote: > > > > > On Fri, 13 Jan 2017, at 05:17 PM, mail...@gmail.com wrote: > > > Hello, > > Ignoring the error does not help > > https://play.golang.org/p/a8AIcHWII6 > > >

[go-nuts] Re: Disadvantage of Go

2017-01-14 Thread paraiso . marc
> Some time ago I collected a number of alternatives to using generics - see: https://appliedgo.net/generics None of these alternatives really solve any real problem generics would solve. Generics are types, just like first class functions. Lamenting on the lack on generics is useless as well,

[go-nuts] Re: Disadvantage of Go

2017-01-14 Thread Christoph Berger
Hi Yu, Generics have their use cases, e.g. when designing general data containers or in the context of numeric computation (matrix type of int, float, etc). In other areas, however, their use may be overrated. If you have a particular problem and you think, "I do need generics to implement th