Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-06 Thread andrey mirtchovski
> Then how about this? No. -- 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] Will Go 1.9 have entirely concurrent Garbage Collection?

2017-07-06 Thread T L
On Friday, July 7, 2017 at 4:04:21 AM UTC+8, Caleb Spare wrote: > > On Thu, Jul 6, 2017 at 12:41 PM, > wrote: > > Within the release notes for Go 1.9 it is stated: > > "Library functions that used to trigger stop-the-world garbage > collection > > now trigger

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-06 Thread T L
On Friday, July 7, 2017 at 3:26:24 AM UTC+8, Lars Seipel wrote: > > On Thu, Jul 06, 2017 at 12:19:05PM -0700, T L wrote: > > > > package main > > > > import "fmt" > > import "sync/atomic" > > > > func main() { > > var x int32 > > atomic.AddInt32(, 1) > >

[go-nuts] Customized Go template FuncMap example

2017-07-06 Thread Tong Sun
I'm trying my best to make the following Go template FuncMap example works: https://play.golang.org/p/1-JYseLBUF If I comment out line 55, 56 and un-comment line 54, it works just fine. What I was trying to do is to un-comment line 31, and use DefaultFuncs() or something alike to replace line

[go-nuts] Re: Template func ParseFiles, parsing multiple files

2017-07-06 Thread Tong Sun
Thanks Nathan. I'm still confused. >* ParseFiles adds a new template to the collection with the filename as its name* So if my MyTempl was named "tf1", calling MyTempl.ParseFiles() with more than one files will have new templates created according to each of the passed filename? Or the

[go-nuts] Will Go 1.9 have entirely concurrent Garbage Collection?

2017-07-06 Thread ken . kofi . acquah
Within the release notes for Go 1.9 it is stated: "Library functions that used to trigger stop-the-world garbage collection now trigger concurrent garbage collection. Specifically, runtime.GC , debug.SetGCPercent

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-06 Thread Lars Seipel
On Thu, Jul 06, 2017 at 12:19:05PM -0700, T L wrote: > > package main > > import "fmt" > import "sync/atomic" > > func main() { > var x int32 > atomic.AddInt32(, 1) > fmt.Println(atomic.LoadInt32()) > } Sure. > Within a single goroutine, the happens-before order is the order >

[go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-06 Thread T L
package main import "fmt" import "sync/atomic" func main() { var x int32 atomic.AddInt32(, 1) fmt.Println(atomic.LoadInt32()) } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] Re: In which case does compiler not able to get the address of a value?

2017-07-06 Thread T L
http://www.tapirgames.com/blog/golang-summaries#not-addressable On Thursday, July 6, 2017 at 8:09:45 PM UTC+8, Peng wrote: > > Hi, > In the chapter of "Method set" from "Go in Action", there is a description > as below "This shows that it’s not always possible to get the address of a >

[go-nuts] Re: display database table in html table like a gridview or dataview.

2017-07-06 Thread Nathan Kerr
For other readers of this thread: This was solved in Display database table in html table like gridview

[go-nuts] Re: Template func ParseFiles, parsing multiple files

2017-07-06 Thread Nathan Kerr
A text.Template contains one or more named templates. ParseFiles adds a new template to the collection with the filename as its name. Template names are used to tell Template.ExecuteTemplate which of the included templates to execute.

Re: [go-nuts] Capture test output per-function

2017-07-06 Thread Jan Mercl
You should never use fmt.Printf in a test. Use t.Logf instead. On Thu, Jul 6, 2017, 17:29 wrote: > On Thursday, July 6, 2017 at 12:40:30 AM UTC-7, Jan Mercl wrote: > >> On Thu, Jul 6, 2017 at 12:56 AM wrote: >> >> > As far as I can tell, go test

Re: [go-nuts] How does gccgo compile with my own package imported?

2017-07-06 Thread Ian Lance Taylor
On Thu, Jul 6, 2017 at 2:10 AM, ajee wrote: > > Before I post here I did a lot of search by Google, there are several (but > not many) similar topics but all of them don't have valid answer or apply to > me. > > I have a simple code tree like this: > > ├── main.go > └──

[go-nuts] Re: Interrupting stdout writer for runaway child process on Windows

2017-07-06 Thread Matt Ford
One more detail in case anyone builds the code in the link and tries to reproduce. The call to reg.exe will probably succeed with no prompting the first time (the prompt is for value already exists). So it becomes interesting the second time it is run (and all subsequent times). On

Re: [go-nuts] display database table in html table like a gridview or dataview.

2017-07-06 Thread Jakob Borg
Error checking on the template execution is the first thing that comes to mind. //jb On 6 Jul 2017, at 14:10, Connel blaze > wrote: https://play.golang.org/p/QqHXewyDTp This is what i have. It's a simple CRUD example I'm using to learn

Re: [go-nuts] Capture test output per-function

2017-07-06 Thread buchanae . ohsu
On Thursday, July 6, 2017 at 12:40:30 AM UTC-7, Jan Mercl wrote: > > On Thu, Jul 6, 2017 at 12:56 AM wrote: > > > As far as I can tell, go test captures the output per-package, and when > one test fails it dumps all the captured logs. > > It's per test, not package. > > I

Re: [go-nuts] Re: Maximum number of requests per HTTP connection?

2017-07-06 Thread Kevin Conway
> You can have a filter which increments the counter and records for each request from the user and kicks him/her when the limit is crossed. We're actually interested in this problem from the other direction. When making an outbound HTTP request we want to limit the number of times (or the

[go-nuts] Re: Maximum number of requests per HTTP connection?

2017-07-06 Thread uwinsoiwin
Hi there, You can have a filter which increments the counter and records for each request from the user and kicks him/her when the limit is crossed. I do a similar type of check where in I check whether the user has a authenticated session at the point of time of for each request. I did this

[go-nuts] net/http.Do returns "stream error: stream ID 1003; PROTOCOL_ERROR"

2017-07-06 Thread jungho.ahn via golang-nuts
Hello, I'm trying to write a simple Post request like req, err := http.NewRequest(http.MethodPost, url, buf) if err != nil { return err } req.Header.Set(, ) resp, err := httpClient.Do(req) But sometimes, I got the stream error like "stream error: stream ID 1003; PROTOCOL_ERROR".

[go-nuts] Re: [ANN] astisub: Manipulate subtitles in GO (.srt, .stl, .ttml, .webvtt, etc.)

2017-07-06 Thread qrenard
I think unifying all subtitle's types in one package can also help the community greatly. If there are any types of subtitles you'd like to see in this package, feel free to reach out to me. Cheers Le mardi 4 juillet 2017 20:39:40 UTC+2, Tong Sun a écrit : > > That's great! > > On Tuesday,

[go-nuts] How does gccgo compile with my own package imported?

2017-07-06 Thread ajee
Hi, Before I post here I did a lot of search by Google, there are several (but not many) similar topics but all of them don't have valid answer or apply to me. I have a simple code tree like this: ├── main.go └── transform ├── css.go ├── html.go ├── html_test.go └── http.go

[go-nuts] display database table in html table like a gridview or dataview.

2017-07-06 Thread Connel blaze
https://play.golang.org/p/QqHXewyDTp This is what i have. It's a simple CRUD example I'm using to learn go-database/sql. Create works fine but the 'Read' ain't working. When I goto the read route, it's a blank html page. No data. like the struct isn't correct. Is there something I'm missing?

[go-nuts] In which case does compiler not able to get the address of a value?

2017-07-06 Thread Peng
Hi, In the chapter of "Method set" from "Go in Action", there is a description as below "This shows that it’s not always possible to get the address of a value.", the question is in which case does compiler not able to get the address of a value and why, thanks. 01 // Sample program to show

[go-nuts] Re: json.Unmarshal uses RFC3339 to decode datetime but why mine is not working?

2017-07-06 Thread tianzhaixing20121221
thanks very much. 在 2014年2月3日星期一 UTC+8下午4:48:18,Qiang Han写道: > > package main > > import "fmt" > import "time" > import "encoding/json" > > type Foo struct { > Bar time.Time > } > > func main() { > msg := "{\"bar\":\"2012-01-02T16:10:22Z07:00\"}" > var f Foo > err := json.Unmarshal([]byte(msg), )

[go-nuts] Re: Structuring a Go Application based on domain areas

2017-07-06 Thread Egon
Implement a static-analysis that checks such constraints. --- For example in file `customer/address.go` package customer // category: model type Address struct { User user.ID } func (address *Address) Update(controller *Controller) { ... } // alternatively: var _ = architecture.Model({})

Re: [go-nuts] Capture test output per-function

2017-07-06 Thread Jan Mercl
On Thu, Jul 6, 2017 at 12:56 AM wrote: > As far as I can tell, go test captures the output per-package, and when one test fails it dumps all the captured logs. It's per test, not package. jnml@r550:~/tmp/test$ ls all_test.go jnml@r550:~/tmp/test$ cat all_test.go