Re: [go-nuts] Re: How to load plugin in plugin?

2017-10-08 Thread Nzlov
Thank you.

On Monday, October 9, 2017 at 1:42:24 PM UTC+8, Ian Lance Taylor wrote:
>
> On Sun, Oct 8, 2017 at 10:30 PM, Nzlov  
> wrote: 
> > I want load a plugin `modles.so` in other a plugin `plugin.so` , build 
> > `modles.so` is ok , but build `plugin.so` has error , not defined 
> > `main.main`, but i have added `func main() {}`  into `plugin.go`,like 
> demo 
>
> You are right.  There is a bug when one plugin tries to open another 
> plugin.  I reopened your issue #22175 and tried to clarify it. 
>
> I do not know how hard it will be to make this case work. 
>
> Ian 
>
>
> > On Monday, October 9, 2017 at 1:16:59 PM UTC+8, Ian Lance Taylor wrote: 
> >> 
> >> On Sun, Oct 8, 2017 at 6:30 PM, Nzlov  wrote: 
> >> > 
> >> > But I have added `main.main` 
> >> > 
> >> > On Sunday, October 8, 2017 at 10:15:41 PM UTC+8, Nzlov wrote: 
> >> >> 
> >> >> How to load plugin in plugin? I make a demo , but build plugin has 
> >> >> runtime 
> >> >> error... 
> >> >> runtime.main_main·f: relocation target main.main not defined 
> >> >> runtime.main_main·f: undefined: "main.main" 
> >> 
> >> Tell us exactly what you did, tell us exactly what happened, and tell 
> >> us what you expected to happen instead. 
> >> 
> >> 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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: How to load plugin in plugin?

2017-10-08 Thread Ian Lance Taylor
On Sun, Oct 8, 2017 at 10:30 PM, Nzlov  wrote:
> I want load a plugin `modles.so` in other a plugin `plugin.so` , build
> `modles.so` is ok , but build `plugin.so` has error , not defined
> `main.main`, but i have added `func main() {}`  into `plugin.go`,like demo

You are right.  There is a bug when one plugin tries to open another
plugin.  I reopened your issue #22175 and tried to clarify it.

I do not know how hard it will be to make this case work.

Ian


> On Monday, October 9, 2017 at 1:16:59 PM UTC+8, Ian Lance Taylor wrote:
>>
>> On Sun, Oct 8, 2017 at 6:30 PM, Nzlov  wrote:
>> >
>> > But I have added `main.main`
>> >
>> > On Sunday, October 8, 2017 at 10:15:41 PM UTC+8, Nzlov wrote:
>> >>
>> >> How to load plugin in plugin? I make a demo , but build plugin has
>> >> runtime
>> >> error...
>> >> runtime.main_main·f: relocation target main.main not defined
>> >> runtime.main_main·f: undefined: "main.main"
>>
>> Tell us exactly what you did, tell us exactly what happened, and tell
>> us what you expected to happen instead.
>>
>> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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: How to load plugin in plugin?

2017-10-08 Thread Nzlov
I want load a plugin `modles.so` in other a plugin `plugin.so` , build 
`modles.so` is ok , but build `plugin.so` has error , not defined 
`main.main`, but i have added `func main() {}`  into `plugin.go`,like demo 


On Monday, October 9, 2017 at 1:16:59 PM UTC+8, Ian Lance Taylor wrote:
>
> On Sun, Oct 8, 2017 at 6:30 PM, Nzlov  
> wrote: 
> > 
> > But I have added `main.main` 
> > 
> > On Sunday, October 8, 2017 at 10:15:41 PM UTC+8, Nzlov wrote: 
> >> 
> >> How to load plugin in plugin? I make a demo , but build plugin has 
> runtime 
> >> error... 
> >> runtime.main_main·f: relocation target main.main not defined 
> >> runtime.main_main·f: undefined: "main.main" 
>
> Tell us exactly what you did, tell us exactly what happened, and tell 
> us what you expected to happen instead. 
>
> 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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: How to load plugin in plugin?

