[go-nuts] Re: Named results allocated on stack instead of register?

2021-09-20 Thread tapi...@gmail.com
It looks this is related to code inlining. If we add //go:noinline directive for the two functions, then they have no performance difference. On Monday, September 20, 2021 at 12:39:51 PM UTC-4 tapi...@gmail.com wrote: > Sometimes, a function with named results is slower. > For example:

Re: [go-nuts] Idea extending xerror.As

2021-09-20 Thread Andrey T.
... or, to put a crazy idea out there, we need to ask for extension of switch statement to support (v, err) tuples for a case argument... On Sunday, September 19, 2021 at 3:43:36 PM UTC-6 david@gmail.com wrote: > On Sun, Sep 19, 2021 at 5:19 PM roger peppe wrote: > >> In some ways, the

Re: [go-nuts] What is the total max size of embed content?

2021-09-20 Thread Glen Newton
Hello, Thanks for this, and also sorry for the lazy question. My testing on my machine indicates a limit of 2GB total limit on compile: too much data in section SXCOFFTOC (over 2e+09 bytes) too much data in section SDATA (over 2e+09 bytes) I have built a bash script that creates large random

[go-nuts] [ANN] Pack: Interfaces for LZ77-based data compression

2021-09-20 Thread Andy Balholm
Many data-compression schemes are conceptually composed of two steps: LZ77 (finding repeated sequences) and entropy encoding. But I've never found a compression library that treats those steps as separate components. So I made one: github.com/andybalholm/pack. It defines interfaces for the two

Re: [go-nuts] Re: Generating go code using go templates

2021-09-20 Thread Denis Cheremisov
Trees although better in general than template still have one critical disadvantage: it is hard to control a code they produces.I tried approaches with templates, line by line and trees. Line by line is generally the best of them. понедельник, 20 сентября 2021 г. в 23:15:22 UTC+3,

Re: [go-nuts] What is the total max size of embed content?

2021-09-20 Thread Ian Lance Taylor
On Mon, Sep 20, 2021 at 2:04 PM Glen Newton wrote: > > I am testing this with an increasing number of 1GB files. At 3 files, and I > am getting this error: > > compile: writing output: write $WORK/b001/_pkg_.a: no space left on device > > I haven't been able to find how to change $WORK to point

Re: [go-nuts] What is the total max size of embed content?

2021-09-20 Thread Glen Newton
Thanks. I am testing this with an increasing number of 1GB files. At 3 files, and I am getting this error: compile: writing output: write $WORK/b001/_pkg_.a: no space left on device I haven't been able to find how to change $WORK to point to a larger partition. Suggestions? Oh, running:

Re: [go-nuts] Re: Generating go code using go templates

2021-09-20 Thread Chetan Gowda
Yes. Generating large portions of code via templates is going to be hard. Especially reusing and maintaining it. There is an excellent library called jennifer - https://github.com/dave/jennifer that lets you generate Go code by building the syntax tree. The examples make it super simple to get

Re: [go-nuts] Re: Generating go code using go templates

2021-09-20 Thread Vasiliy Tolstov
I'm writing a code generator from protobuf via templates and i can say - debugging it is very hard. When you have big files you can't check syntax easily, don't know how it looks and if you have errors in the template it is really hard to fix them. So the protoc-gen-go case is preferable. вс, 19

[go-nuts] Re: setuid root

2021-09-20 Thread Rich
Thanks -- that worked. On Monday, September 20, 2021 at 2:11:21 PM UTC-4 Tamás Gulácsi wrote: > chmod 4755 is not enough. Your binary must be owned by root, to run root - > setuid means "run as owner". > > Rich a következőt írta (2021. szeptember 20., hétfő, 19:54:33 UTC+2): > >> Yes. I tried

[go-nuts] Re: setuid root

2021-09-20 Thread Rich
OK -=- My mistake. When you setuid a program it sets the user to the owner of the file. So I owned the file, so it would run as me. When I did a chown root myapplication -- it runs like it should. Thanks everyone for the help. On Monday, September 20, 2021 at 1:54:33 PM UTC-4 Rich wrote: >

[go-nuts] Re: setuid root

2021-09-20 Thread Tamás Gulácsi
chmod 4755 is not enough. Your binary must be owned by root, to run root - setuid means "run as owner". Rich a következőt írta (2021. szeptember 20., hétfő, 19:54:33 UTC+2): > Yes. I tried running an exec: cmd=exec.Command("whoami") and it came as my > user id not root. But to set the

[go-nuts] Re: setuid root

2021-09-20 Thread Rich
Yes. I tried running an exec: cmd=exec.Command("whoami") and it came as my user id not root. But to set the permissions I'd run: 'chmod 4755 myapplication' On Monday, September 20, 2021 at 11:20:39 AM UTC-4 Tamás Gulácsi wrote: > You mean "chown root app; chmod 4755 app" ? > > Rich a

[go-nuts] [ANN] Encore v0.17 is out — The fastest way to build Go backends

2021-09-20 Thread ean...@gmail.com
Hey everyone, we've just released Encore v0.17 ! For those who don't know, Encore is an open-source Go framework for building cloud backends and distributed systems. It's the most productive way of getting your backend application

[go-nuts] Named results allocated on stack instead of register?

2021-09-20 Thread tapi...@gmail.com
Sometimes, a function with named results is slower. For example: https://play.golang.org/p/wvWkfSRqDLr The generated directives are almost the same for the two functions with a named and unnamed result, except one difference. For the function with the named result, the result represents as "".ret

Re: [go-nuts] What is the total max size of embed content?

2021-09-20 Thread Ian Lance Taylor
On Mon, Sep 20, 2021 at 9:20 AM Glen Newton wrote: > > The maximum size for any single embedded file as []byte is 4GB. What is the > total maximum size for all embedded files included this way in a Go binary? > Also, are there any platform dependencies? The total maximum size for all embedded

[go-nuts] What is the total max size of embed content?

2021-09-20 Thread Glen Newton
Hello, The maximum size for any single embedded file as []byte is 4GB. What is the total maximum size for all embedded files included this way in a Go binary? Also, are there any platform dependencies? Thanks, Glen -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: setuid root

2021-09-20 Thread Brian Candler
Try: cmd:=exec.Command("id") If it's definitely running as root then it could be other system-level restrictions: SELinux for example. If so, "dmesg" output may give you a clue, logging the policy violation. On Monday, 20 September 2021 at 16:20:39 UTC+1 Tamás Gulácsi wrote: > You mean

[go-nuts] Re: setuid root

2021-09-20 Thread Tamás Gulácsi
You mean "chown root app; chmod 4755 app" ? Rich a következőt írta (2021. szeptember 20., hétfő, 16:57:38 UTC+2): > I am trying to create a go program so that I can peform an action that is > more complex than the example I have below. I can't give sudo right so run > the application due to

[go-nuts] setuid root

2021-09-20 Thread Rich
I am trying to create a go program so that I can peform an action that is more complex than the example I have below. I can't give sudo right so run the application due to some policy we have at work that certain groups can only have read permissions. The company also have a policy that states