[go-nuts] Re: slice: copy to zero length slice

2016-10-02 Thread djadala
Hi, you want to use append, not copy: https://play.golang.org/p/1TXCsC4-GJ On Sunday, October 2, 2016 at 5:18:42 PM UTC+3, 高橋誠二 wrote: > > As official doc explains, copy to zero length slice results to be empty. > > package main > > import "fmt" > > func main() { > src := []int{1, 2, 3} >

[go-nuts] [ANN] gopherpit - service to manage remote import paths with custom domains

2016-10-02 Thread Janoš Guljaš
Hello, A few months ago, I announced [0] a service for managing Go import paths for custom domains gopherpit.com. It was made for personal needs for private and commercial projects that are not hosted on github. The source code and binary releases are now available on GitHub [1], as well as

Re: [go-nuts] How to define two identical named types?

2016-10-02 Thread Marvin Renich
* Matt Harden [161001 23:34]: > I do think that T L has a point. The spec defines the syntax of the > language, and TypeSpec refers to a syntactical construct. It is not > possible in the syntax of the language to create two named types that > originate in the same

[go-nuts] Re: Go locking and channels much slower than Java equivalent, program spends most of time in sync.(*Mutex).Lock() and sync.(*Mutex).Unlock()

2016-10-02 Thread Caleb Doxsey
One thing you can try is to increase the number of locks so that the goroutines aren't all stopped on a single lock. For example you can partition your stores: https://play.golang.org/p/y16yr57KcQ type PartitionedStore struct { stores []Store } func NewPartitionedStore(sz int)

[go-nuts] about interface data pointer

2016-10-02 Thread 刘桂祥
package main import ( "fmt" ) func main() { a := interface{}(100) println(, a) fmt.Sprint(a) } go run x.go the output: 0xc42003bf18 (0x89040,0xc42000a2c0) I just want to ask 0xc42000a2c0 as the a (interface{}) 's data pointer is point to where ? heap ? also I test this:

Re: [go-nuts] slice: copy to zero length slice

2016-10-02 Thread Pietro Gagliardi
No, it should not operate that way. Remember that all function calls in Go pass arguments by value. A slice is actually a value somewhat analogous to type SliceOfT struct { Data*T Len int Cap int } When

[go-nuts] Re: about interface data pointer

2016-10-02 Thread Dave Cheney
-gcflags="-m -m" will make the compiler print out its escape analysis choices. This might be easier than instrumenting your code, which might affect the escape analysis decisions. On Monday, 3 October 2016 13:48:47 UTC+11, 刘桂祥 wrote: > > Yes you are right . thanks a lot and I try more debug

Re: [go-nuts] Re: vender folder problem

2016-10-02 Thread 'Axel Wagner' via golang-nuts
You seemingly use both a vendored version of go-kit and a non-vendored version (likely you are importing something from outside of vendor/ which imports go-kit itself) and are trying to use a Counter from the vendored version in the unvendored version. As the two are different packages, the

Re: [go-nuts] How to define two identical named types?

2016-10-02 Thread T L
Ok, in fact, this is really a problem about how to comprehend the words in go spec. There are two different interpretations of the words for the following two questions, 1. what does "the same type-spec" mean? 2. what does "two named types" mean? Your interpretations: 1. "the same type-spec"

[go-nuts] Any plan on improving Go's escape analysis?

2016-10-02 Thread Aliaksandr Valialkin
fmt.* functions may call Stringer and Formatter interface methods for the passed arguments, so the arguments may escape when calling these methods. Probably, conditional escaping may be implemented for function argument. For example of fmt.*, escape only arguments implementing Stringer or

Re: [go-nuts] Re: vender folder problem

2016-10-02 Thread topiyadharesh
my main.go is in https://github.com/dharesh007/challenge2016/tree/master/cmd/locationService folder and vender dir is in it. where should I put vendor dir. On Sunday, 2 October 2016 14:47:53 UTC+5:30, Axel Wagner wrote: > > That repository contains no vendor/ folder. > > On Sun, Oct 2, 2016 at

Re: [go-nuts] Re: go escape analysis

2016-10-02 Thread 刘桂祥
Hi Chris: I am gopher from Beijing China . I am very like programing and adore the old hack culture . and NBA too! I am very happy in google groups and receive the answer so quickly. go on practice programing and improve my badly english

Re: [go-nuts] Re: vender folder problem