2017-10-08 Thread Ian Lance Taylor
On Sun, Oct 8, 2017 at 6:30 PM, Nzlov  wrote:
>
> But I have added `main.main`
>
> On Sunday, October 8, 2017 at 10:15:41 PM UTC+8, Nzlov wrote:
>>
>> How to load plugin in plugin? I make a demo , but build plugin has runtime
>> error...
>> runtime.main_main·f: relocation target main.main not defined
>> runtime.main_main·f: undefined: "main.main"

Tell us exactly what you did, tell us exactly what happened, and tell
us what you expected to happen instead.

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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] request for feedback: channels for JavaScript

2017-10-08 Thread david
Hi,

Inspired by Go's channels I just created a port for JavaScript.  My aim was 
to make it idiomatic while keeping it faithful to how channels are used in 
Go.  I'd love it if any JavaScript users would check it out and give me 
some feedback.

https://github.com/NodeGuy/channel


Thanks,
David

-- 
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.


[go-nuts] Re: How to load plugin in plugin?

2017-10-08 Thread Nzlov

But I have added `main.main`
On Sunday, October 8, 2017 at 10:15:41 PM UTC+8, Nzlov wrote:
>
> How to load plugin in plugin? I make a demo 
>  , but build plugin has runtime 
> error...
> runtime.main_main·f: relocation target main.main not defined
> runtime.main_main·f: undefined: "main.main"
>
>
>

-- 
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.


[go-nuts] Re: [golang-dev] How to load plugin in plugin?

2017-10-08 Thread Nzlov
Sorry,please help me.

On Sunday, October 8, 2017 at 10:47:46 PM UTC+8, Ralph Corderoy wrote:
>
> Hi Nzlov, 
>
> > How to load plugin in plugin? 
>
> You've emailed the wrong list.  :-) 
> To talk to users of the Go programming language you want Go Nuts. 
> See the guidance at the start of https://golang.org/help/ 
>
> -- 
> Cheers, Ralph. 
> https://plus.google.com/+RalphCorderoy 
>

-- 
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.


[go-nuts] [ANN] roger, an app configuration library experiment

2017-10-08 Thread Alex Buchanan
My weekend project for that past couple weeks has been 
roger: https://github.com/buchanae/roger

This is another take on application configuration management: flags, env 
vars, YAML, etc.

The core ideas are:
- define config as structs
- defaults are defined by functions which return instances of structs
- static code analysis and generation provides some extra metadata, pulling 
docs from code comments on struct fields
- able to dump YAML with docs and exclude default/empty values

Other than that, it's probably just a more buggy version of existing 
libraries (such as viper) with less features. I'll probably keep chipping 
away at it though.

It also:
- generates flags
- loads values from environment variables
- loads values from a YAML file
- coerces time.Duration and github.com/alecthomas/units and others 
via github.com/spf13/cast

More in the README

Thanks!
Alex

-- 
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.


[go-nuts] Re: Variable scope for text/template

2017-10-08 Thread bep
https://github.com/golang/go/issues/10608

bep


fredag 6. oktober 2017 07.22.49 UTC+2 skrev Hein Meling følgende:
>
> Hi all,
>
> Please see linked example code. I've been trying set a "global" variable 
> ($LastName in the example) for use inside a named template (phony in the 
> example), but the scoping rules for the template packages does not follow 
> common scoping rules typically used in other languages, including Go. And 
> it is not possible to pass more "arguments/pipelines" to the named 
> template. Any suggestions on how to accomplish something like this.
>
> https://play.golang.org/p/VjeNwr6RFe
>
> All the best,
> :) Hein
>

-- 
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: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Jan Mercl
On Sun, Oct 8, 2017 at 8:02 PM Zack Scholl  wrote:

> Why does it slow down the code if its not inlined? Since the method is on
a pointer struct I assume it wouldn't need to copy anything?

Call/return is not free even before stack limit checking, pushing the
arguments and retrieving the return values.


-- 

-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 more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Zack Scholl
Why does it slow down the code if its not inlined? Since the method is on a 
pointer struct I assume it wouldn't need to copy anything?

I'd like to not use inlining because I need the code of this function to be 
used by two different functions and would rather not have to update the 
code twice each time its needed.

Thanks for the io.Writer idea, I'll look into that!

