[go-nuts] Re: Underlying arrays and their slices passed to functions

2018-01-05 Thread jobs jobs
这个问题有意思。 package main import ( "fmt" ) func main() { out := []byte{1, 2, 3, 4} fmt.Println(out) proc(&out) fmt.Println(out) proc2(out) fmt.Println(out) } func proc(p *[]byte) { *p = []byte{5,6,7,8} } func proc2(p []byte) { p[0] = 5 p[1] = 6 p[2]

[go-nuts] Re: How to send multiple responses (file upload progress) to the client?

2018-01-05 Thread Ain
On Friday, January 5, 2018 at 10:51:09 PM UTC+2, Jason Lee wrote: > > I've set up a GoLang post request handler that uploads a file to Google > Cloud Storage. > > Now I'd like to figure out how I can send the upload progress info back to > the client before the whole thing finishes. > If the cli

Re: [go-nuts] Very simple, Td array

2018-01-05 Thread Tong Sun
On Fri, Jan 5, 2018 at 7:53 PM, Tong Sun wrote: > That's OK Dave. It's over. > > All that I wanted is to confirm is that the usage of `tr.Td[1])` was > right. Had I had that faith, there wouldn't have been this email, which > apparently I was focusing on `tr.Td[1])` instead of what I should > be

Re: [go-nuts] Very simple, Td array

2018-01-05 Thread Tong Sun
That's OK Dave. It's over. All that I wanted is to confirm is that the usage of `tr.Td[1])` was right. Had I had that faith, there wouldn't have been this email, which apparently I was focusing on `tr.Td[1])` instead of what I should be focusing. I.e., the answer I was expecting was just merely,

[go-nuts] Re: Go Community Charity Work?

2018-01-05 Thread matthewjuran
From https://www.pharmamanufacturing.com/experts/contract-manufacturing-management-supply-chain-management-/show/71/ In the US: Food and Drug Administration Safety and Innovation Act (FDASIA), Drug Supply Chain Security Act (DSCSA) Don mentions the term "end-to-end security program". Here's a

Re: [go-nuts] Very simple, Td array

2018-01-05 Thread Dave Cheney
The best way to get help for this is to show us precisely what you did, ideally in a small complete, stand-alone, example, and tell us what you expected to happen, and tell us precisely what happened instead. -- You received this message because you are subscribed to the Google Groups "golan

[go-nuts] Re: ListenAndServ and channels

2018-01-05 Thread matthewjuran
Using a channel read in the http handler will block the ticker for loop until the read occurs, but if you want that then pass mc into the generic function: https://play.golang.org/p/GrHQxPhy1qu Using a buffered channel will keep the history of ticks and not block but may run out of buffer space

[go-nuts] Re: How to send multiple responses (file upload progress) to the client?

2018-01-05 Thread matthewjuran
Can you have the client make concurrent periodic get requests that return the current status? Alternatively websockets (https://github.com/gorilla/websocket) may work depending on your deployment needs (Google App Engine doesn’t support them yet and old web browsers don’t support them). Matt

[go-nuts] How to send multiple responses (file upload progress) to the client?

2018-01-05 Thread jason . saeho . lee
I've set up a GoLang post request handler that uploads a file to Google Cloud Storage. Now I'd like to figure out how I can send the upload progress info back to the client before the whole thing finishes. Through lots of searching, I've created a custom PassThru struct that prints the progres

[go-nuts] Re: ListenAndServ and channels

2018-01-05 Thread Amnon Baron Cohen
try using a global var. something like https://play.golang.org/p/05-xBDh5rgn On Thursday, 4 January 2018 15:09:41 UTC, Keith Brown wrote: > > I am trying to Serve a webpage while running a ticker in the background. I > am trying to generate a random number, genRandom() , periodically and > publi

Re: [go-nuts] Meet "fatal morestack on g0" on Linux

2018-01-05 Thread Ian Lance Taylor
On Fri, Jan 5, 2018 at 7:17 AM, wrote: > > I meet a strange problem when running a program on Linux. I get "fatal: > morestack on g0" from stderr. The process is still there but does not > respond anymore. When I use `curl > http://ip:port/debug/pprof/goroutine?debug=1` to check the stack, but it

Re: [go-nuts] Using database/sql in a web application

2018-01-05 Thread Chris Hopkins
Why not use an interface? type TableSaver func (db *DB) or type TableSaver func (tx *Tx) // depending on your needs Allowing you to: func (t *Table) SaveTable (...) {} Which in your example if you wanted use a different SaveTable implementation for OtherTable you could. Otherwise it would ju

Re: [go-nuts] Using database/sql in a web application

2018-01-05 Thread Manlio Perillo
Il giorno venerdì 5 gennaio 2018 16:57:04 UTC+1, Ayan George ha scritto: > > > > On 01/05/2018 10:16 AM, Manlio Perillo wrote: > > Recently I have developed a few web applications in Go, using a > > PostgreSQL database, but I have yet understand the best way to use > > the database/sql package.

[go-nuts] Re: Using database/sql in a web application

2018-01-05 Thread matthewjuran
Here’s an overview of what I’ve done, but no quality claim is made. In package main there’s a global: type DB struct { *sql.DB } var database DB In func main() I call an initialization function that reads a JSON configuration file and does sql.Open with dbname, user, password, host, port,

Re: [go-nuts] Underlying arrays and their slices passed to functions

2018-01-05 Thread Frank Davidson
Thanks, all!!! Frank On Friday, January 5, 2018 at 4:25:33 AM UTC-5, Ian Davis wrote: > > On Thu, 4 Jan 2018, at 6:55 PM, Frank Davidson wrote: > > Thanks!!! Very helpful blog post!! > > So, in proc, the slice header is copied, then an entirely new array is > created - []byte{5,6,7,8} - and the

Re: [go-nuts] Using database/sql in a web application

2018-01-05 Thread Ayan George
On 01/05/2018 10:16 AM, Manlio Perillo wrote: > Recently I have developed a few web applications in Go, using a > PostgreSQL database, but I have yet understand the best way to use > the database/sql package. > I don't know how you're serving web pages but I typically use net/http. This also m

[go-nuts] Meet "fatal morestack on g0" on Linux

2018-01-05 Thread shenli
Hello everyone, I meet a strange problem when running a program on Linux. I get "fatal: morestack on g0" from stderr. The process is still there but does not respond anymore. When I use `curl http://ip:port/debug/pprof/goroutine?debug=1` to check the stack, but it halts. There is nothing usefu

[go-nuts] Using database/sql in a web application

2018-01-05 Thread Manlio Perillo
Recently I have developed a few web applications in Go, using a PostgreSQL database, but I have yet understand the best way to use the database/sql package. The simplest method seems to start a transaction in the HTTP handler and pass a *sql.Tx value to all the functions that need to access the

[go-nuts] package main: Programming in Go (youtube channel)

2018-01-05 Thread aliaksandr . pliutau
Hi, my name is Alex Pliutau, and I started my very first Youtube channel about Programming in Go - https://www.youtube.com/channel/UCI39wKG8GQnuzFPN5SM55qw I write mostly Go these days. And I love to share what I’m doing. If you have something to ask, do not hesitate to send me a message. Curr

Re: [go-nuts] Very simple, Td array

2018-01-05 Thread Tong Sun
Problem is else where, not the tr.Td[*1*]) usage. On Thu, Jan 4, 2018 at 6:16 PM, Tong Sun wrote: > Sorry, it must be the end of the day and my mind is no longer working... > > So I have a type > > type Tr struct { > Td []*Td`xml:"http://www.w3.org/1999/xhtml td,omitempty" > json:"td,om

Re: [go-nuts] Selenium webdriver based testing in Go

2018-01-05 Thread Tong Sun
Thanks to everyone who shared their experiences! On Fri, Jan 5, 2018 at 3:14 AM, Simon Ritchie wrote: > I’ve used the Selenium Firefox plugin to test web servers written in Go. > It’s great for end to end testing of a web server because it doesn’t know > or care what the server is written in. I

Re: [go-nuts] Is it possible to launch a Meltdown or Spectre attack with Go code?

2018-01-05 Thread Rodolfo
https://www.debian.org/security/2018/dsa-4078 2018-01-05 6:49 GMT-04:00 Wojciech S. Czarnecki : > On Thu, 4 Jan 2018 19:35:59 -0800 (PST) > "'Eric Johnson' via golang-nuts" wrote: > >> Anyone have any insight into whether it is possible to launch a Meltdown or >> Spectre attack using Go code? > >

Re: [go-nuts] Is it possible to launch a Meltdown or Spectre attack with Go code?

2018-01-05 Thread Wojciech S. Czarnecki
On Thu, 4 Jan 2018 19:35:59 -0800 (PST) "'Eric Johnson' via golang-nuts" wrote: > Anyone have any insight into whether it is possible to launch a Meltdown or > Spectre attack using Go code? It is *not relevant* what language was used to prepare exploit. It always melts down to the machine code

Re: [go-nuts] Underlying arrays and their slices passed to functions

2018-01-05 Thread Ian Davis
On Thu, 4 Jan 2018, at 6:55 PM, Frank Davidson wrote: > Thanks!!! Very helpful blog post!! > > So, in proc, the slice header is copied, then an entirely new array is > created - []byte{5,6,7,8} - and the slice header copy is set to point > at that new array, and then discarded, whereas in proc 2,

[go-nuts] Selenium webdriver based testing in Go

2018-01-05 Thread Simon Ritchie
I’ve used the Selenium Firefox plugin to test web servers written in Go. It’s great for end to end testing of a web server because it doesn’t know or care what the server is written in. It’s only concerned with the resulting HTML. I recorded some web sessions using the plugin and can then play