Re: [go-nuts] strings and when to use them

2017-05-11 Thread Ilya Kostarev
On Wed, 10 May 2017 10:05:56 -0700 (PDT) Zachary Kaplan wrote: > can somebody please explain to me when a function > should to return a string as opposed to, say a []byte? thanks > Just a few examples. Strings can be keys in map[string]something, []byte can't be a key due to them are non compara

[go-nuts] How to pass value in nested template if possible?

2017-03-13 Thread Ilya Kostarev
How to pass value in nested template if possible? Template package has terse documentation and not much examples. In brief I want to if err := template.Must(template.New("").Parse(`{{ define "inner" }}{{ . }}{{end}}{{ define "outer" }}{{ template "inner"}}{{end}}`)).ExecuteTemplate(os.Stdout

Re: [go-nuts] Re: correct/working 9p2000 library in Go?

2017-02-24 Thread Ilya Kostarev
Hi, David thanks for the code, slightly offtopic, seems you heavily use Acme which can explore 9p file system directly without mounting, but I forget the syntax on plan9port and can't find appropriate documentation. Can you kindly give me a hint. Cheers __ Ilya On 02/24/2017 10:20 AM, David Ar

Re: [go-nuts] How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ilya Kostarev
It's documented. From lang spec https://golang.org/ref/spec#Function_declarations "A function declaration may omit the body. Such a declaration provides the signature for a function implemented outside Go, such as an assembly routine." On Thu, 9 Feb 2017 04:15:00 -0800 (PS

Re: [go-nuts] [ANN] Memo: take a note in CUI

2017-02-09 Thread Ilya Kostarev
Synchronization with simplenote service https://simplenote.com/ may be very appreciated. simplenote service has huge user base(me too) due to perfect clients for android and OSX and easy sync via simperium API https://simperium.com/. But linux client been made with React app packaged in Electron is

Re: [go-nuts] How to use embedded type to implement functional options for group of related types

2017-02-08 Thread Ilya Kostarev
On 02/08/2017 10:55 PM, Ron Evans wrote: | packagemain import"fmt" type tableServer struct{ table int } type TableServerinterface{ SetTable(table int) GetTable()int } func NewTableServer()TableServer{ return&tableServer{} } func (i *tableServer)SetTable(table int){ i.table =table }

Re: [go-nuts] Re: Is there something wrong with performance of select in a for loop

2017-02-06 Thread Ilya Kostarev
Seems for me, you don't do any selection like in JS code, even any polling. Sure it would perform better. (Maybe I'm missing something, not so proficient in nodejs) On 02/06/2017 08:56 AM, fwang2...@gmail.com wrote: For compared with nodejs: if I remove all the serverDone case, only left the t

Re: [go-nuts] How do you take a cipher.StreamWriter and pass it to a io.Reader

2017-02-02 Thread Ilya Kostarev
You can use io.TeeReader to connect them all. Also to simultaneously read from one file, encrypt, and write to another file on the fly you seems to need a bit of concurrency func (b2h *B2Handler) EncyptandUpload(iv []byte, fileName string, outputFileName string) { key := []byte("example key

Re: [go-nuts] How do you take a cipher.StreamWriter and pass it to a io.Reader

2017-02-02 Thread Ilya Kostarev
Try to construct an io.Pipe maybe pReader, pWriter := io.Pipe() writer:= &cipher.StreamWriter{S: stream, W: pWriter} UploadFile(outputFileName, metadata, pReader) writer.Write(src) On 02/02/2017 10:27 PM, Justin C wrote: I have a encryption function that gives a cipher.StreamWrit

Re: [go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ilya Kostarev
On 01/27/2017 05:20 PM, Ian Lance Taylor wrote: Please file an issue at https://golang.org/issue/new. Thanks. Ian Ian, done, issued. -- 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 i

[go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ilya Kostarev
ooks like a bug, or documentation incorrectness/incompleteness. __ Ilya Kostarev -- 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] Re: Why a single go routine with sleep is using 100% cpu (1 core)

2016-09-11 Thread Ilya Kostarev
tions however `default` most likely be an essence. CPU load is a cost of `select` which is quite expensive operation. __ Ilya Kostarev -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Re: Can't understand untyped constant behavior

2016-09-11 Thread Ilya Kostarev
are integer constants. Manlio Hi Manio. Things are not so simple, say const x, y = int 5, 3 / /explicitly var f float32 = x / y just doesn't compile with an error "cannot use x / y (type int) as type float32 in assignment" __ Ilya Kostarev -- You receiv

[go-nuts] Can't understand untyped constant behavior

2016-09-08 Thread Ilya Kostarev
package main import "fmt" func main() { const x, y = 5, 3 var f float32 = x / y fmt.Println(f) } output 1 https://play.golang.org/p/FH1f793gWI How this doesn't produce 1.6 Would be thankful for explanation. __ Ilya Kostarev -- Yo

Re: [go-nuts] Re: Broadcasting via channel

2016-09-04 Thread Ilya Kostarev
On 09/05/2016 12:14 AM, Jason E. Aten wrote: Or perhaps it is because sync.WaitGroup and sync.Cond (condition variables) exist. They aren't select{}-friendly, but they usually do the job. Yes they aren't select{}-friendly. sync.Cond for example looks like right choice but just blocks. --

[go-nuts] Broadcasting via channel

2016-09-03 Thread Ilya Kostarev
nal = closed //... signal = blocked Does it considered meaningful or/and at least safe? -- Ilya Kostarev -- 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 ema