[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-17 Thread nuskenterprise
Thank you for your Contribution to ease the gioui.
Following link you mentioned for installation in your read file

https://man.sr.ht/~eliasnaur/gio/install.md

does not working now.

Please explain me how to install goui.
Thank you again.

On Tuesday, 17 March 2020 07:55:33 UTC+5, Jason E. Aten wrote:
>
> As an addition to Elias' examples, I wrote a little hello world++ here.
>
> https://github.com/glycerine/hello_gio
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/25f40446-7caa-4e88-9288-fc9a69c0a319%40googlegroups.com.


Re: [go-nuts] My solution to Web Crawler excercise

2020-04-17 Thread Will S
Your deadlock comes from the channel never being closed so the for loop in
your main go routine never ends.
You need to add some logic to figure out when to close the channel, or
break out of the loop (and then close the channel).

- Will

On Fri, Apr 17, 2020 at 2:47 PM Vaibhav  wrote:

> Hi,
> I didn't want to create a new thread with same topic so though of making a
> reply here.
> I made a solution for the same problem
> https://play.golang.org/p/GP8qVB9FPfx without the use of lock and somehow
> it is working, but ends up going in the deadlock! What is going wrong here?
>
> func Crawl(root string, r_depth int, fetcher Fetcher) {
> ch := make(chan struct {
> string
> int
> })
> var wg sync.WaitGroup
> crawl := func(url string, depth int) {
> defer wg.Done()
> if depth <= 0 {
> return
> }
> body, urls, err := fetcher.Fetch(url)
> if err != nil {
> fmt.Println(err)
> return
> }
> fmt.Printf("found: %s %q\n", url, body)
> for _, u := range urls {
> ch <- struct {
> string
> int
> }{u, depth - 1}
> }
> }
> urlMap := map[string]bool{root: true}
> wg.Add(1)
> go crawl(root, r_depth)
> for url := range ch {
> if _, ok := urlMap[url.string]; !ok {
> wg.Add(1)
> go crawl(url.string, url.int)
> urlMap[url.string] = true
> }
> }
> wg.Wait()
> }
>
> Regards,
> Vaibhav
>
> On Tuesday, August 28, 2012 at 3:07:37 AM UTC+5:30, Kyle Lemons wrote:
>>
>> Looks pretty good.
>>
>> On Mon, Aug 27, 2012 at 2:57 AM, Thomas Gawehns 
>> wrote:
>>
>>> Hi folks,
>>> I'm new to go and must admit i like it. But somehow my solution to the
>>> web crawler exercise looks to simple:
>>>
>>> func Crawl(url string, depth int, fetcher Fetcher) {
>>>
>>> visitedUrls := make(map[string]bool, 100)
>>>
>> This is accessed concurrently without a lock.  With GOMAXPROCS=1, this
>> probably won't blow up, but it's technically a data race and thus not
>> "correct."
>>
>>
>>> var InnerCrawl func(url string, depth int,
>>> fetcher Fetcher, finish chan bool)
>>> InnerCrawl = func (url string, depth int,
>>> fetcher Fetcher, finish chan bool) {
>>> defer func() { finish<- true } ()
>>> done := make(chan bool)
>>> if depth <= 0 || visitedUrls[url] {
>>> return
>>> }
>>> visitedUrls[url] = true
>>> body, urls, err := fetcher.Fetch(url)
>>> if err != nil {
>>> fmt.Println(err)
>>> return
>>> }
>>> fmt.Printf("found: %s %q\n", url, body)
>>> for _, u := range urls {
>>> go InnerCrawl(u, depth-1, fetcher, done)
>>> }
>>> for _ = range urls {
>>> <-done
>>> }
>>> }
>>> done := make(chan bool)
>>> go InnerCrawl(url, depth, fetcher, done)
>>> <-done
>>> return
>>> }
>>>
>>> Is there some flaw in it???
>>>  rgds Thomas
>>>
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/a0aebb00-cb03-4bdb-a409-c24f723868d5%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOweqVmdgSzNNQ8ZhEAYd%2BsTLWVsG%3DKuoAzKLtzdvJLEP%2BTPFg%40mail.gmail.com.


Re: [go-nuts] My solution to Web Crawler excercise

2020-04-17 Thread Vaibhav
Hi,
I didn't want to create a new thread with same topic so though of making a 
reply here.
I made a solution for the same problem https://play.golang.org/p/GP8qVB9FPfx 
without 
the use of lock and somehow it is working, but ends up going in the 
deadlock! What is going wrong here?

func Crawl(root string, r_depth int, fetcher Fetcher) {
ch := make(chan struct {
string
int
})
var wg sync.WaitGroup
crawl := func(url string, depth int) {
defer wg.Done()
if depth <= 0 {
return
}
body, urls, err := fetcher.Fetch(url)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("found: %s %q\n", url, body)
for _, u := range urls {
ch <- struct {
string
int
}{u, depth - 1}
}
}
urlMap := map[string]bool{root: true}
wg.Add(1)
go crawl(root, r_depth)
for url := range ch {
if _, ok := urlMap[url.string]; !ok {
wg.Add(1)
go crawl(url.string, url.int)
urlMap[url.string] = true
}
}
wg.Wait()
}

Regards,
Vaibhav

On Tuesday, August 28, 2012 at 3:07:37 AM UTC+5:30, Kyle Lemons wrote:
>
> Looks pretty good.
>
> On Mon, Aug 27, 2012 at 2:57 AM, Thomas Gawehns  > wrote:
>
>> Hi folks,
>> I'm new to go and must admit i like it. But somehow my solution to the 
>> web crawler exercise looks to simple:
>>
>> func Crawl(url string, depth int, fetcher Fetcher) {
>>
>> visitedUrls := make(map[string]bool, 100)
>>
> This is accessed concurrently without a lock.  With GOMAXPROCS=1, this 
> probably won't blow up, but it's technically a data race and thus not 
> "correct."
>  
>
>> var InnerCrawl func(url string, depth int, 
>> fetcher Fetcher, finish chan bool)
>> InnerCrawl = func (url string, depth int, 
>> fetcher Fetcher, finish chan bool) {
>> defer func() { finish<- true } ()
>> done := make(chan bool)
>> if depth <= 0 || visitedUrls[url] {
>> return
>> }
>> visitedUrls[url] = true
>> body, urls, err := fetcher.Fetch(url)
>> if err != nil {
>> fmt.Println(err)
>> return
>> }
>> fmt.Printf("found: %s %q\n", url, body)
>> for _, u := range urls {
>> go InnerCrawl(u, depth-1, fetcher, done)
>> }
>> for _ = range urls {
>> <-done 
>> }
>> }
>> done := make(chan bool)
>> go InnerCrawl(url, depth, fetcher, done)
>> <-done
>> return
>> }
>>
>> Is there some flaw in it???
>>  rgds Thomas
>>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a0aebb00-cb03-4bdb-a409-c24f723868d5%40googlegroups.com.


[go-nuts] Monkey patching question

2020-04-17 Thread Tamás Gulácsi
If you really needy declare another struct with matching layout (field types, 
order, etc) and unsafe-convert it.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9acd9822-07c1-4b21-bf35-b586ec50b176%40googlegroups.com.


Re: [go-nuts] SWIG-generated Go wrapper mishandling(?) pointers to pointers to structs

2020-04-17 Thread Ian Lance Taylor
On Fri, Apr 17, 2020 at 7:34 AM mark mellar  wrote:
>
> (Cross posting with SO 
> https://stackoverflow.com/questions/61258160/swig-generated-go-wrapper-mishandling-pointers-to-pointers-to-structs)
>
> Hi folks,
>
> We're integrating a Go program with a 3rd party C api, but are getting some 
> odd results when working with pointers to pointers to structs. A model of the 
> header file looks a bit like this...
>
> //mytest.h
>
> typedef struct Books {
>  char title[50];
>  char author[50];
>  char subject[100];
>  int book_id;
> }
>
> Book; extern void initbook(Book** b);
>
> With a model implementation like this...
>
> //mytest.c
> #include 
> #include 
> #include 
>
> typedef struct Books {
>  char title[50];
>  char author[50];
>  char subject[100];
>  int book_id;
> } Book;
>
> void initbook(Book** b){ *b = malloc(sizeof(Book));
>  strcpy( (*b)->title, "A Book Title");
> }
>
> We've tried wrapping the API with a very simple SWIG file which looks like 
> this...
>
> %module mytest %{
>  #include "./mytest.h"
> %}
> %include "./mytest.h"
>
> And call it from a Go main function like this...
>
> //main.go
>
> package main
> import "fmt"
> import "mytest"
> func main() {
>  bookPtr := mytest.NewBook()
>  mytest.Initbook(bookPtr)
>  fmt.Printf("title: '%s'\n", bookPtr.GetTitle())
> }
>
> However, we've found when we run this we the value being returned from 
> GetTitle() is garbled
>
> > go run ../main.go
> title: '??'
>
> Digging in to the generated C code we found that editing the Book constructor 
> to return Book** rather than Book*, and then modifying the GetTitle function 
> to receive a Book** instead of Book* things started working as expected.
>
> Any hints on how we might configure SWIG to generate a version of the code 
> which works for us. without us having to hack what it generates?

Since this is a C API, I suggest that you use cgo.  https://blog.golang.org/cgo.

If you want to use SWIG, you'll likely need to use directives like
%gotype to teach SWIG how the C type should be represented in Go.  It
seems clear that SWIG is getting confused, as from what you wrote
above it seems that the Go code ought to be mytest.Initbook().

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUnDW9ZTZZnsjXN9kjLzTYb4weAji%2BE4ne%3DCsOiS2NT6Q%40mail.gmail.com.


Re: [go-nuts] Order of eval in struct keys

2020-04-17 Thread Ian Lance Taylor
On Fri, Apr 17, 2020 at 8:55 AM  wrote:
>
> Reading https://golang.org/ref/spec#Order_of_evaluation does not explain if 
> the order of evaluation in struct is defined.
>
> see https://play.golang.org/p/tjCrTI77UwZ
>
> Is that behavior guaranteed?

There is no guarantee about the order of evaluation within a composite
literal in general.  However, there is a guarantee that all function
calls will be evaluated in left to right order in any expression,
including a composite literal.  So while you didn't actually say what
you expect, I think that your example is guaranteed to behave the same
in any Go implementation.

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUuPFV7YQ5Jhe4ZA_cMuWTHqRQopFWpjGR8S40%2Bxnuy8g%40mail.gmail.com.


Re: [go-nuts] x/text: Interest in Unicode text segmentation?

2020-04-17 Thread Matt Sherman
Nice. Well, happy to discuss how I might be helpful — implementation, API
design, etc.

For the work I’m doing on UAX 29, the key API is unicode.Is. I am satisfied
with the perf so far. unicode.Is dominates the profiling, but that’s to be
expected, as my scanner is basically a tight loop evaluating rune
categories. Certainly open to using a different trie-driven API.

On Fri, Apr 17, 2020 at 1:47 AM  wrote:

> Most of the x/text packages use tries and not rangetables. These allow
> arbitrary data (as long as it fits in an int) to be associated with runes
> and allow operating on utf8 without having to convert to tunes.
> https://godoc.org/golang.org/x/text/internal/triegen. But that’s not a
> requirement.
>
> The package
> https://godoc.org/golang.org/x/text/internal/gen/bitfield converts Go
> structs to ints and can be used to pack the rune data in a convenient way.
>
> Furthermore Package
> https://godoc.org/golang.org/x/text/internal/ucd
> can be used for reading UCD files
>
> And Package
> https://godoc.org/golang.org/x/text/internal/gen
> can be used to generate Go tables other than the trie and include
> utilities to generate canonical x/text files, such as including the Unicode
> and CLDR versions.
>
> The top-level file gen.go is used to orchestrate building x/text and
> captured dependencies between packages.
>
> I may have some designs laying around for the API.
>
> On Thu, 16 Apr 2020 at 21:46 Matt Sherman  wrote:
>
>> Great. Yes, the data files are here:
>> https://unicode.org/reports/tr41/tr41-26.html#Props0
>>
>> I’ve done a proof of concept here: https://github.com/clipperhouse/uax29
>>
>> To do it properly, I assume we’d want to use the house style here?
>> https://github.com/golang/text/blob/master/unicode/rangetable/gen.go
>>
>> On Thu, Apr 16, 2020 at 1:52 PM  wrote:
>>
>>> Yes that would be interesting. Especially if it can be generated from
>>> the Unicode raw data upon updates.
>>>
>>> On Wed, 15 Apr 2020 at 23:56 Ian Lance Taylor  wrote:
>>>
 [ +mpvl ]

 On Wed, Apr 15, 2020 at 2:30 PM Matt Sherman 
 wrote:
 >
 > Hi, I am working on a tokenizer based on Unicode text segmentation
 (UAX 29). I am wondering if there would be an interest in adding range
 tables for word break categories to the x/text or unicode packages. It
 appears they could be code-gen’d alongside the rest of the range tables.
 >
 > Pardon if this is already being done and I have missed it. I see some
 mention of those categories (e.g. ALetter) in other places.
 >
 > My code is here. Thanks.
 >
 > --
 > 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.
 > To view this discussion on the web visit
 https://groups.google.com/d/msgid/golang-nuts/2a058556-da51-46d0-a41b-28e323541332%40googlegroups.com
 .

>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMPnbukOfdaV_D9P1cChmWrN%2BT1kf2OSOAgyXmRf-3PBakbOSw%40mail.gmail.com.


[go-nuts] Monkey patching question

2020-04-17 Thread dick . r . chiang
An upstream package object is lowercase and thus unexported and thwarts my
attempt at using bouk/monkey (github.com/bouk/monkey).

How should I insert a fmt.Println in one of its methods?  Thank you.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/878siuuwbm.fsf%40dick.


[go-nuts] Order of eval in struct keys

2020-04-17 Thread roidelapluie
Hi,

Reading https://golang.org/ref/spec#Order_of_evaluation does not explain if 
the order of evaluation in struct is defined.

see https://play.golang.org/p/tjCrTI77UwZ

Is that behavior guaranteed?

Thanks

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c0784dd4-8e67-436d-b150-c3032e37e70c%40googlegroups.com.


[go-nuts] SWIG-generated Go wrapper mishandling(?) pointers to pointers to structs

2020-04-17 Thread mark mellar
(Cross posting with SO 
https://stackoverflow.com/questions/61258160/swig-generated-go-wrapper-mishandling-pointers-to-pointers-to-structs
)

Hi folks,

We're integrating a Go program with a 3rd party C api, but are getting some 
odd results when working with pointers to pointers to structs. A model of 
the header file looks a bit like this...

//mytest.h 

typedef struct Books {
 char title[50];
 char author[50];
 char subject[100];
 int book_id;
} 

Book; extern void initbook(Book** b);

With a model implementation like this...

//mytest.c 
#include  
#include  
#include  

typedef struct Books {
 char title[50];
 char author[50];
 char subject[100];
 int book_id; 
} Book; 

void initbook(Book** b){ *b = malloc(sizeof(Book));
 strcpy( (*b)->title, "A Book Title"); 
}

We've tried wrapping the API with a very simple SWIG file which looks like 
this...

%module mytest %{
 #include "./mytest.h" 
%} 
%include "./mytest.h"

And call it from a Go main function like this...

//main.go 

package main 
import "fmt" 
import "mytest" 
func main() {
 bookPtr := mytest.NewBook()
 mytest.Initbook(bookPtr)
 fmt.Printf("title: '%s'\n", bookPtr.GetTitle()) 
}

However, we've found when we run this we the value being returned from 
GetTitle() is garbled

> go run ../main.go 
title: '??'

Digging in to the generated C code we found that editing the Book 
constructor to return Book** rather than Book*, and then modifying the 
GetTitle function to receive a Book** instead of Book* things started 
working as expected.

Any hints on how we might configure SWIG to generate a version of the code 
which works for us. without us having to hack what it generates?

Thanks!

Mark

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/acc6b4f8-2928-4b07-91fa-5673396137e9%40googlegroups.com.


[go-nuts] Re: "Timers rely on the network poller", why is that?

2020-04-17 Thread Amnon Baron Cohen
The go runtime does its waiting (both for timers and network events) in 
netpoll.

On Friday, 17 April 2020 11:10:58 UTC+1, Vincent Blanchon wrote:
>
> Hi everyone,
>
> From what I understand, timers are ran by:
> - the P holding them
> - other P if timer-stealing happen (thanks to the async preemption that 
> should not happen often)
> - sysmon thread that, periodically, check if some timers have to run
>
> But, in the comments of the code, I have seen this sentence "Timers rely 
> on the network poller". I wonder how is it related to the net poller, I do 
> not get the relation here.
> Any help is appreciated :)
>
> Thank you
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/29019b79-6d4a-48d2-8f0d-823ffe085e2d%40googlegroups.com.


[go-nuts] Re: How to scan input with termui?

2020-04-17 Thread Brian Candler
Well, it's always good to fix the errors :-)

In short, you'll need to get a string from termui, and then use fmt.Sscanf 
instead of fmt.Scanf.

A quick google for "go termui text input" turns up these as the first two 
hits:
https://github.com/gizak/termui/issues/34
https://github.com/gizak/termui/pull/129

They answer your question.  The second is a contributed text input widget 
which hasn't been merged into the mainline source, but you could use termui 
from this fork.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/beedaab4-bdec-455f-b551-117102477425%40googlegroups.com.


[go-nuts] "Timers rely on the network poller", why is that?

2020-04-17 Thread Vincent Blanchon
Hi everyone,

>From what I understand, timers are ran by:
- the P holding them
- other P if timer-stealing happen (thanks to the async preemption that 
should not happen often)
- sysmon thread that, periodically, check if some timers have to run

But, in the comments of the code, I have seen this sentence "Timers rely on 
the network poller". I wonder how is it related to the net poller, I do not 
get the relation here.
Any help is appreciated :)

