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

2019-05-06 Thread Miguel Angel Rivera Notararigo
More than magic, it is a global convention. I guess it could be interpreted as: when you access a directory, the web server will index its content and will show you a list of links, if you want to override this behavior, you could create your own index. See https://github.com/golang/go/blob/b68624

Re: [go-nuts] Enabling go's race detector working over SQL barrier

2019-05-06 Thread Jan Mercl
On Mon, May 6, 2019 at 6:56 AM Neven Miculinić wrote: > Is there some project going into this direction? Not sure if relevant: https://godoc.org/modernc.org/ql -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
Hi, I want a go method to run on multiple cores.The go method is returning an object. Can we achieve this using goroutine ? How can I achieve this ? Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and sto

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Jan Mercl
On Mon, May 6, 2019 at 1:11 PM Nitish Saboo wrote: > > Hi, > > I want a go method to run on multiple cores.The go method is returning an > object. Can we achieve this using goroutine ? > How can I achieve this ? In the first approximation, to run a a function/method f() in a goroutine on N cores

[go-nuts] Golang - mongodb watch for specific data

2019-05-06 Thread afriyie . abraham
Hi, I have this data or document in mongodb. { "nfInstanceId": "3fa85f64-5717-4562-b3fc-2c963f66af37", "nfType": [ "AMF" ], "nfStatus": [ "string" ], "sNssais": [{ "sst": 1, "sd": "sd1" } ], "nsiList": [ "string" ], "ipv4Addresses": [ "198.51.100.100" ], "allowedNssais": [{ "s

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
Thanks Jan. type Y struct { M string N string } func initalize() Y{ // I have a func that return an object ob type Y. } var obj1 Y = go initalize() var obj2 Y = go initalize() Let me know how to call a go routine in this case, because when I am doing it in this way I am getting compilation

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Jan Mercl
On Mon, May 6, 2019 at 1:39 PM Nitish Saboo wrote: > type Y struct { > > M string > N string > > } > > func initalize() Y{ > // I have a func that return an object ob type Y. > } > var obj1 Y = go initalize() No need to write Y above, the type will be inferred. However, see https://golang.org/

[go-nuts] large slice literals and go-guru

2019-05-06 Thread David Wahlstedt
Hello, I'm working on a project where there is a very (machine generated) large slice literal in the source tree: around 6MB. The slice is declared in a separate file, and it contains instances of an interface. Each time I use go-guru (go-guru-referrers, for example) in emacs, it takes a while

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Michel Levieux
Hello, Is: type Y struct { M string N string } func initalize() Y{ // I have a func that return an object ob type Y. } var obj1 Y go func() { obj1 = initalize() }() var obj2 Y go func() { obj2 = initalize() }() What you are looking for? Le lun. 6 mai 2019 à 13:59, Jan Mercl <0xj...

[go-nuts] large slice literals and go-guru

2019-05-06 Thread Tamás Gulácsi
As a workaround, you may try to move the large slice into a separate package. -- 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

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

2019-05-06 Thread lgodio2
this issue involves much more than Go code For example , we for whom English is not our native language use 'Google translate' to translate our golang-nuts questions into English and the golang-nuts responses back to our native language. The second translation often produces produces very-stra

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

2019-05-06 Thread Richard Tenney
Hi. I remain mystified. I tried your suggestion, but it didn't work. This is .../learn/main.go func main() { http.HandleFunc("/", handleRoot) http.Handle("/css/", http.FileServer(http.Dir("webpages/css"))) http.Handle("/js/", http.FileServer(http.Dir("webpages/js"))) fmt.Println(

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

2019-05-06 Thread ThisEndUp
Hi. Thanks for your explanation. It makes sense. However, the "magic" I asked about was based on your first suggestion: simply use http.Handle("/", http.FileServer(http.Dir("webpages"))) As I said, it works if the file to be shown is index.html. My question: how do I modify that in order to use

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

2019-05-06 Thread ThisEndUp
Oops, I left a few lines at the top of main.go out of the post: here's the whole thing: // main.go package main import ( "fmt" "net/http" ) func handleRoot(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "webpages/main.html") } func main() { http.HandleFunc("/", hand

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

2019-05-06 Thread Miguel Angel Rivera Notararigo
You can write your own handler that serve static files and use main.html as index, but, the main.html name is mandatory? It breaks the convention -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

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

2019-05-06 Thread Jan Mercl
On Mon, May 6, 2019 at 6:11 PM ThisEndUp wrote: That listing is terrible. Colors aside, some parts of text has contrast like 10%. Please post source code/snippets at play.golang.org or include in in the email as plain text only, i.e.black on white. It's the most readable option. Thanks. -- You

[go-nuts] What is the current status of generics in Go?

2019-05-06 Thread 'kalekold' via golang-nuts
I saw a design document floating about sometime last year and there seemed to be a lot of thought going into implementing them? What is the current status and where can I read more? Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To uns

[go-nuts] Re: How to run a go method on multiple cores ?

2019-05-06 Thread lgodio2
If func f (n int) []int { is some fcn that requires CPU time T (large) to calculate its return value And I write : func main() { var s [ ] int; s1 := f(1) ; s1 := f(2) ... } I get results after CPU time 2 T ?? To obtain results in < 2T time, can I write s1 := go f(1)

Re: [go-nuts] binary.Read cgo fields

2019-05-06 Thread Matt Harden
On Sun, May 5, 2019, 06:33 Immueggpain S wrote: > Ah, my bad! What I meant was that binary.Read will pad when writing to the > struct, unlike memcpy. > Oh, yes you're right of course. If you want to serialize a C struct using Go, you're going to have to mention every field on the Go side. You

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

2019-05-06 Thread Burak Serdar
On Mon, May 6, 2019 at 9:47 AM Richard Tenney wrote: > > Hi. I remain mystified. I tried your suggestion, but it didn't work. > > This is .../learn/main.go > func main() { > > http.HandleFunc("/", handleRoot) > http.Handle("/css/", http.FileServer(http.Dir("webpages/css"))) > http.Hand

[go-nuts] Using cgo with go modules

2019-05-06 Thread grubian . euhen
Hello, I am trying to adopt my cgo package with go modules. The cgo project I mentioned above is built using simple Makefile so that I obtain external shared library(.so on Unixes and .dll on Windows) to link external applications(from other modules) with. When I try to use this module from the

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

2019-05-06 Thread Richard Tenney
You're right! They're awful. Here are the files I sent -- this time in black-and-white, fixed width .../learn/main.go // main.go package main import ( "fmt" "net/http" ) func handleRoot(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "webpages/main.html")

Re: [go-nuts] Using cgo with go modules

2019-05-06 Thread Ian Lance Taylor
On Mon, May 6, 2019 at 12:37 PM wrote: > > Hello, > I am trying to adopt my cgo package with go modules. > The cgo project I mentioned above is built using simple Makefile so that I > obtain external shared library(.so on Unixes and .dll on Windows) to link > external applications(from other mod

Re: [go-nuts] What is the current status of generics in Go?

2019-05-06 Thread Ian Lance Taylor
On Mon, May 6, 2019 at 9:22 AM 'kalekold' via golang-nuts wrote: > > I saw a design document floating about sometime last year and there seemed to > be a lot of thought going into implementing them? What is the current status > and where can I read more? Thanks. There is continuing thought. Th

Re: [go-nuts] Is renewal of expired context possible?

2019-05-06 Thread Ian Lance Taylor
On Sun, May 5, 2019 at 11:13 AM wrote: > > Hi, Is there a way to renew a context that has already reached a deadline? No, sorry. Ian -- 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

[go-nuts] Simple Go web server that service files

2019-05-06 Thread suntong001
I'm learning Go web server programming and have copied the following example: func Image(w http.ResponseWriter, r *http.Request) { f, _ := os.Open("images/my.png") . . . It works fine when I'm starting the Go web server with `go run main.go &`. I.e., the file "images/my.png" is relat

Re: [go-nuts] Is renewal of expired context possible?

2019-05-06 Thread sandeep . kalra
Thanks for confirming. On Monday, May 6, 2019 at 6:16:49 PM UTC-4, Ian Lance Taylor wrote: > > On Sun, May 5, 2019 at 11:13 AM > > wrote: > > > > Hi, Is there a way to renew a context that has already reached a > deadline? > > No, sorry. > > Ian > -- You received this message because you

[go-nuts] Go 1.12.5 and Go 1.11.10 are released

2019-05-06 Thread Andrew Bonventre
Hello gophers, We have just released Go versions 1.12.5 and 1.11.10, minor point releases. This release includes fixes to the compiler, the linker, the go command, the runtime, and the os package. View the release notes for more information: https://golang.org/doc/devel/release.html#go1.12.m

[go-nuts] Web access to golang-dev is down

2019-05-06 Thread Liam Breck
But golang-nuts is still working... -- 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://grou

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-06 Thread Nitish Saboo
Hi Michel, Yes, this is what I was looking for.Thankyou..:) Can we also find the processor on which this go routine is running? Thanks On Mon, 6 May 2019, 17:43 Michel Levieux, wrote: > Hello, > > Is: > > type Y struct { > > M string > N string > > } > > func initalize() Y{ > // I have a fun