Re: [go-nuts] help with bazil.org/fuse

2016-09-07 Thread Julian Phillips
On 07/09/2016 01:08, Dan Kortschak wrote: On Wed, 2016-09-07 at 09:05 +0930, Dan Kortschak wrote: > These are just the flags passed to open. If you want to act on the > truncate flag, do it once within open, not on every single subsequent > call to write. > That makes sense. So, we're narrowing

[go-nuts] Re: How to build mock class?

2016-09-07 Thread Simon Ritchie
I think your problem is this: You have a piece of code that uses a class. You have two classes, one real, one mock and you want to write some client code that can use either of them. Is that right? If you want to use mocking, you must write your classes in the appropriate way, so you may nee

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread sascha.l.teichmann via golang-nuts
2016-09-06 22:47 GMT+02:00, Jason E. Aten : > nice! would you mind releasing under an MIT or BSD license? I think it > would be It's MIT licensed now. > worth posting the hashmap alone as a reusable library. Maybe. For the shootout I prefer the embedded variant to to demonstrate it is do-able w

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread sascha.l.teichmann via golang-nuts
Am Mittwoch, 7. September 2016 11:12:21 UTC+2 schrieb sascha.l@googlemail.com: > > I hope you submit your code... I would be great to be on par with java > all > > around! here's the instructions -- > > > > http://benchmarksgame.alioth.debian.org/play.html > > I will try. Currently my Go

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Luke Mauldin
Thank you for the help, that worked. I don't want to use cgo directly because of the compile overhead and because cgo prevents debugging on Windows. Another question, if there is a C function with the declaration: void returnOutCString(char ** out) I can call the function using: var retPtr uns

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread 'Isaac Gouy' via golang-nuts
On Wednesday, September 7, 2016 at 2:12:21 AM UTC-7, sascha.l@googlemail.com wrote: > > Maybe. For the shootout I prefer the embedded variant to > to demonstrate it is do-able without resorting to 3rd party libs. > Unfortunately, k-nucleotide now explicitly requires use of a built-in / li

[go-nuts] Why don't the embedded T1 and T2 clash?