2016-10-02 Thread 'Axel Wagner' via golang-nuts
That repository contains no vendor/ folder. On Sun, Oct 2, 2016 at 9:49 AM, wrote: > I am using vendor version only > > On Sunday, 2 October 2016 12:40:28 UTC+5:30, Axel Wagner wrote: >> >> You seemingly use both a vendored version of go-kit and a non-vendored >>

[go-nuts] Initialize Fields

2016-10-02 Thread dc0d
Why there is no field initializer in Go? Like: type gate struct { outgoing = make(chan *sendRequest) incoming = make(chan update, 10) } Doesn't that make zero value more useful? The syntax already exists for global variables so IMHO not much new would get introduced to the language

[go-nuts] Re: vender folder problem

2016-10-02 Thread topiyadharesh
Got It. Vendor folder should be at root of repo. thanks. On Sunday, 2 October 2016 09:37:06 UTC+5:30, topiya...@gmail.com wrote: > > I have two import packages and have it in vendor dir. > > kitprometheus "github.com/go-kit/kit/metrics/prometheus" > > stdprometheus

Re: [go-nuts] os package...???

2016-10-02 Thread Alexander Kapshuk
On Sat, Oct 1, 2016 at 4:21 PM, wrote: > > What applications can be build package OS ??? > > if u can say example i be very happy > > thanks > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from

Re: [go-nuts] How to define two identical named types?

2016-10-02 Thread 'Axel Wagner' via golang-nuts
So, I don't really get what's the problem here, tbh. The spec seams perfectly fine as it is right now to me. * If two named types come from different type-specs, they are not treated as identical. We covered how that can happen. * If two named types come from the same type-spec, then they are

[go-nuts] Re: vender folder problem

2016-10-02 Thread topiyadharesh
https://github.com/dharesh007/challenge2016 I think it's related to package alias. "github.com/go-kit/kit/log" "github.com/go-kit/kit/metrics" works fine. but kitprometheus "github.com/go-kit/kit/metrics/prometheus" stdprometheus

Re: [go-nuts] Re: vender folder problem

2016-10-02 Thread topiyadharesh
I am using vendor version only On Sunday, 2 October 2016 12:40:28 UTC+5:30, Axel Wagner wrote: > > You seemingly use both a vendored version of go-kit and a non-vendored > version (likely you are importing something from outside of vendor/ which > imports go-kit itself) and are trying to use a

Re: [go-nuts] Any plan on improving Go's escape analysis?

2016-10-02 Thread Jesper Louis Andersen
On Sat, Oct 1, 2016 at 6:45 PM, Ian Lance Taylor wrote: > There are improvements to the compiler's escape analysis in every release. Also, escape/representation analysis is approximate in nature. So you can't easily detect all variants of this and have the compiler optimize

Re: [go-nuts] Initialize Fields

2016-10-02 Thread dc0d
You are right. But this felt clean and obvious syntax. Back to NewGate! On Sunday, October 2, 2016 at 1:47:27 PM UTC+3:30, Axel Wagner wrote: > > Because that wouldn't be "the zero value" anymore. > It would require that, when you do e.g. > x := make([]gate, 4096) > that the compiler emits the

[go-nuts] Go locking and channels much slower than Java equivalent, program spends most of time in sync.(*Mutex).Lock() and sync.(*Mutex).Unlock()

2016-10-02 Thread toefel18
Hi, I've written a small library (https://github.com/toefel18/go-patan) in that stores counters and collects statistics (running min/max/average/stddeviation) of a program during runtime. There is a lock based implementation and a channel based implementation. I've written this library before

Re: [go-nuts] OpenWRT-friendly golang hardware

2016-10-02 Thread Simon Larcher
>From what I understood, MIPS32 support for Golang has been in the pipeline for some time already so it might appear at some point. MIPS64 is there since 1.6 and fully supported in 1.7. Sadly, very few OpenWRT hardware uses MIPS64, only the higher grade products do. You will have to use gccgo

[go-nuts] SWIG and anonymous field inheritance

2016-10-02 Thread Shengqiu Li
Hi all, I'm making a binding of a C++ library for go, and I'm wondering why the anonymous field inheritance isn't used in the go wrapper code. I have found a piece of comment in the go backend of SWIG, saying: // For each method defined in a base class but not defined in > // this

[go-nuts] slice: copy to zero length slice

2016-10-02 Thread 高橋誠二
As official doc explains, copy to zero length slice results to be empty. package main import "fmt" func main() { src := []int{1, 2, 3} dst := []int{} fmt.Println(len(dst)) copy(dst, src) fmt.Println(src) fmt.Println(dst) // [1 2 3] // [] src2 := []int{1, 2,