Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-04 Thread Miguel Angel Rivera Notararigo
Hi, this works for me: learn/ - webpages/ - css/ - main.css - js/ - file.js - index.html - main.go - package main import ( "net/http" ) func main() { http.Handle("/",

[go-nuts] Accessing css and js files in HTML served by Go

2019-05-04 Thread ThisEndUp
I am thoroughly frustrated. I have a file named main.html that references a css and a js file. Here's the relevant portion. This is in a subdirectory of my GOPATH/src, named learn/webpages, and the css and js files are in subdirectories of that, i.e.,

[go-nuts] Creating Go web server into small Docker images

2019-05-04 Thread nanmu42
You may refer to this gist: https://gist.github.com/nanmu42/90bf2d3870b64aec20b68ec3c104a610 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-04 Thread Robert Engels
Correct, and with Go’s lightweight IO, the timeouts are cheap, so a simple read with short timeouts is all you need to flush. > On May 4, 2019, at 3:32 PM, roger peppe wrote: > > > >> On Sat, 4 May 2019, 04:33 Robert Engels, wrote: >> Since people keep referring to “flush”. I’ll chime in

[go-nuts] Re: the Dominance of English in Programming Languages

2019-05-04 Thread Chris Burkert
Some background why I was asking this: I have a history with Squeak/Smalltalk and how Alan Kay worked with children. At work I also teach 14/15 year old pupils during their 2 weeks internship and that is simply too short to show them something about programming especially when this is just one

Re: [go-nuts] request for feedback on this channel based waitgroup

2019-05-04 Thread Robert Engels
The reason your code is shorter is that it is broken. I tried to explain that to you. Try running the stdlib wait group tests against your code. They will fail. > On May 4, 2019, at 4:22 PM, Louki Sumirniy > wrote: > > Those who follow some of my posts here might know that I was discussing

Re: [go-nuts] request for feedback on this channel based waitgroup

2019-05-04 Thread Jan Mercl
On Sat, May 4, 2019 at 11:22 PM Louki Sumirniy wrote: > The first thing you will notice is that it is a LOT shorter. It fails a simple test: https://play.golang.org/p/v3OSWxTpTQY The original is ok: https://play.golang.org/p/OhB8qZl2QLQ Another problem is starting a new goroutine per

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-04 Thread Kurtis Rader
On Sat, May 4, 2019 at 2:12 PM wrote: > Thanks jake.. If previous comments I received indicate that I should put > the original question to rest,... but memguard.go suggests it should be > re-opened > No, it suggests you don't understand what a garbage collector does and are unable to clearly

[go-nuts] request for feedback on this channel based waitgroup

2019-05-04 Thread Louki Sumirniy
Those who follow some of my posts here might know that I was discussing the subject of channels and waitgroups recently, and I wrote a very slim and simple waitgroup that works purely with a channel. Note that it is only one channel it requires, at first I had a ready and done channel, but

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-04 Thread Manlio Perillo
On Saturday, May 4, 2019 at 2:50:00 AM UTC+2, Matt Harden wrote: > > On Fri, May 3, 2019, 17:28 > wrote: > >> Does Go GC destroy all global vars prior to the end of main() ? >> > > What do you mean by "destroy"? Go is not an object oriented language and > doesn't have the concept of a

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-04 Thread lgodio2
Thanks jake.. If previous comments I received indicate that I should put the original question to rest,... but memguard.go suggests it should be re-opened On Saturday, May 4, 2019 at 1:23:40 PM UTC-4, jake...@gmail.com wrote: > > On Friday, May 3, 2019 at 9:44:05 PM UTC-4, lgo...@gmail.com

[go-nuts] Re: Exporting and renaming

2019-05-04 Thread Louki Sumirniy
The rename tool is great, but be aware that it doesn't work if the compiler encounters even one error anywhere in the project. If the code is already complete and runs fine, rename works just fine, and is more selective than a blanket S The rename tool parses the code into an AST, so it fully

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-04 Thread Louki Sumirniy
Oh, I don't mean 'funny' in a derogatory way. Some of them are beautiful and I find the languages that use them, fascinating grammar and etymology and differences in grammar. For me language is a general category of much interest, and programming very specific and use-targeted, but for sure,

Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-04 Thread roger peppe
On Sat, 4 May 2019, 04:33 Robert Engels, wrote: > Since people keep referring to “flush”. I’ll chime in again. Thus is not > the correct way to do this, as many routines buffer input. Flushing the > driver does nothing to characters already in the buffer. Flushing the > driver is only

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-04 Thread jake6502
On Friday, May 3, 2019 at 9:44:05 PM UTC-4, lgo...@gmail.com wrote: > > I'm currently working on a specialized encryption system where the keys > are global... > More importantly, I've been unable to locate any decent on-line docs > describing exactly how Go GC works from a functional

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread Jan Mercl
On Sat, May 4, 2019 at 6:53 PM T L wrote: > BTW, the type bar is defined as > > typedef struct bar bar; If struct bar is not yet defined at that point then it's an incomplete type. So is bar. Not sure if calling an incomplete type 'defined' makes sense. However, this should be IMO ok

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread T L
BTW, the type bar is defined as typedef struct bar bar; On Sunday, May 5, 2019 at 12:10:50 AM UTC+8, T L wrote: > > The FAQ, http://c-faq.com/aryptr/aryptrparam.html and > http://c-faq.com/aryptr/aryparmsize.html > says "bool foo(bar bars[2]);" <=> "bool foo(bar bars[]);" <=> bool > foo(bar*

[go-nuts] Creating Go web server into small Docker images

2019-05-04 Thread suntong001
Hi, I'm trying to create Go web server into small Docker images. Here is my Dockerfile: # golang:latest as build-env FROM golang:latest AS build-env RUN mkdir /app ADD . /app/ WORKDIR /app RUN cd /app && GO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o myapp . # go build -o myapp

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread T L
The FAQ, http://c-faq.com/aryptr/aryptrparam.html and http://c-faq.com/aryptr/aryparmsize.html says "bool foo(bar bars[2]);" <=> "bool foo(bar bars[]);" <=> bool foo(bar* bars); So I think if "bool foo(bar* bars);" compiles ok, then should also "bool foo(bar bars[2]);. On Sunday, May 5, 2019

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread Jan Mercl
On Sat, May 4, 2019 at 2:15 PM T L wrote: > But it is a pointer parameter, though it looks like an array. Yes, a pointer to an incomplete type. The compiler thus does not know how to compute address of bars[x] as that translates to bars + x*sizeof(bar). -- You received this message because

Re: [go-nuts] Concurrency safe struct access

2019-05-04 Thread derekw4sons
On Monday, April 15, 2019 at 8:16:53 AM UTC-5, michae...@gmail.com wrote: > FWIW, here's the pattern I've settled on for my actual application. > > https://play.golang.org/p/OBVsp-Rjknf > > >  It uses sync.Mutex only and includes the mutex as a member of the > guardedState struct.  The

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread T L
On Saturday, May 4, 2019 at 7:07:37 PM UTC+8, Jan Mercl wrote: > > On Sat, May 4, 2019 at 12:57 PM T L > > wrote: > > > > > > In one of my cgo project, there is a c API (a c++ wrapper) like > > > > bool foo(bar bars[2]); > > > > It fails to compile with error message: > > > > error:

Re: [go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread Jan Mercl
On Sat, May 4, 2019 at 12:57 PM T L wrote: > > > In one of my cgo project, there is a c API (a c++ wrapper) like > > bool foo(bar bars[2]); > > It fails to compile with error message: > > error: array type has incomplete element type 'bar' {aka 'struct bar'} Incomplete type has uknown size. You

[go-nuts] cgo compile error: array type has incomplete element type

2019-05-04 Thread T L
In one of my cgo project, there is a c API (a c++ wrapper) like bool foo(bar bars[2]); It fails to compile with error message: error: array type has incomplete element type 'bar' {aka 'struct bar'} The same error for the following prototype bool foo(bar bars[]); But, it is ok for the