2016-09-07 Thread T L
package main import "fmt" func main() { var t3 T3 t3.T1.a = 5 t3.T2.a = 3 t3.T1.f() // 5 t3.T2.f() // 3 t3.f() // 5 // <-> t3.T1.f() t3.a = 7 // <=> t3.T1.a = 7 t3.T1.f() // 7 t3.T2.f() // 3 } type T1 struct { a int } func (t T1) f() { fmt.Println(t

[go-nuts] reasonable or not?

2016-09-07 Thread T L
package main import "fmt" func main() { var t2 T2 t2.a = 5 t2.T1.a = 3 t2.f() // 3 t2.T1.f() // 3 } type T1 struct { a int } func (t T1) f() { fmt.Println(t.a) } type T2 struct { T1 a int } -- You received this message because you are subscribed to the Go

[go-nuts] Why don't the embedded T1 and T2 clash?

2016-09-07 Thread T L
// 11.go package main import "fmt" func main() { var is []interface{} fmt.Println(is...) var t3 T3 t3.T1.a = 5 t3.T2.a = 3 t3.T1.f() // 5 t3.T2.f() // 3 t3.f() // 5 // <-> t3.T1.f() t3.a = 7 // <=> t3.T1.a = 7 t3.T1.f() // 7 t3.T2.f() // 3 } typ

Re: [go-nuts] Why don't the embedded T1 and T2 clash?

2016-09-07 Thread Jan Mercl
On Wed, Sep 7, 2016 at 4:42 PM T L wrote: See https://golang.org/ref/spec#Selectors and explain why do you think a clash should happen. -- -j -- 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] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-07 Thread T L
On Wednesday, September 7, 2016 at 10:56:38 PM UTC+8, Jan Mercl wrote: > > On Wed, Sep 7, 2016 at 4:54 PM T L > > wrote: > > https://golang.org/doc/go1compat > yes, risk exists? > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" gro

Re: [go-nuts] reasonable or not?

2016-09-07 Thread Shawn Milochik
If you asked a specific question it would be really helpful in answering you. If you mean the fact that t2.f() returns the same result as t2.T1.f(), then yes -- that's how embedding works in Go if there is no conflicting name at the same level. -- You received this message because you are subscr

Re: [go-nuts] reasonable or not?

2016-09-07 Thread Jan Mercl
On Wed, Sep 7, 2016 at 4:56 PM T L wrote: Reasonable. -- -j -- 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 mor

Re: [go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-07 Thread Jan Mercl
On Wed, Sep 7, 2016 at 4:54 PM T L wrote: https://golang.org/doc/go1compat -- -j -- 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...@goog

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Tamás Gulácsi
That's tricky if you don't know the length, as you must search for the 0 byte. a:=([1<<20]byte(unsafe.Pointer(retPtr))) var b string for i:=0;i<1<<20;i++{ if a[i]==0 {b=string(a[:i])}} -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscrib

[go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-07 Thread T L
. -- 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://groups.google.com/d/optout.

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread sascha.l.teichmann via golang-nuts
Am Mittwoch, 7. September 2016 16:32:19 UTC+2 schrieb Isaac Gouy: > > > > On Wednesday, September 7, 2016 at 2:12:21 AM UTC-7, > sascha.l@googlemail.com wrote: > >> >> Maybe. For the shootout I prefer the embedded variant to >> to demonstrate it is do-able without resorting to 3rd party libs

Re: [go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-07 Thread T L
On Wednesday, September 7, 2016 at 10:56:38 PM UTC+8, Jan Mercl wrote: > > On Wed, Sep 7, 2016 at 4:54 PM T L > > wrote: > > https://golang.org/doc/go1compat > > Then how to write compatibility safe atomic pointer reads/writes code? Do I must use atomic.Value for pointers? > -- > > -j > --

[go-nuts] Re: gomobile init should have a flag if we want only IOS or Android

2016-09-07 Thread Tristian Azuara
I feel that it would be useful, a while ago we were only doing Android Go/mobile development and it forced the iOS download; consider opening an issue here: https://github.com/golang/go/issues On Monday, August 29, 2016 at 7:22:14 AM UTC-7, Abhishek Sinha wrote: > > While doing gomobile init on O

[go-nuts] Re: Go 1.7 Release Candidate 6 is released

2016-09-07 Thread decrew09
Go Gopher Toy on Kickstarter понедельник, 8 августа 2016 г., 23:44:40 UTC+3 пользователь Chris Broadfoot написал: > > Hello gophers, > > We have just released go1.7rc6, a release candidate for Go 1.7. > Some say that it's the best

[go-nuts] Handling multiple things happening at the same time

2016-09-07 Thread Matt Davies
Evening all We're writing a new app and we'd like it to do a number of things at the same time. We're planning on using gocron https://github.com/jasonlvhit/gocron to schedule grabbing some files from another source, then reformatting those files and placing them into a folder in the app. Tha

[go-nuts] Pointer literal

2016-09-07 Thread 'Mihai B' via golang-nuts
Hi there, Any HTTP API with PATCH support needs to use pointers on basic types. Therefore I'm wondering if there is any will/proposal to make pointer initialisation easier to work with basic types. The `standard` way is quite verbose so it seems that most APIs use functions for every possible

Re: [go-nuts] Handling multiple things happening at the same time

2016-09-07 Thread Asit Dhal
Hi Matt, You should run the cronjob in a separate process and the FileServer in another process. mux := http.NewServeMux() fs := http.FileServer(http.Dir("fileserver")) mux.Handle("/", fs) http.ListenAndServe(":8080", mux) The FileServer package provided by the standard libra

Re: [go-nuts] reasonable or not?

2016-09-07 Thread Asit Dhal
Hi, Both t2.f() and t2.T1.f() call the same method. t2.f() calls t2.T1.f() (struct embedding). Inside T1.f(), value of a is 3. t2.T1.f() calls directly. Yes, this is reasonable. If you want absolutely clear to thing to happen, then try this package main import "fmt" func main() { var t

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread 'Isaac Gouy' via golang-nuts
On Wednesday, September 7, 2016 at 8:15:09 AM UTC-7, sascha.l@googlemail.com wrote: > > If this does not count the Benchmark game follows a skewed defintion of a > library. > I'm sorry that you don't seem to understand what is expected. > Can you eleborate please, what a library is?

[go-nuts] Some code review

2016-09-07 Thread nakotoffana
I recently decided to make a small framework for my hobby-project needs. Inspired a little bit on revel. I would like to get some advice or criticism about the code. I am a newbie at Go but I want to keep improving This is the main repository of the framework https://github.com/yaimko/yaimko a

Re: [go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-07 Thread Ian Lance Taylor
On Wed, Sep 7, 2016 at 8:16 AM, T L wrote: > > On Wednesday, September 7, 2016 at 10:56:38 PM UTC+8, Jan Mercl wrote: >> >> On Wed, Sep 7, 2016 at 4:54 PM T L wrote: >> >> https://golang.org/doc/go1compat >> > > Then how to write compatibility safe atomic pointer reads/writes code? Do I > must us

Re: [go-nuts] Pointer literal

2016-09-07 Thread Ian Lance Taylor
On Wed, Sep 7, 2016 at 8:42 AM, 'Mihai B' via golang-nuts wrote: > > Any HTTP API with PATCH support needs to use pointers on basic types. > Therefore I'm wondering if there is any will/proposal to make pointer > initialisation easier to work with basic types. The `standard` way is quite > verbose

Re: [go-nuts] src/log/log.go: What makes it expensive in this code of log.go?

2016-09-07 Thread Ian Lance Taylor
On Tue, Sep 6, 2016 at 9:00 AM, wrote: > > Hey, It's commented "release lock while getting caller info - it's > expensive" in source code of /src/log/log.go line:150. > > I'm confused with what makes it expensive if we didn't unlock the l.mu ? > Does goroutines have context ? As the comment sugg

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread sascha.l.teichmann via golang-nuts
Am Mittwoch, 7. September 2016 18:20:28 UTC+2 schrieb Isaac Gouy: > > > > On Wednesday, September 7, 2016 at 8:15:09 AM UTC-7, > sascha.l@googlemail.com wrote: > >> >> If this does not count the Benchmark game follows a skewed defintion of a >> library. >> > > > I'm sorry that you don't s

Re: [go-nuts] help with bazil.org/fuse

2016-09-07 Thread Julian Phillips
On 07/09/2016 10:39, Dan Kortschak wrote: On Wed, 2016-09-07 at 09:22 +0100, Julian Phillips wrote: On 07/09/2016 01:08, Dan Kortschak wrote: > On Wed, 2016-09-07 at 09:05 +0930, Dan Kortschak wrote: >> > These are just the flags passed to open. If you want to act on the >> > truncate flag, do i

[go-nuts] Go 1.7.1 is released

2016-09-07 Thread Chris Broadfoot
Hi gophers, We have just released Go version 1.7.1, a minor point release. This release includes fixes to the compiler, runtime, documentation, and the compress/flate, hash/crc32, io, net, net/http, path/filepath, reflect, and syscall packages. https://golang.org/doc/devel/release.html#go1.7

Re: [go-nuts] help with bazil.org/fuse

2016-09-07 Thread Dan Kortschak
Thank you so much, Julian. That makes everything clear. On Wed, 2016-09-07 at 19:02 +0100, Julian Phillips wrote: > Not here. The resulting file is 31 bytes, with 19 leading NULs. You > won't see the NULs if you just cat the file though. -- You received this message because you are subscribe

Re: [go-nuts] Why don't the embedded T1 and T2 clash?

2016-09-07 Thread xiiophen
On Wednesday, 7 September 2016 15:59:50 UTC+1, Jan Mercl wrote: > > On Wed, Sep 7, 2016 at 4:42 PM T L > > wrote: > > See https://golang.org/ref/spec#Selectors and explain why do you think a > clash should happen. > -- > > -j > More specifically this (in the spec) "For a value x of type T or

[go-nuts] What was the rationale behind using braces for scoping?

2016-09-07 Thread Anmol Sethi
I’m not here to argue for using indentation for scoping. I just want to know why go decided to go with braces (hehe). No but seriously, I only found a section on the FAQ that says "Go uses brace brackets for statement grouping, a syntax familiar to programmers who have worked with any language

Re: [go-nuts] What was the rationale behind using braces for scoping?

2016-09-07 Thread Rob Pike
Familiarity and clean parsing. See blog.golang.org/2012/splash.article near the end of section 4. -rob On Thu, Sep 8, 2016 at 10:13 AM, Anmol Sethi wrote: > I’m not here to argue for using indentation for scoping. I just want to > know why go decided to go with braces (hehe). > > No but seriou

Re: [go-nuts] What was the rationale behind using braces for scoping?

2016-09-07 Thread Anmol Sethi
That link is dead. I found https://talks.golang.org/2012/splash.article That seems to be what you meant, thanks. But the wording is a bit confusing. E.g. it says that "Some observers objected to Go's C-like block structure with braces, preferring the use of spaces for indentation.” Block struct

Re: [go-nuts] What was the rationale behind using braces for scoping?

2016-09-07 Thread Rob Pike
Sorry, yes, I typed the link from uncaffeinated memory. You found the one I was referring to. The wording is fine. -rob On Thu, Sep 8, 2016 at 10:40 AM, Anmol Sethi wrote: > That link is dead. I found https://talks.golang.org/2012/splash.article > > That seems to be what you meant, thanks. >

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Nigel Tao
On Thu, Sep 8, 2016 at 1:03 AM, Tamás Gulácsi wrote: > for i:=0;i<1<<20;i++{ if a[i]==0 {b=string(a[:i])}} The first part of that could be "for i := range a". You probably want a "break" statement in there too. :-) -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Nigel Tao
On Thu, Sep 8, 2016 at 1:03 AM, Tamás Gulácsi wrote: > a:=([1<<20]byte(unsafe.Pointer(retPtr))) Also, the type needs to be pointer-to-array, not array. a:=(*[1<<20]byte)(unsafe.Pointer(retPtr)) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. T

Re: [go-nuts] Pointer literal

2016-09-07 Thread Dan Kortschak
On Wed, 2016-09-07 at 08:42 -0700, 'Mihai B' via golang-nuts wrote: > Any HTTP API with PATCH support needs to use pointers on basic types. > Therefore I'm wondering if there is any will/proposal to make pointer > initialisation easier to work with basic types. The `standard` way is > quite > ve

Re: [go-nuts] JPEG to RGB issues

2016-09-07 Thread Nigel Tao
JPEG is not a pixel-exact format, even in YCbCr color space. Different Discrete Cosine Transformation implementations may produce slightly different YCbCr and hence RGB values, and still be considered valid JPEG implementations. For example, libjpeg is just one software implementation, in one prog

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread Clark Wierda
On Wednesday, September 7, 2016 at 1:01:23 PM UTC-4, sascha.l@googlemail.com wrote: > > > Am Mittwoch, 7. September 2016 18:20:28 UTC+2 schrieb Isaac Gouy: >> >> >> On Wednesday, September 7, 2016 at 8:15:09 AM UTC-7, >> sascha.l@googlemail.com wrote: >> >>> >>> If this does not count the

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-07 Thread Jason E. Aten
Observe that the java benchmark continues to be allowed to use an accelerated hash table library. -- 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+unsu

Re: [go-nuts] What was the rationale behind using braces for scoping?

2016-09-07 Thread Anmol Sethi
Additionally, I found Rob’s talk here https://youtu.be/VoS7DsT1rdM?t=1263 that also explains the decision. > On Sep 7, 2016, at 8:13 PM, Anmol Sethi wrote: > > I’m not here to argue for using indentation for scoping. I just want to know > why go decided to go with braces (hehe). > > No but se

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Gulácsi Tamás
Thanks! Nigel Tao ezt írta (időpont: 2016. szept. 8., Cs 3:23): > On Thu, Sep 8, 2016 at 1:03 AM, Tamás Gulácsi > wrote: > > a:=([1<<20]byte(unsafe.Pointer(retPtr))) > > Also, the type needs to be pointer-to-array, not array. > > a:=(*[1<<20]byte)(unsafe.Pointer(retPtr)) > -- You received thi

[go-nuts] Re: How to build mock class?

2016-09-07 Thread Simon Ritchie
When I said that you can only mock well-behaved classes, I should have said more. When I say mock, I mean something that satisfies an interface and drives a test. You can also use what I call a dummy to drive your test. To me a dummy is a real structure, such as an http Request, which you cre

[go-nuts] Re: Auto-complete with Go-mode in Emacs

2016-09-07 Thread morozoandrei
I know this is about 4 years late, however reading through the docs I found out that you need to run go install on the "main" package to get auto-complete to recognize all the packages that are part of the file you are working on. it can be found here https://github.com/nsf/gocode#misc basicall

[go-nuts] Gomobile vendoring?

2016-09-07 Thread Matthew Erickson
Hello everyone, We've been running into a vendoring issue regarding our toolset recently. Namely, breaking changes to gomobile will happen within one of our release cycles (such as https://github.com/golang/mobile/commit/2f75be449fbada35ca42f481f9878ba7f02a7e7d ), and cause our builds to bre

[go-nuts] Re: Go 1.7.1 is released

2016-09-07 Thread h . yuhai
Great! Thx! On Thursday, September 8, 2016 at 5:20:31 AM UTC+8, Chris Broadfoot wrote: > > Hi gophers, > > We have just released Go version 1.7.1, a minor point release. > > This release includes fixes to the compiler, runtime, documentation, and > the > compress/flate, hash/crc32, io, net, net/h

[go-nuts] Support of diffie-hellman-group-exchange-sha1

2016-09-07 Thread FY
Hello, Am I missing something ? I am trying to use the exchange algorithm called "diffie-hellman-group-exchange-sha1" It looks like Go does not support it >From this link