Thank you

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f0b2a756-aeff-4d0c-83c3-015f43018842%40googlegroups.com.


Re: [go-nuts] New Go API for protobuf

2020-04-17 Thread Tharaneedharan Vilwanathan
Hi,

In GRPC examples, I deleted helloworld.pb.go and recreated it (after
installing protoc-gen-go from "google.golang.org/protobuf" cmd):

xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ cd helloworld/
xx:~/gopath/src/google.golang.org/grpc/examples/helloworld/helloworld$ *protoc
--go_out=. helloworld.proto *

I then tried to build server and client binaries:

xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ *go build -o
server -v -a greeter_server/main.go *
...
command-line-arguments
# command-line-arguments
greeter_server/main.go:39:2: undefined:
helloworld.UnimplementedGreeterServer
greeter_server/main.go:54:2: undefined: helloworld.RegisterGreeterServer
xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ *go build -o
client -v -a greeter_client/main.go *
...
# command-line-arguments
greeter_client/main.go:44:7: undefined: helloworld.NewGreeterClient

Am I the only one seeing this issue? Did I make any mistake?

Regards
dharani


On Fri, Apr 17, 2020 at 12:40 AM Tharaneedharan Vilwanathan <
vdhar...@gmail.com> wrote:

> Thank you all for the response. I changed the version to 1.4.0 for
> protobuf in grpc. I think it works fine but it also looked like if I
> attempt to regenerate .pb.go file for the "helloworld" example of grpc, it
> didn't quite seem to work. I will try it again a bit later.
>
> Regards
> dharani
>
> On Mon, Apr 13, 2020 at 4:56 PM  wrote:
>
>> In terms of whether the public API needs to change in light of the new
>> protobuf API, the only place that the old protobuf API leaks to the public
>> grpc API is here:
>> https://pkg.go.dev/google.golang.org/grpc/credentials?tab=doc#OtherChannelzSecurityValue
>>  (where
>> it uses the old proto.Message definition here). It seems that users of grpc
>> should be able to use it with almost no effort at all.
>>
>> JT
>>
>> On Monday, April 13, 2020 at 4:01:23 PM UTC-7, Joe Tsai wrote:
>>>
>>> As of right now, grpc is on github.com/golang/protobuf@v1.3.3
>>> .
>>> However, nothing stops you in your specific application to upgrade to
>>> github.com/golang/protobuf@v1.4.0, which just a thin wrapper over the
>>> google.golang.org/protobuf
>>>  module. Better yet,
>>> if you were to start using the google.golang.org/protobuf module
>>> directly, it would impose a weak dependency on
>>> github.com/golang/protobuf@v1.4.0, which would cause grpc to be built
>>> with the new implementation.
>>>
>>> JT
>>>
>>> On Monday, April 13, 2020 at 3:50:13 PM UTC-7, Ian Lance Taylor wrote:

 [ + joetsai ]

 On Mon, Apr 13, 2020 at 3:41 PM Tharaneedharan Vilwanathan
  wrote:
 >
 > Hi,
 >
 > I have a quick question.
 >
 > I was going through this:
 > https://blog.golang.org/protobuf-apiv2
 >
 > I would like to know if grpc is using this new version. To the extent
 I tried, it seemed to use the old API. Am I right? If so, how do I make
 grpc use the new API? Or am I missing something?
 >
 > Please let me know. Appreciate your help!
 >
 > Regards
 > dharani
 >
 > --
 > 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 golan...@googlegroups.com.
 > To view this discussion on the web visit
 https://groups.google.com/d/msgid/golang-nuts/CAN-HoC%3D0JFTTzsQ9LwxTnX3k6F9KdRWG2aAu76W6hSkkvjCzvg%40mail.gmail.com.