On Sunday, October 8, 2017 at 7:26:58 AM UTC-5, Uli Kunitz wrote:
>
> A function call per input byte will slow your code down unless the 
> function is inlined. The for loop is quite simple so I wonder why you want 
> to separate it. You should also think about whether you want to replace the 
> process method by a Write method, making your object an io.Writer and much 
> more universal.
>
>

-- 
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.


[go-nuts] Re: [golang-dev] How to load plugin in plugin?

2017-10-08 Thread Ralph Corderoy
Hi Nzlov,

> How to load plugin in plugin?

You've emailed the wrong list.  :-)
To talk to users of the Go programming language you want Go Nuts.
See the guidance at the start of https://golang.org/help/

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

-- 
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.


[go-nuts] Re: go doc for private github repositories

2017-10-08 Thread prateek papriwal
Try out https://rocro.com/docstand. You can simply signin 
(https://docstand.rocro.com/signin) and register your private repository. 
And then whenever you push new commits to your repo, your documentation is 
updated (continuous documentation).

On Saturday, 25 January 2014 05:32:58 UTC+9, Tim Schindler wrote:
>
> hey there,
>
> sorry for the noice, but I am wondering how to use godoc.org for private 
> github repositories. is that possible at all? godoc.org is really cool, 
> but some of us cannot do without private repo's. the command `godoc` seems 
> not to be what I want, because I need to compile the documentation by 
> myself every time again, and so need to do others. 
>
> 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] How to load plugin in plugin?

2017-10-08 Thread Nzlov
How to load plugin in plugin? I make a demo 
 , but build plugin has runtime 
error...
runtime.main_main·f: relocation target main.main not defined
runtime.main_main·f: undefined: "main.main"


-- 
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.


[go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread as
Take the loop and put it inside the function call. Don't make function 
calls in the body of a hot loop, take advantage of the loop optimizations 
in the runtime and your cpu cache.

On Sunday, October 8, 2017 at 3:57:04 AM UTC-7, Zack Scholl wrote:
>
> Why is it that when I a method on an struct pointer, like
>
> func (s *Object) process(inputs []byte) {
> for _, i := range inputs {
> // Lots of code
> }
> }
>
> it will slow down *a lot* if I move // Lots of code to its own function? 
> I.e. I reorganize the above program two use two methods,
>
> func (s *Object) process(inputs []byte) {
> for _, i := range inputs {
> processInput(i)
> }
> }
>
> func (s *Object) processInput(i byte) {
> // Lots of code
> }
>
> This new code runs 30% slower now! 
>
> Why? 
>
> This matters because I'm in a situation in *pluck* where I need // Lots 
> of code in two places. You can reproduce this in *pluck* by running
>
>
> go get -u github.com/schollz/pluck
> cd $GOPATH/src/github.com/schollz/pluck/pluck
> git checkout ef1004f && go test -bench=Stream -run=z
> git checkout 76c4e96 && go test -bench=Stream -run=z
> git diff 76c4e96 ef1004f # shows that I replace lots of code with one 
> function
>
>
>
>

-- 
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.


[go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Uli Kunitz
A function call per input byte will slow your code down unless the function 
is inlined. The for loop is quite simple so I wonder why you want to 
separate it. You should also think about whether you want to replace the 
process method by a Write method, making your object an io.Writer and much 
more universal.

-- 
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.


[go-nuts] Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread zack . scholl
Why is it that when I a method on an struct pointer, like

func (s *Object) process(inputs []byte) {
for _, i := range inputs {
// Lots of code
}
}

it will slow down *a lot* if I move // Lots of code to its own function? 
I.e. I reorganize the above program two use two methods,

func (s *Object) process(inputs []byte) {
for _, i := range inputs {
processInput(i)
}
}

func (s *Object) processInput(i byte) {
// Lots of code
}

This new code runs 30% slower now! 

Why? 

This matters because I'm in a situation in *pluck* where I need // Lots of 
code in two places. You can reproduce this in *pluck* by running


go get -u github.com/schollz/pluck
cd $GOPATH/src/github.com/schollz/pluck/pluck
git checkout ef1004f && go test -bench=Stream -run=z
git checkout 76c4e96 && go test -bench=Stream -run=z
git diff 76c4e96 ef1004f # shows that I replace lots of code with one 
function



-- 
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.