[go-nuts] How to render a single webpage without templates?

2017-03-08 Thread so . query
In my handler I want to return a single webpage. But when using http.ServeFile, the images on the page aren't rendered. https://golang.org/pkg/net/http/#ServeFile And using http.FileServer, returns a handler that renders an entire directory (and children)

Re: [go-nuts] Deploying go https servers

2017-03-08 Thread Sankar P
I am looking more for a checklist of things to do, rather than a set of tools. 2017-03-09 0:38 GMT+05:30 Shawn Milochik : > That sounds a good use-case for Ansible to me. It's pretty easy to use and > get started. > > -- > You received this message because you are

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Jérôme Champion
As itinerary and the reslicing operation use the same backing array, you could just offset your indexes: https://play.golang.org/p/2ZzKST5J1g I'm not sure if it's a good idea, could the sort.Slice implementation change in the future and make a regression? Le mercredi 8 mars 2017 18:22:48

[go-nuts] Re: escape analysis improvements?

2017-03-08 Thread keith . randall
Yes, this is a limitation of the current escape analysis. It doesn't realize that the proto.Buffer can be stack allocated. I suspect this is because b.Marshal is recursive, and escape analysis gives up on recursive things. On Tuesday, March 7, 2017 at 8:22:42 PM UTC-8, apo...@google.com wrote:

Re: [go-nuts] Sample code with races needed for presentation

2017-03-08 Thread Ian Lance Taylor
On Wed, Mar 8, 2017 at 2:51 PM, Haddock wrote: > > I'm working on a comparison between concurency in Go and on the JVM. For > that reason I would like to show some Go code that has problem with > incorrect synchronization and will cause race conditions or deadlocks. Ich > want to

[go-nuts] Sample code with races needed for presentation

2017-03-08 Thread Haddock
Hello, I'm working on a comparison between concurency in Go and on the JVM. For that reason I would like to show some Go code that has problem with incorrect synchronization and will cause race conditions or deadlocks. Ich want to demonstrate how they are partially caught at compile time or at

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
On Wednesday, March 8, 2017 at 9:40:05 PM UTC+1, Ian Lance Taylor wrote: > > On Wed, Mar 8, 2017 at 11:34 AM, Basile Starynkevitch > wrote: > > > > On Wednesday, March 8, 2017 at 8:24:26 PM UTC+1, Ian Lance Taylor wrote: > >> > >> On Wed, Mar 8, 2017 at 7:54 AM,

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Ian Lance Taylor
On Wed, Mar 8, 2017 at 11:34 AM, Basile Starynkevitch wrote: > > On Wednesday, March 8, 2017 at 8:24:26 PM UTC+1, Ian Lance Taylor wrote: >> >> On Wed, Mar 8, 2017 at 7:54 AM, Basile Starynkevitch >> wrote: >> I don't have any particular

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
On Wednesday, March 8, 2017 at 8:24:26 PM UTC+1, Ian Lance Taylor wrote: > > On Wed, Mar 8, 2017 at 7:54 AM, Basile Starynkevitch > wrote: > I don't have any particular recommendations but I believe that > github.com/mattn/go-sqlite3 works correctly with cgo. I

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Ian Lance Taylor
On Wed, Mar 8, 2017 at 7:54 AM, Basile Starynkevitch wrote: > > On Wednesday, March 8, 2017 at 2:23:12 PM UTC+1, Tamás Gulácsi wrote: >> >> It's quite straightforward: gwenn/gosqlite has an error, by passing a Go >> pointer to the C side. This check is in effect since

Re: [go-nuts] Deploying go https servers

2017-03-08 Thread Shawn Milochik
That sounds a good use-case for Ansible to me. It's pretty easy to use and get started. -- 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] Deploying go https servers

2017-03-08 Thread Sankar
Hi I have written a golang REST API server and a react webapp that talks to this REST server. There is a mysql server that the golang server talks to. There is an init script with a bunch of SQL statements to create a few tables and indexes. Everything works fine in my local machine. I have

[go-nuts] Re: Japronto vs Go net/http