>>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/49362219-9235-4960-b5b4-9a55049e2e54%40googlegroups.com
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN-HoCmV74wL9DxzKW2pLRNZNO_T5UjY1BSZNFARWTQ%2BwLo3jw%40mail.gmail.com.


[go-nuts] Re: DeepCloning a datastructure

2020-04-17 Thread Carsten Orthbandt
The easiest way is to marshal everything into some sort of byte slice, then 
unmarshal back. JSON doesn't work for this if there are private fields. But 
gotiny (https://github.com/niubaoshu/gotiny) does. If you use interfaces in 
your data, you have to register their types, everthing else is automatic.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/17810cd4-dab5-4583-8944-aed38b773232%40googlegroups.com.


[go-nuts] Re: How to scan input with termui?

2020-04-17 Thread 洪嘉鴻
I think that you misunderstand my meaning.
The input I wondered is from the keyboards, like this 
.
I have no idea how to implement it with termui.
Besides, I edit the code  to print 
something after closing the UI.
However, the result seems strange.
The result appears with the UI and then disappeared with the UI.

Thanks for your replying.
Max

Brian Candler於 2020年4月16日星期四 UTC+8下午7時21分11秒寫道:
>
> inputParagraph.Text = fmt.Scanf("%s", input) // Error: assignment 
> mismatch: 1 variable but fmt.Scanf returns 2 values
>
> The error message is clear: fmt.Scanf returns two values (BTW, neither of 
> them is the value extracted).  Check the documentation for fmt.Scanf here:
> https://golang.org/pkg/fmt/#Scanf
> https://golang.org/pkg/fmt/#hdr-Scanning
> https://golang.org/pkg/fmt/#example_Sscanf
>
> outputParagraph.Text += fmt.Printf("The string you entered is: %s", input) 
> // multiple-value fmt.Printf() in single-value context
>
> In this case you want fmt.Sprintf instead:
> https://golang.org/pkg/fmt/#Sprintf
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2d109ade-042f-4f35-9bcf-d24b398fa1a1%40googlegroups.com.


Re: [go-nuts] New Go API for protobuf

2020-04-17 Thread Tharaneedharan Vilwanathan
Thank you all for the response. I changed the version to 1.4.0 for protobuf
in grpc. I think it works fine but it also looked like if I attempt to
regenerate .pb.go file for the "helloworld" example of grpc, it didn't
quite seem to work. I will try it again a bit later.

Regards
dharani

On Mon, Apr 13, 2020 at 4:56 PM  wrote:

> In terms of whether the public API needs to change in light of the new
> protobuf API, the only place that the old protobuf API leaks to the public
> grpc API is here:
> https://pkg.go.dev/google.golang.org/grpc/credentials?tab=doc#OtherChannelzSecurityValue
>  (where
> it uses the old proto.Message definition here). It seems that users of grpc
> should be able to use it with almost no effort at all.
>
> JT
>
> On Monday, April 13, 2020 at 4:01:23 PM UTC-7, Joe Tsai wrote:
>>
>> As of right now, grpc is on github.com/golang/protobuf@v1.3.3
>> .
>> However, nothing stops you in your specific application to upgrade to
>> github.com/golang/protobuf@v1.4.0, which just a thin wrapper over the
>> google.golang.org/protobuf
>>  module. Better yet,
>> if you were to start using the google.golang.org/protobuf module
>> directly, it would impose a weak dependency on
>> github.com/golang/protobuf@v1.4.0, which would cause grpc to be built
>> with the new implementation.
>>
>> JT
>>
>> On Monday, April 13, 2020 at 3:50:13 PM UTC-7, Ian Lance Taylor wrote:
>>>
>>> [ + joetsai ]
>>>
>>> On Mon, Apr 13, 2020 at 3:41 PM Tharaneedharan Vilwanathan
>>>  wrote:
>>> >
>>> > Hi,
>>> >
>>> > I have a quick question.
>>> >
>>> > I was going through this:
>>> > https://blog.golang.org/protobuf-apiv2
>>> >
>>> > I would like to know if grpc is using this new version. To the extent
>>> I tried, it seemed to use the old API. Am I right? If so, how do I make
>>> grpc use the new API? Or am I missing something?
>>> >
>>> > Please let me know. Appreciate your help!
>>> >
>>> > Regards
>>> > dharani
>>> >
>>> > --
>>> > 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 golan...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/CAN-HoC%3D0JFTTzsQ9LwxTnX3k6F9KdRWG2aAu76W6hSkkvjCzvg%40mail.gmail.com.
>>>
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/49362219-9235-4960-b5b4-9a55049e2e54%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN-HoCkG8a4uGi81bqA_yxipwEr3yfLHYyiU5W2s_ZR2GEr-Vw%40mail.gmail.com.