2017-03-08 Thread szeptweb
Thanks for the answers. -- 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

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Ain
Another, OO-ish fix is to use method on custom type (https://play.golang.org/p/a5S5rNog5h): type itinerary []string func (t itinerary) sort() { sort.Slice(t, func(i, j int) bool { return t[i] < t[j] }) } func main() { itinerary := itinerary{"Philadelphia", "Chicago",

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread jmontgomery
On Wednesday, March 8, 2017 at 9:50:09 AM UTC-5, Chris Hines wrote: > > The infinite loops in each function will busy loop and consume a core > without allowing the runtime scheduler a chance to run other goroutines on > that core. If your virtual machine doesn't have enough cores then some >

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Konstantin Khomoutov
On Wed, 8 Mar 2017 08:17:30 -0800 (PST) Basile Starynkevitch wrote: > > So if you're not really tied to SQLite as such (and picked it > > merely because you're familiar with it or because it's a sane go-to > > choice for single-file structured data persistence solution)

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
On Wednesday, March 8, 2017 at 5:09:06 PM UTC+1, Konstantin Khomoutov wrote: > > So if you're not really tied to SQLite as such (and picked it merely > because you're familiar with it or because it's a sane go-to choice for > single-file structured data persistence solution) other pure-Go >

Re: [go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Konstantin Khomoutov
On Wed, 8 Mar 2017 07:54:14 -0800 (PST) Basile Starynkevitch wrote: > > It's quite straightforward: gwenn/gosqlite has an error, by passing > > a Go pointer to the C side. This check is in effect since Go1.6. > > > > You should try to refresh your gosqlite library, or

[go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread James Bardin
That package documents the behavior on all the relevant methods: > Cannot be used with Go >= 1.6 and cgocheck enabled. If you trust the author to have written something that is correct despite the checks done by cgo, you can disable cgocheck to use those methods. On Wednesday, March 8, 2017

[go-nuts] Re: gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
On Wednesday, March 8, 2017 at 2:23:12 PM UTC+1, Tamás Gulácsi wrote: > > It's quite straightforward: gwenn/gosqlite has an error, by passing a Go > pointer to the C side. This check is in effect since Go1.6. > > You should try to refresh your gosqlite library, or find a better > maintained

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread David Peacock
On Wed, Mar 8, 2017 at 10:01 AM, Val wrote: > Sorry for not elaborating in the first place (I was trying to make the > point very concise). > Thank you for detailing further! :-) > The bug in my code is that the two arguments I pass to sort.Slice are > inconsistent : the

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread James Bardin
On Wednesday, March 8, 2017 at 10:01:08 AM UTC-5, Val wrote: > > > - or the code in the less function will have to refer to the same > (unnamed) resliced portion, which is imo convoluted : fix 1 > or fix 2 > . >

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread ascii88
Fantastic! In my main program I had the main in an infinite for. That was burning the only core of my vm. I've changed that to select and now it's working fine. Thank you Konstantin, for your answer, too. El miércoles, 8 de marzo de 2017, 11:50:09 (UTC-3), Chris Hines escribió: > > The infinite

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Val
Sorry for not elaborating in the first place (I was trying to make the point very concise). This is the starting city : Philadelphia This are the other cities : Chicago, Boston, Austin The itinerary is the concatenation of starting city + other cities to be visited : [Philadelphia,

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread Konstantin Khomoutov
On Wed, 8 Mar 2017 06:20:25 -0800 (PST) asci...@gmail.com wrote: > I've made this test program > > > package main > > import "fmt" > > func func1() { > fmt.Println("running func1") > for { > > } [...] > func main() { > > go func1() > fmt.Println("run func1") > go

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread Chris Hines
The infinite loops in each function will busy loop and consume a core without allowing the runtime scheduler a chance to run other goroutines on that core. If your virtual machine doesn't have enough cores then some goroutines may starve. Change the loops to select {} to block infinitely

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread David Peacock
On Wed, Mar 8, 2017 at 8:32 AM, Valentin Deleplace wrote: > I did explain the expected result : "and I want to visit other cities in > alphabetical order" > Jan is correct; the characterization of a problem hinges on accurately describing what you expect and what happened

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread ascii88
I've made this test program package main import "fmt" func func1() { fmt.Println("running func1") for { } } func func2() { fmt.Println("running func1") for { } } func func3() { fmt.Println("running func1") for { } } func main() { go func1()

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread C Banning
https://play.golang.org/p/Pqd0Wk-yqe -- 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

[go-nuts] Re: constant 256 overflows byte

2017-03-08 Thread Paul Hankin
On Tuesday, 7 March 2017 19:02:59 UTC-5, Eric Brown wrote: > > memoryBlock := make([]byte, 4) > > binary.LittleEndian.PutUint32(memoryBlock, 12345678) > >

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread Ayan George
On 03/08/2017 08:30 AM, asci...@gmail.com wrote: > In the main function I call various go routines, I've set println after > each call, so I know they are being executed. But I don't get the > printlns I've set inside of some of those routines, for the same purpose. > So you are seeing some

Re: [go-nuts] How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-08 Thread Leonardo Santagada
First step in fixing memory problems is measuring it. A goroutine IIRC reserves 2kb of stack space only, so removing goroutines from your program and probably rewriting everything keeping all else the same will save you 100*2kb memory. Seems like a lot of work for little to no gain. Do present

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Valentin Deleplace
I did explain the expected result : "and I want to visit other cities in alphabetical order" Le 8 mars 2017 2:16 PM, "Jan Mercl" <0xj...@gmail.com> a écrit : > On Wed, Mar 8, 2017 at 2:10 PM Val wrote: > > > What do you think? > > You should explain what you've expected to

[go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread ascii88
Hello, I'm running go1.8 windows/amd64 I have a working program, which I want to compile to Linux. So I set GOOS=linux and then go build I have a virtual machine with Debian 7. And I run the program. However it functions incorrectly. In the main function I call various go routines, I've set

[go-nuts] gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Tamás Gulácsi
It's quite straightforward: gwenn/gosqlite has an error, by passing a Go pointer to the C side. This check is in effect since Go1.6. You should try to refresh your gosqlite library, or find a better maintained one. -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Building Cross Platform GUI apps in Go and Electron

2017-03-08 Thread mhhcbon
hi, same interest here. Have you checked https://electron.atom.io/docs/tutorial/application-distribution/ ? If i m correct the front end could be the packager app, i was reading at electron-builder, to include the backend, i d simply add the files to the builder manifest, like described at

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Jan Mercl
On Wed, Mar 8, 2017 at 2:10 PM Val wrote: > What do you think? You should explain what you've expected to get instead of what you've got. Without that, I for one, cannot figure out what you see as broken and I have no idea why do you think it's not a good idea to sort a

[go-nuts] sort.Slice arguments

2017-03-08 Thread Val
Hello fellows The following code (playground ) : // // I am in Philadelphia, and I want to visit other cities // itinerary := []string{"Philadelphia", "Chicago", "Boston", "Austin"} // // I am in Philadelphia, and I want to visit

Re: [go-nuts] Building Cross Platform GUI apps in Go and Electron

2017-03-08 Thread Nyah Check
When I compile the source with gox for the different platforms. packing the electron files with the respective shell scripts the binaries don't seem to work on windows. So I'm guessing I've messed up the electron configs somewhere. I just hoped there might have been a go package developed for this

Re: [go-nuts] Building Cross Platform GUI apps in Go and Electron

2017-03-08 Thread Michael Banzon
I have no deep knowledge of this - but is also looking into a project with similar characteristics. I'm wondering what specifically isn't working for you? On Wed, Mar 8, 2017 at 1:33 PM Nyah Check wrote: > Hi Gophers, > > I have this project to build an SSH client for

[go-nuts] Building Cross Platform GUI apps in Go and Electron

2017-03-08 Thread Nyah Check
Hi Gophers, I have this project to build an SSH client for Windows, Linux and Mac OS. I have built the back end in Go and intend to build the front end in electron. I'm currently stuck getting the GUI to work. The back end of the app works well on the Linux browser. I just wish to know if there

[go-nuts] Re: Registering a Go app as a protocol handler under Mac OS X

2017-03-08 Thread Joe Blue
thansk nathan, i will try it out now. I am curious if anyone else has done this for windows, Linux, Android and IOS ? I am working on building apps with golang and QT, and need to be able to do it cross platform. QT has aweful support for this, and i think a golang lib that does this, will

[go-nuts] gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
Hello list, It is about my (github-ed) monimelt (MELT monitor, in early pre-alpha stage) specifically about its commit 44434cd991c which has some README.md

[go-nuts] Japronto vs Go net/http

2017-03-08 Thread Tamás Gulácsi
Japrono is mostly written in C. It provides only HTTP/1.1, with not-too-widespread pipelining support. No HTTP/2, so not future proof. As the readme says, fasthttp is only 18% slower than japronto. And we know that fasthttp is fast because of different design goals: it sacrifices ease of use

Re: [go-nuts] Japronto vs Go net/http

2017-03-08 Thread Wojciech S. Czarnecki
Dnia 2017-03-07, o godz. 23:34:54 Gopher napisał(a): > Hi.Does anyone know why the Japronto is faster? ["" from japronto github pitch.] Because "The server is written in hand tweaked C trying to take advantage of modern CPUs." What translates to 'it will run fast if it

Re: [go-nuts] How to create unique IDs when ranging over data in Golang and use in Javascript

2017-03-08 Thread Rejoy Nair
Yes..thats the link.. :) was a bit short on time.. so posted the question in multiple forums.. was struggling a bit manipulating html elements .. so was kind of overwhelmed by the answer provided... On Tue, Mar 7, 2017 at 4:00 PM, Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: >